Add wake lock to receiver
Этот коммит содержится в:
@@ -15,13 +15,13 @@
|
||||
*/
|
||||
package org.traccar.client;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.content.WakefulBroadcastReceiver;
|
||||
|
||||
public class AutostartReceiver extends BroadcastReceiver {
|
||||
public class AutostartReceiver extends WakefulBroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
|
||||
@@ -51,9 +51,16 @@ public class TrackingService extends Service {
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void onStart(Intent intent, int startId) {
|
||||
AutostartReceiver.completeWakefulIntent(intent);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.ECLAIR)
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
onStart(intent, startId);
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user