For some of my app's functions the WRITE_SETTINGS permission is needed. It is requested and retrieved fine on all Android phones and tablets that I have tested on, but on Android TV it never shows any activity where the user can grant the permission. I'm also aware that it's optional for manufacturers to include any activity for Settings.ACTION_MANAGE_WRITE_SETTINGS which is "android.settings.action.MANAGE_WRITE_SETTINGS". Does it mean that there is no way to programmatically ask to get the needed write settings permission on those Android TV devices? I have tried to manually go to Android settings and find the permission to grant it but have not found any settings page where it can be done (and I would prefer to not have to tell users to manually find the setting). Before API23 this was not a problem because the write permission could be aquired from the manifest. Have tested on a new Android TV model, and on an old one which was slightly above M level with same results.
//Using this code to check if app has write settings permission
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M &&
!Settings.System.canWrite(getApplicationContext())) {
//Then using this code to ask the user for the write settings permission
Intent intent = new Intent(Settings.ACTION_MANAGE_WRITE_SETTINGS);
// This line specifies to get a specific write settings activity for my app. If skipping this line a list of write settings allowed apps appears instead of the specific activity.
intent.setData(Uri.parse("package:" + getApplicationContext().getPackageName()));
startActivityForResult(intent, 0);
I have tried to create the intent without setting data on it, which means I would have gotten a list of apps that allowed to write settings. Did not work on Android TV either.
I have also tried to run the startActivity method instead of startActivityForResult. Did not work on Android TV either.