问题
I developed an android app which shows the caller's Telecom Location on Incoming Call.
I uploaded it on Google Play, but this app does not appear on WiFi only devices, it says your device is not compatible .
My Manifest permission details are below.
<uses-permission android:name="android.permission.READ_CALL_LOG"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.WRITE_CONTACTS"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
I doubt about following permissions
<uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
Which particular permissions are creating problem? What is the solution.
Thanks
回答1:
The google play store filters applications based on the permissions they require and the features available in the android device. So, your app will not show up in WiFi only devices because the app requires the CALL_PHONE
permisssion and the MODIFY_STATE_PERMISSION
.
The MODIFY_PHONE_STATE
permission does not allow you to place calls but it implies that telephony is a requirement.
Source : https://developer.android.com/guide/topics/manifest/uses-feature-element.html#permissions
Hence, you should use the <uses-feature>
element instead of the above mentioned permissions.
From Docs : You can disable filtering based on the implied feature by explicitly declaring the implied feature, in a element, with an android:required="false" attribute.
In your case :
<uses-feature android:name="android.hardware.telephony" android:required="false" />
But then you also need to ensure that you do not use any of the telephony related features before actually checking if it's available of not.
In the android app, for SDK >=5 , you should use :
PackageManager pm = this.getPackageManager();
boolean hasTelephony = pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
回答2:
You are correct to suspect the following...
<uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
Certain permissions "imply" the necessity for certain hardware to exist. In other words, permissions relating to the phone require the device to have phone capabilities (obviously).
You can get around this by using the <uses-feature>
element in the AndroidManifest.xml. This allows you to specify if the 'feature' is required or not.
Take a look at the documentation for <uses-feature-element>
In particular the Permissions that Imply Feature Requirements section which explains the requirements related to the <uses-permission>
elements.
EDIT: One more thing - if a feature CAN be used but it's not REQUIRED, it is up to you to check for its availability in your code before attempting to use it otherwise you'll get unpredictable results or possible exceptions / crashes.
来源:https://stackoverflow.com/questions/27956903/my-app-is-not-compatible-on-wifi-only-devices