damonkohler / sl4a

SL4A brings scripting languages to Android by allowing you to edit and execute scripts and interactive interpreters directly on the Android device.
Apache License 2.0
2.43k stars 800 forks source link

toggleAirplaneMode() causes NullPointerException #18

Open damonkohler opened 9 years ago

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:31

What device(s) are you experiencing the problem on?
Nexus 5
What firmware version are you running on the device?
Android 4.4
What steps will reproduce the problem?
1. Run the following script (with python interpreter):

#!/usr/bin/python

import android
droid = android.Android()

# go to airplane mode

droid.toggleAirplaneMode()

droid.makeToast('exiting')

What is the expected output? What do you see instead?
The phone should toggle the state of airplane mode. Instead the airplane mode 
command returns: Result(id=2, result=None, 
error=u'java.lang.NullPointerException')

What version of the product are you using? On what operating system?
SL4Ar6
python interpreter v 16

Logcat has the following line:
W/ActivityManager(  757): Permission Denial: not allowed to send broadcast 
android.intent.action.AIRPLANE_MODE from pid=28873, uid=10096

Original issue reported on code.google.com by nicolas....@gmail.com on 14 Nov 2013 at 6:52

Attachments:

Copied from original issue: damonkohler/android-scripting#700

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:31

apparently the location of the airplane mode setting has moved from 
Settings.System to Settings.Global in API 17.

http://developer.android.com/reference/android/provider/Settings.System.html#AIR
PLANE_MODE_ON

Original comment by nicolas....@gmail.com on 15 Nov 2013 at 9:47

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:31

apparently Android 4.2 has disabled write access to airplane mode from apps. 
Why?

http://developer.android.com/about/versions/android-4.2.html

Original comment by nicolas....@gmail.com on 15 Nov 2013 at 9:54

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:31

related stackoverflow:

http://stackoverflow.com/questions/13766909/how-to-programmatically-enable-and-d
isable-flight-mode-on-android-4-2

Original comment by nicolas....@gmail.com on 15 Nov 2013 at 9:56