에서
덕분에 당신은 당신의 브로드 캐스트 리시버에서 IntentService를 시작하고 있었다 당신이 원하는 무엇이든 거기에서에서.
public class UpdateReceiver extends BroadcastReceiver {
private static Context mContext;
@Override
public void onReceive(Context context, Intent intent) {
mContext = context;
context.startService(new Intent(context, UpdateService.class));
}
public static class UpdateService extends IntentService {
public UpdateService() {
super("UpdateService");
}
@Override
protected void onHandleIntent(Intent intent) {
// Do whatever you want from here
Logic.doSomething(mContext);
}
}
}
서비스를 매니페스트에 추가하십시오.
<service android:name="com.example.UpdateReceiver$UpdateService" />
귀하의 코드는 오류 다음 부여합니다은/ActivityManager을 WARN (65) : 서비스의 의도를 시작할 수 없습니다 {CMP = com.example/.UpdateReceiver $ UpdateService} : 찾을 수 없음 – Adhi
당신은 매니페스트에 서비스를 추가해야합니다. 내 대답을 업데이트했습니다. – rochdev