Reputation: 345
I am developing an android application that displays some of the device's preferences such as if it connected to wifi, mobile data, and also the ring mode type: silent, vibrate, and normal.
I am having difficulties in getting the ring mode type for android L because for the priority and sound types, the type is given as normal.
Does anyone have a possible solution for this, on non rooted devices?
Upvotes: 3
Views: 890
Reputation: 345
I have found a solution to my problem, however, it works only on API level 17 and above.
I am getting the value from the Global zen mode preference as follows:
Settings.Global.getInt(getContentResolver(), "zen_mode")
If the value returned is 2 then the device is on silent, if it is 1, then the ringer mode is set on priority, if it is 0, then the ringer mode is set to sound.
Hope it helps some other developers.
Upvotes: 2