yujiaao / android-scripting

Automatically exported from code.google.com/p/android-scripting
0 stars 0 forks source link

toggleAirplaneMode() causes NullPointerException #700

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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:

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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