天天看点

有些人无法在Google Play上找到我的应用,怎么办?

在Google Play上发布过应用的开发者也许都遇到过这种情况。用户抱怨说,用平板电脑在Google Play上找不到你的应用,但是用手机上(或者其它的设备)就可以找到。经过数小时苦苦寻一个合理的解释,最后还是放弃了。

有些人无法在Google Play上找到我的应用,怎么办?

对,我们必须学会处理这个问题,终于,我找到了答案。

在应用中我们需要获得一些权限,需要在清单文件中注册。但是,注册了这些权限并不意味着你一定会在应用中使用它们。比如,你的应用可能用到GPS功能或者摄像头功能,但是有没有这个功能并不会阻碍用户使用你的应用。只需要在代码中简单地加上一条判断语句就可以了,例如下面的代码:

/** Check if this device has a camera */

private boolean checkCameraHardware(Context context)

{

    if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA))

    {

        // this device has a camera

        return true;

    }

    else

        // no camera on this device

        return false;

}

然后,在AndroidManifest.xml文件中添加一句话:

<uses-permission android:name="android.permission.CAMERA" />

但是也可能出现其它的情况,你要求的权限可能会影响Google Play的过滤规则。如果你要求一些硬件相关的权限,比如摄像头,Google Play会认定你的应用需要这个基本的硬件功能,没有这个功能的设备就会过滤掉你的应用。

如果你想知道是什么权限导致Google Play过滤了你的应用,请看看下面这篇文章:

http://developer.android.com/guide/topics/manifest/uses-feature-element.html#permissions-features http://developer.android.com/guide/topics/manifest/uses-feature-element.htmlX

7Xpermissions-features

如果你想想自己把握是否过滤,那你最好明确指定需要的硬件特性,使用

<uses-feature>

来声明,这样比让Google Play自己去发现你的应用权限好得多。

<uses-feature

    android:name="android.hardware.camera"

    android:required="false"/>

    android:name="android.hardware.camera.autofocus"

最后在Google Play上更新你的应用,问题就解决了。

继续阅读