onTaskRemoved of a Android Service is never being called ! Why?

前端 未结 1 1797
孤城傲影
孤城傲影 2021-02-06 03:47

I am stuck with a issue from last 2 days, I want to hit a api and show user a Toast when user swipe off the app from Background Task,

相关标签:
1条回答
  • 2021-02-06 04:26

    Try this one

    <service
                android:name=".MyService"
                android:enabled="true"
                android:stopWithTask="false" />
    

    Just replace Service.START_STICKY; to START_STICKY;

    And you will able to call onTaskRemoved(Intent rootIntent) once app removed/clear from recent app list.

    0 讨论(0)
提交回复
热议问题