Android Serivce kills itself

Start a service to complete a time-consuming task, such as reading the database report. After the task is completed, it needs to be closed by itself.
The closing method inside Serivce:

method one

        Log.d(TAG, "stopService");
        Intent bindIntent = new Intent(this, MyService.class);
        stopService(bindIntent);

way two

        Log.d(TAG, "stopSelf");
        stopSelf();

Guess you like

Origin blog.csdn.net/ly_xiamu/article/details/117294711