How resolve the android security Manual question (>API23)

F Frederic Neuberg 3 years 6 months ago
4 0 0

How resolve the android security Manual question.  (How To Grant Write Settings Permission In Android without manual user intervention.)

Objectif : control the brightness for never turn off the display. The device can stay without movement during 60 minutes, but the next scan must be directly, without use power on button.

The standard java google code use  android.provider.Settings.System.

Ex :

public boolean ScreenBrightness(int level, Context context) { try { //On impose le niveau android.provider.Settings.System.putInt(  context.getContentResolver(),  android.provider.Settings.System.SCREEN_BRIGHTNESS, level); // Définition du mode (Manuel) android.provider.Settings.System.putInt(context.getContentResolver(),  android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE,  android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL); // On impose le niveau android.provider.Settings.System.putInt(  context.getContentResolver(),  android.provider.Settings.System.SCREEN_BRIGHTNESS,  level); return true; } catch (Exception e) { Log.e("Screen Brightness", "Erreur dans le traitement de la brillance"); return false; } }

But, after API 23 I must ask dynamically from the user if they have the WRITE_SETTINGS. Or find another solution to manage the brightness.

Ex Intent i = new Intent(SelectedView.getContext(), WriteSettingsPermissionActivity.class);startActivity(i);
I’ll deploy 60 devices, I would like deploy without human intervention if it’s possible.

Zebra :
Device : TC51 - NoGMS
OS : Adroid 7.1.2

MX 7.1
addon-symbol_emdk-symbol-23

Android Studio
CompileSdkVersion 25
minSdkVersion 25
targetSdkVersion 25

Info in AndroidManifest :
       

In advance, thanks for your help.

CONTACT
Can’t find what you’re looking for?