Go to "modify system settings" of our app with one click.


(BeeriaApps) #1

For android 6 and above, if you want to perform some actions, for example set sound as ringtone, it’s not possible until user manually grants write permission for an app.
The problem is, this option is very hard to find for non-experienced android user. Accessing this option from application level is a must if it (app) needs such permission.

Original threads:

Makeroid forum -->


Thunkable forum -->

Few days ago found a solution for this problem.
Performed tests:
Android 4 - emulator - not working / there is no such setting. All apps have write permissions already granted.
Android 5 - emulator - the same as above
Android 6 - physical device (LG G4) - OK
Android 6 - emulator - OK
Android 7 - emulator - OK
Android 8 - emulator - OK

SOLUTION
Just use these blocks -->

Activity Class is “com.android.settings.Settings$AppWriteSettingsActivity”
Set Data Uri with package name of your application (“package name” property of Screen 1 - in designer mode).
This won’t work with companion, app must be compiled to apk.

In this example, slider on “modify system settings” screen will be inactive. Because this application doesn’t ask for write permission.

AIA file and compiled APK -->
writepermissionsolution.aia (1,9 KB)
systemsettingstest.apk (4,1 MB)


How to open manage modify system settings for an app with activity starter
Runtime error your app has not granted to permisson write setting
(Daniel) #2

Nice, thanks!


#3

We have too a block for that in screen properties


(BeeriaApps) #4

Mika, you mean call Screen1.Open App Settings?
It works differently.


#5

Yeah.
Then we can add maybe the correct block for that


(BeeriaApps) #6

New block would be nice, but I think even better would be extending block “when Screen1.Error Occured” to handle such situations easily.
Already made a topic on that -->

Regards,
BeeriaApps


(Boban Stojmenovic) #7

Is it possible to implement this?

If the app targets API level 23 or higher, the app user must explicitly grant this permission to the app through a permission management screen. The app requests the user’s approval by sending an intent with action Settings.ACTION_MANAGE_WRITE_SETTINGS. The app can check whether it has this authorization by calling Settings.System.canWrite().

Activity Action android.settings.action.MANAGE_WRITE_SETTINGS
Activity Data Uri package:com.baasapps.ringtone -> package:your.Package.Name

I found something but without coding experience I’m lost.
https://code.i-harness.com/en/q/1e98dd2

/Boban


#8

First block returns true or false.
The second block opens the write settings page of the app.

blocks


(Boban Stojmenovic) #9

W0OW @Mika that was quick implementation… :heart_eyes:

/Boban


#10

The next update should be in the next days.
Bug fix release but the new blocks will be there too for that.


(BeeriaApps) #11

Thanks Mika for new blocks.
Just please assure that block “call Screen1.Are System Write settings Granted” always returns true if API level < 23.

Regards,
BeeriaApps


(BeeriaApps) #12

checked new blocks.

  1. call Screen1.Are System Write Settings Granted
    Android 4 & 5 - always returns true - OK,
    Android 6, 7, 8 - true if granted, false if not granted - OK

  2. call Screen1.Open System Write Settings
    Android 4 & 5 - function “does nothing”, I mean no go to settings screen and no error message - OK
    Android 6, 7, 8 - opens system write settings screen - OK

All works as expected, good job!

Attached aia if someone wants to test (after compiling to apk) -->
checkwritesettings.aia (45,8 KB)


(Muhammad Zahid) #13

Glad to see high responses and a solution at last.:grin: