백그라운드 서비스를 개발 중이며 OnDestroy Method에서 서비스를 다시 시작할 인 텐트를 호출했습니다. miui rom (Xiaomi mobile 및 huawei mobile)에서 다시 시작하지 않습니다.miui rome에서 백그라운드 서비스가 중지되었습니다.
어떻게 처리합니까? 매니페스트에
public class NotificationsService extends Service {
@Override
public void onCreate() {
ApplicationLoader.postInitApplication();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
return START_STICKY;
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
public void onDestroy() {
Intent intent = new Intent("example.app.start");
sendBroadcast(intent);
}
}
:
<receiver android:name=".AppStartReceiver" android:enabled="true">
<intent-filter>
<action android:name="example.app.start" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
당신이 방송 수신기 코드를 게시나요? – W4R10CK
@ W4R10CK 아직 없기 때문에 stackoverflow 메시지 : 한 번만 90 분마다 게시 할 수 있습니다. :/ –
@ W4R10CK http://stackoverflow.com/questions/41918691/sending-broadcast-to-restart-service-to-keep-alive-not-working-currectly –