當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。