当前位置: 首页>>代码示例>>Java>>正文


Java IntentService类代码示例

本文整理汇总了Java中android.app.IntentService的典型用法代码示例。如果您正苦于以下问题:Java IntentService类的具体用法?Java IntentService怎么用?Java IntentService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IntentService类属于android.app包,在下文中一共展示了IntentService类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeSource

import android.app.IntentService; //导入依赖的package包/类
@Override
public void writeSource(Writer writer) throws IOException {

    TypeSpec typeSpec = TypeSpec.classBuilder(getSimpleName())
            .superclass(ClassName.get(IntentService.class))
            .addModifiers(Modifier.PUBLIC, Modifier.FINAL)
            .addField(createFieldMessenger())
            .addField(createFieldAllocations())
            .addField(createFieldRun())
            .addMethod(createConstructor())
            .addMethod(createOnBind())
            .addMethod(createOnHandleIntent())
            .build();

    JavaFile javaFile = JavaFile.builder(PACKAGE, typeSpec)
            .addFileComment("Generated by MemoryServiceWriter.java. Do not modify!")
            .build();

    javaFile.writeTo(writer);
}
 
开发者ID:T-Spoon,项目名称:Android-Developer-Toolbelt,代码行数:21,代码来源:MemoryServiceWriter.java

示例2: AndroidApkMaker

import android.app.IntentService; //导入依赖的package包/类
public AndroidApkMaker(IntentService service, 
                       NotificationManager mNotifyManager, 
                       NotificationCompat.Builder mBuilder){
    this.service = service;
    this.mNotifyManager = mNotifyManager;
    this.mBuilder = mBuilder;
}
 
开发者ID:theaetetus,项目名称:AndroidApkMaker,代码行数:8,代码来源:AndroidApkMaker.java

示例3: enqueueForService

import android.app.IntentService; //导入依赖的package包/类
public static void enqueueForService(Context context, Class<? extends IntentService> clazz, int appWidgetId, String action, Map<String, String> extraStrings) {
    Intent intent = new Intent(context, clazz)
            .setAction(action)
            .putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);

    fillIntent(intent, extraStrings, null);
    context.startService(intent);
}
 
开发者ID:rmnoon,项目名称:WorkflowyList,代码行数:9,代码来源:AppWidgetUtils.java

示例4: AndroidResourceInjector

import android.app.IntentService; //导入依赖的package包/类
AndroidResourceInjector(T object, Object... possibleParents) {
    super(possibleParents);
    this.object = object;
    getTopClasses().add(Application.class);
    getTopClasses().add(Fragment.class);
    try {
        getTopClasses().add(Class.forName("android.app.Fragment"));
    } catch (ClassNotFoundException ignored) {

    }
    getTopClasses().add(IntentService.class);
    getTopClasses().add(Service.class);
    getTopClasses().add(AppCompatActivity.class);
    getTopClasses().add(Activity.class);
}
 
开发者ID:freefair,项目名称:android-injection,代码行数:16,代码来源:AndroidResourceInjector.java

示例5: shouldSetIntentRedelivery

import android.app.IntentService; //导入依赖的package包/类
@Test
public void shouldSetIntentRedelivery() {
  IntentService intentService = new TestIntentService();
  ShadowIntentService shadowIntentService = shadowOf(intentService);
  assertThat(shadowIntentService.getIntentRedelivery()).isFalse();
  intentService.setIntentRedelivery(true);
  assertThat(shadowIntentService.getIntentRedelivery()).isTrue();
  intentService.setIntentRedelivery(false);
  assertThat(shadowIntentService.getIntentRedelivery()).isFalse();
}
 
开发者ID:qx,项目名称:FullRobolectricTestSample,代码行数:11,代码来源:IntentServiceTest.java

示例6: onStartCommand

import android.app.IntentService; //导入依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
	if (isServiceRunning()) {
		// Do not call super i.e. do not call onHandleIntent
		return IntentService.START_NOT_STICKY;
	}
	singletonLocationService = this;

	Toast.makeText(this, "service starting", Toast.LENGTH_SHORT).show();

	int resultCode = GooglePlayServicesUtil
			.isGooglePlayServicesAvailable(this);

	if (resultCode != ConnectionResult.SUCCESS) {
		Toast.makeText(this, R.string.noGooglePlayServices,
				Toast.LENGTH_LONG).show();

		// Do not call super i.e. do not call onHandleIntent
		return IntentService.START_NOT_STICKY;
	}

	locationClient = new LocationClient(this, this, this);
	locationClient.connect();

	if (!openOutputFile()) {
		// Do not call super i.e. do not call onHandleIntent
		return IntentService.START_NOT_STICKY;
	}

	JourneyPreferences.registerOnSharedPreferenceChangeListener(this, this);
	setForegroundNotification();

	return super.onStartCommand(intent, flags, startId);
}
 
开发者ID:t-animal,项目名称:JourneyApp,代码行数:35,代码来源:LocationService.java

示例7: GeofenceActivityHelper

import android.app.IntentService; //导入依赖的package包/类
public GeofenceActivityHelper(Activity activity, List<Geofence> geofences, Class<? extends IntentService> intentService, @InitialTrigger int initialTrigger) {
    super(activity, geofences, intentService, initialTrigger);
    this.activity = activity;
    update();
}
 
开发者ID:heinrichreimer,项目名称:android-wg-planer,代码行数:6,代码来源:GeofenceActivityHelper.java

示例8: GeofenceHelper

import android.app.IntentService; //导入依赖的package包/类
public GeofenceHelper(Context context, List<Geofence> geofences, Class<? extends IntentService> intentService, @InitialTrigger int initialTrigger) {
    super(context);
    mGeofences = new ArrayList<>(geofences);
    mIntentService = intentService;
    mInitialTrigger = initialTrigger;
}
 
开发者ID:heinrichreimer,项目名称:android-wg-planer,代码行数:7,代码来源:GeofenceHelper.java

示例9: IntentServiceInjector

import android.app.IntentService; //导入依赖的package包/类
public IntentServiceInjector(IntentService object, Object... possibleParents) {
    super(object, possibleParents);
}
 
开发者ID:freefair,项目名称:android-injection,代码行数:4,代码来源:IntentServiceInjector.java

示例10: setIntentRedelivery

import android.app.IntentService; //导入依赖的package包/类
@Implementation
public void setIntentRedelivery(boolean enabled) {
  mRedelivery = enabled;
  directlyOn(realIntentService, IntentService.class, "setIntentRedelivery", boolean.class)
      .invoke(enabled);
}
 
开发者ID:qx,项目名称:FullRobolectricTestSample,代码行数:7,代码来源:ShadowIntentService.java

示例11: shadowOf

import android.app.IntentService; //导入依赖的package包/类
public static ShadowIntentService shadowOf(IntentService instance) {
  return (ShadowIntentService) shadowOf_(instance);
}
 
开发者ID:qx,项目名称:FullRobolectricTestSample,代码行数:4,代码来源:Robolectric.java


注:本文中的android.app.IntentService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。