Execute code when user changes to silent mode in Android

后端 未结 3 1217
离开以前
离开以前 2021-01-29 03:15

I\'m using a service. In that service my code should get executed when the user changes to silent mode, i.e. as soon as the user changes to silent mode, my code needs to get exe

3条回答
  •  南方客
    南方客 (楼主)
    2021-01-29 03:42

    You don't want use a service. Instead you want to use a BroadcastReciever that filters for the android.media.RINGER_MODE_CHANGED Intent.

    You might want to take a look at this project as it deals with the phone being silenced. It probably has some source code that will be useful to you.

提交回复
热议问题