Dr. Yatish Bathla
Dr. Yatish Bathla

Reputation: 522

Do i need Special permission for Accessing Settings.System Class

I am using Settings.System class and want to display given parameter of my Android device.

AIRPLANE_MODE_ON: null
AIRPLANE_MODE_RADIOS: null
AUTO_TIME: null
FONT_SCALE: null
HAPTIC_FEEDBACK_ENABLED: null
MODE_RINGER: null
MODE_RINGER_STREAMS_AFFECTED: null
MUTE_STREAMS_AFFECTED: null
NOTIFICATION_SOUND: null
RINGTONE: null
SCREEN_BRIGHTNESS: null
SCREEN_BRIGHTNESS_MODE: null
SCREEN_OFF_TIMEOUT: null
STAY_ON_WHILE_PLUGGED_IN: null

It shows every parameter to be null. Below is my part of code:

Log.d("Setting",Settings.Secure.getString(mcontex.getContentResolver(),Settings.System.AIRPLANE_MODE_ON.toString())); 
Log.d("Setting",Settings.Secure.getString(mcontex.getContentResolver(),Settings.System.AIRPLANE_MODE_RADIOS.toString()))

Any Suggestion, Welcome..:)

Upvotes: 0

Views: 251

Answers (1)

Akshay
Akshay

Reputation: 6142

In order to be able to put the device in or out of airplane mode, the application must have WRITE_SETTINGS user permissions. This permission allows an application to read or write the system settings that include airplane mode. To request WRITE_SETTINGS add the element to the Android Manifest file as demonstrated here

Upvotes: 1

Related Questions