0

I want to run my android app only on tablet , but it's running in phone also.

My Manifest file

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.example.sample">

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

    <uses-feature
        android:name="android.hardware.screen.landscape"
        android:required="true" />

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

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme1"
        tools:ignore="GoogleAppIndexingWarning">
        <activity
            android:name=".MainActivity"
            android:screenOrientation="landscape">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>

</manifest>

Can we run the app in generic phones when we apply android:normalScreens="false" & android:smallScreens="false" in supports-screens tag in android manifest file

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Pavithra
  • 31
  • 1
  • 5
  • 1
    [This](https://stackoverflow.com/questions/7649558/android-manifest-restrict-to-tablets) might help.. – ADM Nov 22 '19 at 12:17
  • Thanks ADM. I tried this. I applied android:xlargeScreens="true" & android:requiresSmallestWidthDp="600" in the manifest . Still I run the app in generic phone, it's executed. Can't we stop the app from running on generic mobile?? – Pavithra Nov 22 '19 at 12:34
  • I think this is acceptable .. the restrictions will be avail when you publish your app on store .. generally you can install an apk but when you publish it with restrictions it will not show on store for normal devices . That's a theory I am not sure about it . – ADM Nov 22 '19 at 12:37

1 Answers1

1

You can do this:
In your first activity use this and get the size of the screen
If the size is not a tablet size, make a alert that say this app is only to tablet, then show a white screen/ another thing

Yann ganem
  • 43
  • 7