本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
示例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();
}
示例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;
}
示例9: IntentServiceInjector
import android.app.IntentService; //导入依赖的package包/类
public IntentServiceInjector(IntentService object, Object... possibleParents) {
super(object, possibleParents);
}
示例10: setIntentRedelivery
import android.app.IntentService; //导入依赖的package包/类
@Implementation
public void setIntentRedelivery(boolean enabled) {
mRedelivery = enabled;
directlyOn(realIntentService, IntentService.class, "setIntentRedelivery", boolean.class)
.invoke(enabled);
}
示例11: shadowOf
import android.app.IntentService; //导入依赖的package包/类
public static ShadowIntentService shadowOf(IntentService instance) {
return (ShadowIntentService) shadowOf_(instance);
}