Will this app appear on the Play Store?

I have heard in many places that if my application uses a resolution that is not applicable to a specific device, it will not appear in the playback store for that device. Now, in my code, I play audio. I will mute this sound when there is a phone call by doing this:

 private PhoneStateListener phoneStateListener = new PhoneStateListener() {
        @Override
        public void onCallStateChanged(int state, String incomingNumber) {
                if (state == TelephonyManager.CALL_STATE_RINGING) {
                    onPhoneCallInterrupt(); //Method I made that mutes audio for phone call
                } else if (state == TelephonyManager.CALL_STATE_IDLE) {
                } else if (state == TelephonyManager.CALL_STATE_OFFHOOK) {
                    onPhoneCallInterrupt(); //Method I made that mutes audio for phone call
                }
        }
    };

The manifest now uses the following permission:

<uses-feature android:name="android.permission.READ_PHONE_STATE"  android:required="false" />

Will I get exceptions because I made the resolution optional by running android:required = "false"on devices that do not support phone compatibility (tablets)?

The reason I am so confused about this is because I am checking if the phone is being used, but I am not using it. So, will my application work on tablets, not to mention the appearance in the store for them?

, ,

Ruchir

+4
1

READ_PHONE_STATE

<uses-feature android:name="android.hardware.telephony" />

,

<uses-feature android:name="android.hardware.telephony"
        android:required="false" />

, , , , .

,

static public boolean hasTelephony()
{
    TelephonyManager tm = (TelephonyManager) Hub.MainContext.getSystemService(Context.TELEPHONY_SERVICE);
    if (tm == null)
        return false;

    //devices below are phones only
    if (Utils.getSDKVersion() < 5)
        return true;

    PackageManager pm = MainContext.getPackageManager();

    if (pm == null)
        return false;

    boolean retval = false;
    try
    {
        Class<?> [] parameters = new Class[1];
        parameters[0] = String.class;
        Method method = pm.getClass().getMethod("hasSystemFeature", parameters);
        Object [] parm = new Object[1];
        parm[0] = "android.hardware.telephony";
        Object retValue = method.invoke(pm, parm);
        if (retValue instanceof Boolean)
            retval = ((Boolean) retValue).booleanValue();
        else
            retval = false;
    }
    catch (Exception e)
    {
        retval = false;
    }

    return retval;
}

http://commonsware.com/blog/2011/02/25/xoom-permissions-android-market.html

-2

Source: https://habr.com/ru/post/1619489/


All Articles