How to use Settings actions?

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
Bluscre
Posts: 145
Joined: 31 Aug 2017 13:58
Location: Germany
Contact:

How to use Settings actions?

Post by Bluscre » 09 Sep 2017 13:23

I wonder how do i use stuff like https://stackoverflow.com/a/29739374
Do i have to use "Start Activity" or "Start Service" and what kind of syntax does it need?

Code: Select all

Settings.ACTION_ACCESSIBILITY_SETTINGS
doesn't work with either of these :(

Also trial 'n error'd some code

Code: Select all

settings = callJavaConstructor("android.provider.Settings", "Settings()");
ACTION_ACCESSIBILITY_SETTINGS = getJavaStaticField("android.provider.Settings", "ACTION_ACCESSIBILITY_SETTINGS");
//callJavaConstructor("android.content.Intent", "Intent(java.lang.Class)", ACTION_ACCESSIBILITY_SETTINGS);
intent = callJavaConstructor("android.content.Intent", "Intent()");
context = getContext();
callJavaMethod(intent, "android.content.Intent", "setClass(android.content.Context, java.lang.Class)", context, ACTION_ACCESSIBILITY_SETTINGS);
No success either ://
Unofficial AutoMagic Telegram Group: https://t.me/automagicforandroid
Check out my other flows here: https://github.com/Bluscream/AutoMagicFlows or here.

User avatar
Bluscre
Posts: 145
Joined: 31 Aug 2017 13:58
Location: Germany
Contact:

Re: How to use Settings actions?

Post by Bluscre » 09 Sep 2017 14:01

Finally i got it to work with

Code: Select all

context = getContext();
//settings = callJavaConstructor("android.provider.Settings", "Settings()");
ACTION_ACCESSIBILITY_SETTINGS = getJavaStaticField("android.provider.Settings", "ACTION_ACCESSIBILITY_SETTINGS");
//intent = callJavaConstructor("android.content.Intent", "Intent()");
intent = callJavaConstructor("android.content.Intent", "Intent(java.lang.String)", ACTION_ACCESSIBILITY_SETTINGS);
//FLAG_ACTIVITY_NEW_TASK = 
//callJavaMethod(intent, "android.content.Intent", "setAction(java.lang.String)", ACTION_ACCESSIBILITY_SETTINGS)
callJavaMethod(intent, "android.content.Intent", "addFlags(int)",  268435456);
callJavaMethod(context, "android.content.Context", "startActivity(android.content.Intent)", intent);
Unofficial AutoMagic Telegram Group: https://t.me/automagicforandroid
Check out my other flows here: https://github.com/Bluscream/AutoMagicFlows or here.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: How to use Settings actions?

Post by Martin » 09 Sep 2017 15:16

You could use action Launch Shortcut and build a settings shortcut. Probably not all screens are available using this method.
You can also use action Start Activity, check Explicit Component and select the com.android.settings and the suitable class in the second field.

Regards,
Martin

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: How to use Settings actions?

Post by Desmanto » 09 Sep 2017 16:18

I usually use Launch App.
Package Name : com.android.settings
Class Name : com.android.settings.Settings$AccessibilitySettingsActivity

Try to execute it and it should land you directly on Accessibility. This feature is exactly like Autoshortcut.
(Other automation app after several years, still can't do this without autoshortcut plugin. :D Even such a simple feature, can't be integrated into the main app.)

To test the activity, I usually use quickshortcutmaker first. In automagic, if I need to find the correct class name, I have to select, try to execute it first. If wrong, I have rescroll back down so far to test the next class name (or tap search icon again). In quickshortcutmaker, the try button can be cancel and we are back at the list and can proceed to try the next class name.

This is also why I created the windows recognizer flow, to check the class name of the activity, so I can make a shortcut directly to it.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Post Reply