Permission by adb

Post your questions and help other users.

Moderator: Martin

Post Reply
TraianC
Posts: 66
Joined: 24 Oct 2014 13:29

Permission by adb

Post by TraianC » 01 Oct 2016 12:40

Hi Martin,

I've updated to version 1.32 and I've granted Automagic permission by adb. I didn't got any error during this process.
Then I tried to use Set System Setting to set airplane mode on (Category: Global, name: airplane_mode_on, value: 1).
Unfortunately I get the following message: Failed to change setting Global 'airplane_mode_on' from '0' to '1'.
I have a Samsung Galaxy S4 with Android 4.3, not rooted.

Please tell me what could be the problem.

Best regards,
Traian

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

Re: Permission by adb

Post by Martin » 01 Oct 2016 13:04

Hi Traian,

What version of Android are you using and what device model? Are you using a custom ROM?

Regards,
Martin

TraianC
Posts: 66
Joined: 24 Oct 2014 13:29

Re: Permission by adb

Post by TraianC » 01 Oct 2016 13:14

Hi Martin,

I don't use custom ROM.
The phone model is GT-I9502 and the Android version is 4.3.

Best regards,
Traian

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

Re: Permission by adb

Post by Martin » 01 Oct 2016 13:40

OK, found the problem. I've implemented this feature only for Android 4.4+. I think the same mechanism also works on older versions of Android so I'll release an update with a fix for this problem soon.
Thanks for reporting!

Regards,
Martin

TraianC
Posts: 66
Joined: 24 Oct 2014 13:29

Re: Permission by adb

Post by TraianC » 02 Oct 2016 15:04

Hi Martin,

I've updated Automagic to 2nd October version.

Now if I try to change airplane_mode_on to 1 I don't get any error, but nothing happens. The phone doesn't switch to airplane mode.
If I check airplane_mode_on the value is set correctly to 1.
If I restart the phone then airplane mode is activated.
I other words, in order to switch the phone to airplane mode I have to set the value of airplane_mode_on to 1 and then to restart the phone.

Do you have any idea how to do this without restarting the phone?


Best regards,
Traian

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

Re: Permission by adb

Post by Martin » 02 Oct 2016 16:12

Hi,

Airplane mode can not be toggled just by changing the system settings value. The system just uses this value to remember the setting across reboots. It might also change some elements in the settings user interface but it does not actually do anything when toggled.
You still have to send a broadcast to notify the system that the airplane mode was changed.
Action: android.intent.action.AIRPLANE_MODE
Extras: putBoolean("state", true); //or false when turning off

At some point Android did not allow apps to send this broadcast anymore, however I can't recall if this is already the case on Android 4.3. It might be worth a try.

Regards,
Martin

TraianC
Posts: 66
Joined: 24 Oct 2014 13:29

Re: Permission by adb

Post by TraianC » 02 Oct 2016 18:45

Hi Martin,

Thank you for your prompt answer.

I tried broadcast and it doesn't work. I get permission denial.

Please let me know if you think of any other way (except root).


Best regards,
Traian

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

Re: Permission by adb

Post by Martin » 02 Oct 2016 19:33

I'm running out of ideas :-)

You could resort to action Control UI to enable airplane mode. You could open the settings page containing the airplane mode toggle button and then click the button. Some devices also have a quick-settings toggle button that can be clicked.
Following script shows how it might work but most likely needs to be adjusted for your device:

Code: Select all

quickSettings();
sleep(1000);
click("Airplane*");
Regards,
Martin

TraianC
Posts: 66
Joined: 24 Oct 2014 13:29

Re: Permission by adb

Post by TraianC » 02 Oct 2016 20:12

Hi Martin,

I already tried this. It works only when the phone is unlocked.
I'm looking for a way to turn on/off Airplane mode without unlocking the phone. It seems that rooting is the only way, which unfortunately for me is not an option.


Best regards,
Traian

Post Reply