80,360
社区成员
发帖
与我相关
我的任务
分享
Intent startIntent = new Intent();
ComponentName componentName = new ComponentName("com.example.batservice", "com.example.batservice.WorkingService1");
startIntent.setComponent(componentName);
startForegroundService(startIntent);
<service
android:name="com.example.batservice.WorkingService1"
android:exported="true"
android:enabled="true"
android:process=":remote1"
>
<intent-filter>
<action android:name="com.example.batservice.WorkingService1" />
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</service>
Intent startIntent = new Intent();
ComponentName componentName = new ComponentName("com.example.batservice", "com.example.batservice.WorkingService1");
startIntent.setComponent(componentName);
startForegroundService(startIntent);
boolean bSec = getApplicationContext().bindService(startIntent, null, BIND_AUTO_CREATE);