Lenono vibe k5 5.0 device当我从任务管理器中删除应用程序时服务被杀死了

时间:2017-02-17 10:51:47

标签: android service broadcastreceiver

我有一项服务正在运行以获取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;
    }


}

有人可以帮我解决这个问题吗

0 个答案:

没有答案