本文整理了Java中android.app.Application.startService()
方法的一些代码示例,展示了Application.startService()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Application.startService()
方法的具体详情如下:
包路径:android.app.Application
类名称:Application
方法名:startService
暂无
代码示例来源:origin: robolectric/robolectric
@Test
public void shouldClearStartedServiceIntents() {
context.startService(getSomeActionIntent("some.action"));
context.startService(getSomeActionIntent("another.action"));
shadowOf(context).clearStartedServices();
assertNull(shadowOf(context).getNextStartedService());
}
代码示例来源:origin: typ0520/fastdex
public void initialize(FastdexApplication fastdexApplication, Application realApplication) {
this.applicationContext = fastdexApplication.getApplicationContext();
fastdexDirectory = SharePatchFileUtil.getFastdexDirectory(applicationContext);
patchDirectory = SharePatchFileUtil.getPatchDirectory(applicationContext);
tempDirectory = SharePatchFileUtil.getPatchTempDirectory(applicationContext);
MonkeyPatcher.monkeyPatchApplication(getApplicationContext(),fastdexApplication,realApplication);
if (Utils.isMainProcess(applicationContext)) {
RuntimeMetaInfo metaInfo = loadRuntimeMetaInfo();
preparePatch(metaInfo);
loadPatch(fastdexApplication,metaInfo);
Restarter.initialize(realApplication);
Thread.setDefaultUncaughtExceptionHandler(new FastdexUncaughtExceptionHandler(getApplicationContext()));
registerFastdexReceiver(realApplication);
realApplication.startService(new Intent(realApplication, FastdexService.class));
}
}
代码示例来源:origin: roomanl/AndroidDownload
@Override
public ComponentName startService(Intent service) {
return app.startService(service);
}
代码示例来源:origin: AlexZhuo/AlxLocationManager
@Override
public void run() {
Log.i("AlexLocation","location task 执行"+"manager是"+manager+" destroy是"+AlxLocationService.isDestory);
if(manager==null || !AlxLocationService.isDestory)return;//如果之前被destroy了,就重开一个
manager.context.startService(new Intent(manager.context, AlxLocationService.class));//使用安卓原生API获取地理位置
}
}
代码示例来源:origin: MegatronKing/NetBare
/**
* Stop the NetBare service. If the service is started,
* {@link NetBareListener#onServiceStopped()} will be invoked.
*/
public void stop() {
Intent intent = new Intent(NetBareService.ACTION_STOP);
intent.setPackage(mApp.getPackageName());
mApp.startService(intent);
}
代码示例来源:origin: AlexZhuo/AlxLocationManager
Log.i("AlexLocation","该手机没有安装谷歌框架服务,使用Android原生获取吧");
Toast.makeText(manager.context,"警告:你没有安装谷歌服务框架,请root后安装",Toast.LENGTH_LONG).show();
context.startService(new Intent(manager.context, AlxLocationService.class));
if(manager.locationTimer==null)manager.locationTimer = new Timer();
try {
代码示例来源:origin: suraj0208/WhatsappExtensions
AndroidAppHelper.currentApplication().startForegroundService(intent);
} else {
AndroidAppHelper.currentApplication().startService(intent);
代码示例来源:origin: suraj0208/WhatsappExtensions
AndroidAppHelper.currentApplication().startForegroundService(intent);
} else {
AndroidAppHelper.currentApplication().startService(intent);
AndroidAppHelper.currentApplication().startForegroundService(intent);
} else {
AndroidAppHelper.currentApplication().startService(intent);
AndroidAppHelper.currentApplication().startForegroundService(intent);
} else {
AndroidAppHelper.currentApplication().startService(intent);
AndroidAppHelper.currentApplication().startForegroundService(intent);
} else {
AndroidAppHelper.currentApplication().startService(intent);
AndroidAppHelper.currentApplication().startForegroundService(intent);
} else {
AndroidAppHelper.currentApplication().startService(intent);
AndroidAppHelper.currentApplication().startForegroundService(intent);
} else {
AndroidAppHelper.currentApplication().startService(intent);
代码示例来源:origin: mizutori/AndroidLocationStarterKit
this.getApplication().startService(locationService);
this.getApplication().bindService(locationService, serviceConnection, Context.BIND_AUTO_CREATE);
内容来源于网络,如有侵权,请联系作者删除!