How to stop my service?

前端 未结 3 1556
挽巷
挽巷 2021-01-15 22:40

Please also see Edit 2 (below)

I have extended NotificationListenerService and implemented several of its methods including the onDestroy()

3条回答
  •  一生所求
    2021-01-15 22:53

    Try overrides onStartCommand() in your Service with START_NOT_STICKY flag:

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        super.onStartCommand(intent, flags, startId);
        return START_NOT_STICKY;
    }
    

提交回复
热议问题