将这个应用程序显示在Play商店? [英] Will this app show up in the Play Store?
问题描述
我听说在很多地方,如果我的应用程序使用并不适用于某一设备的许可,也不会在剧中店该设备显示出来。现在,在我的code,我播放音频。我静音音频每当有是这样一个电话:
I have heard in many places that if my app uses a permission not applicable to a certain device, it will not show up in the play store for that device. Now, in my code, I am playing audio. I mute that audio whenever 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
}
}
};
现在,这里采用以下权限在清单:
Now, this uses the following permission in the manifest:
<uses-feature android:name="android.permission.READ_PHONE_STATE" android:required="false" />
我会得到什么异常,因为我已经做作出的许可可选的的android:要求=假
在没有手机的兼容性(片)设备?
Will I get any exceptions because I have made the permission optional by doing android:required = "false"
on devices that don't have phone compatibility (tablets)?
我对这个如此混乱的原因,是因为我检查是否正在使用的手机,但我不使用它。所以,我会在平板电脑上的应用程序的工作,更何况是在Play商店露面呢?
The reason I am so confused on this, is because I am checking if the phone is being used, but I am not using it. So, will my app work on tablets, let alone show up in the play store for them?
谢谢你帮我清理这种混乱,
Thanks for helping me clear up this confusion,
Ruchir
推荐答案
您必须使用这种方式
当您的许可READ_PHONE_STATE要求
You have to use this way As your permission READ_PHONE_STATE request the
<uses-feature android:name="android.hardware.telephony" />
所以,你需要使用这个
So you need to use this
<uses-feature android:name="android.hardware.telephony"
android:required="false" />
所以Play商店不会筛选片剂的应用
但要确保你所要做的手动检查,你正在使用的设备是手机或平板电脑电话的功能,并有一个电话aceess与否
So play store wont filter your apps for the tablets but make sure you have to do check manually where you are using the functionality of the telephony that device is phone or tablets and have a telephony aceess or not
要检查电话接入设备已经或无法使用此检查此code
To check the telephony access device has or not use this check this code
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
这篇关于将这个应用程序显示在Play商店?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!