mit-cml / appinventor-sources

MIT App Inventor Public Open Source
http://appinventor.mit.edu/appinventor-sources/
Apache License 2.0
1.5k stars 2.08k forks source link

READ_PHONE_STATE permission required on Android 5.0 Lollipop #830

Open ewpatton opened 8 years ago

ewpatton commented 8 years ago

Reported on the App Inventor Forum by Jakub Kozłowski:

After installation .apk Send Message (SMS) require READ_PHONE_STATE permission, unfortunately MIT App Inventor 2 is not added this permission to Manifest file ()

When I choosing a Phone Number from PhoneNumberPicker pops Runtime Error...

OS: Android 5.0 Lollipop

On an older OS (Android 4 Jelly Bean) is ok ):

It is bug? Whether it will be corrected in the MIT AI2?

This will not be a problem in the companion because the PhoneCall component uses the READ_PHONE_STATE permissions. However, in packaged applications that lack this component, the permission will be absent.

Running a simple APK with a PhoneNumberPicker and a button that fires off a SMS in both an emulator running Lollipop 5.0.2 and a Samsung Galaxy S4 running Lollipop 5.1.1 does not replicate the problem. It could be specific to the particular OS build, or limited to Lollipop 5.0.

The READ_PHONE_STATE permissions issue was reported on the Android OSP issue tracker (#81758) and is reported as being fixed in Android 6.0, and the testing I've done suggests that it may even be fixed as early as 5.0.2. I've requested the AIA and APK files from Jakub to see if there is something specific about his application that triggers the bug.

Proposed solution 1: Add READ_PHONE_STATE as a permission to the associated components. This is a bit ugly if it's only to support one or two specific Android versions whereas older and newer Android versions do not require this "hack".

Proposed solution 2: Adjust the targetSdk number to something lower than 21 and see if the behavior continues on Lollipop 5.0. This may not be feasible if it breaks any components that require newer SDK features in API level 22 or higher.

Alternatively, if this is only affecting a few people on Android 5.0 who have not updated to at least 5.0.2 then it may not be worth fixing given the scope of the READ_PHONE_STATE permission.

ewpatton commented 7 years ago

This may not just be affecting Android 5 (forum post).

ewpatton commented 6 years ago

Another report