Android: Disable to install app on tablets

前端 未结 2 777
灰色年华
灰色年华 2020-12-11 03:51

I\'m working on app that should be installed only on phones and not tablets.

I want to ask, how can I restrict to install only on phones?

I was reading this

相关标签:
2条回答
  • 2020-12-11 04:22

    To install app if we are using adb install command , it's not possible to restict app installation only to tablets or phones. Also if we give tag in menifest it's only applicable for the Google Play store filter, to check this you can try following code, put it into your menifest and try to install it in 7 inch tablet, it will allow,

    <supports-screens
            android:largeScreens="false"
            android:largestWidthLimitDp="600"
            android:normalScreens="true"
            android:smallScreens="true"
            android:xlargeScreens="false" />
    

    By using this code Google play store filters and restrict while installing only, but not in other cases as sharing apk, or installing in emulator.

    So, to restrict the app installation to certain device when you upload APK at market , you need to do this Applications->select your application->APK-> Supported devices | Excluded devices

    0 讨论(0)
  • 2020-12-11 04:25

    Just follow the doc Declaring an App is Only for Handsets and do not use the example from the accepted answer because of: (from FilteringTabletApps)

    Caution: If you use the element for the reverse scenario (when your application is not compatible with larger screens) and set the larger screen size attributes to "false", then external services such as Google Play do not apply filtering. Your application will still be available to larger screens, but when it runs, it will not resize to fit the screen. Instead, the system will emulate a handset screen size (about 320dp x 480dp; see Screen Compatibility Mode for more information). If you want to prevent your application from being downloaded on larger screens, use , as discussed in the previous section about Declaring an App is Only for Handsets.

    0 讨论(0)
提交回复
热议问题