我有一项服务正在运行以获取GPS位置。 当我强行完全杀死应用程序时,我的服务工作在所有其他设备上,但在联想手机中,它也杀死了服务。
服务
<service
android:name="com.LogngRunningService"
android:enabled="true"
android:exported="true" />
LogngRunningService
public class LogngRunningService extends Service {
Context context;
@Override
public void onCreate() {
context = this;
super.onCreate();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
setRepeatingTask();//here i am calling method to get GPS location
return START_STICKY;
}
@Override
public boolean onUnbind(Intent intent) {
return super.onUnbind(intent);
}
@Override
public void onRebind(Intent intent) {
super.onRebind(intent);
}
@Override
public void onTaskRemoved(Intent rootIntent) {
super.onTaskRemoved(rootIntent);
}
@Override
public void onTrimMemory(int level) {
super.onTrimMemory(level);
}
@Override
public void onLowMemory() {
super.onLowMemory();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
@Override
public void onDestroy() {
super.onDestroy();
}
@Override
public void onStart(Intent intent, int startId) {
super.onStart(intent, startId);
}
public LogngRunningService() {
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
}
有人可以帮我解决这个问题吗