How to make an app tablet compatible?

随声附和 提交于 2020-01-24 20:13:45

问题


I would like to make my app tablet compatible, I have read all about it and made sure none of the uses-feature are specific for phones and added supports-screens for all sizes (as you can see in my manifest). But still I see that playstore does not recognize my app as tablet compatible. Please provide me with a step by step instructions to help me solve this problem or a copy of a manifest that is compatible. (I have already looked for some opensource apps and they provide none of these tags but still available on tablet. ex: actionbarsherlock demo)

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.myapp"
    android:versionCode="15"
    android:versionName="1.8" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />

    <!-- USES PERMISSSION -->

    <uses-permission android:name="android.permission.ACCESS_GPS" />
    <uses-permission android:name="android.permission.ACCESS_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_ASSISTED_GPS" />
    <uses-permission android:name="android.permission.ACCESS_CELL_ID" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.RESTART_PACKAGES" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

    <!-- REQUIRED FOR GCM -->
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="android.permission.BROADCAST_STICKY" />

    <permission
        android:name="com.myapp.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.myapp.permission.C2D_MESSAGE" />

    <supports-screens
        android:anyDensity="true"
        android:largeScreens="true"
        android:normalScreens="true"
        android:resizeable="true"
        android:smallScreens="true"
        android:xlargeScreens="true" />

    <application
        android:name=".app.MyApp"
        android:allowBackup="false"
        android:debuggable="false"
        android:icon="@drawable/launcher"
        android:label="@string/app_name"
        android:theme="@style/MainTheme" >

        <!-- USES LIBRARY -->
        <uses-library android:name="com.google.android.maps" />

        <!-- ACTIVITY -->
        <activity
            android:name=".app.activities.Splash"
            android:clearTaskOnLaunch="true"
            android:configChanges="keyboardHidden|orientation"
            android:launchMode="singleTask"
            android:screenOrientation="portrait"
            android:theme="@style/Holo.Theme.Light.DarkActionBar" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <!-- On-boarding -->
        <activity
            android:name=".app.activities.MainWellcome"
            android:configChanges="keyboardHidden|orientation"
            android:screenOrientation="portrait"
            android:theme="@style/Holo.Theme.Light.DarkActionBar" >
        </activity>
        <activity
            android:name=".app.activities.DoxLogin"
            android:configChanges="keyboardHidden|orientation"
            android:parentActivityName=".app.activities.MainWellcome"
            android:screenOrientation="portrait"
            android:theme="@style/Holo.Theme.Light.DarkActionBar" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".app.activities.MainWellcome" />
        </activity>
        <activity
            android:name=".app.activities.GuestRegisterSelectOccupation"
            android:configChanges="keyboardHidden|orientation"
            android:parentActivityName=".app.activities.MainWellcome"
            android:screenOrientation="portrait"
            android:theme="@style/Holo.Theme.Light.DarkActionBar" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".app.activities.MainWellcome" />
        </activity>
        <activity
            android:name=".app.activities.GuestRegister"
            android:configChanges="keyboardHidden|orientation"
            android:parentActivityName=".app.activities.GuestRegisterSelectOccupation"
            android:screenOrientation="portrait"
            android:theme="@style/Holo.Theme.Light.DarkActionBar" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".app.activities.GuestRegisterSelectOccupation" />
        </activity>
        <activity
            android:name=".app.activities.WebViewRegistration"
            android:configChanges="keyboardHidden|orientation"
            android:launchMode="singleTop"
            android:parentActivityName=".app.activities.MainWellcome"
            android:screenOrientation="portrait"
            android:theme="@style/Holo.Theme.Light.DarkActionBar" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".app.activities.MainWellcome" />
        </activity>

        <!-- SETTINGS -->

        <activity
            android:name=".app.activities.Settings"
            android:configChanges="keyboardHidden|orientation"
            android:parentActivityName=".app.activities.AmHome"
            android:screenOrientation="portrait"
            android:theme="@style/Holo.Theme.Light.DarkActionBar" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".app.activities.AmHome" />
        </activity>
        <activity
            android:name=".app.activities.Help"
            android:configChanges="keyboardHidden|orientation"
            android:screenOrientation="portrait"
            android:theme="@style/Holo.Theme.Light.DarkActionBar" >
        </activity>
        <activity
            android:name=".app.activities.ManageAccounts"
            android:configChanges="keyboardHidden|orientation"
            android:screenOrientation="portrait"
            android:theme="@style/Holo.Theme.Light.DarkActionBar"
            android:windowSoftInputMode="adjustResize" >
        </activity>
        <activity
            android:name=".app.activities.EditAccount"
            android:configChanges="keyboardHidden|orientation"
            android:parentActivityName=".app.activities.ManageAccounts"
            android:screenOrientation="portrait"
            android:theme="@style/Holo.Theme.Light.DarkActionBar"
            android:windowSoftInputMode="adjustResize" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".app.activities.ManageAccounts" />
        </activity>
        <!-- Am -->
        <activity
            android:name=".app.activities.AmHome"
            android:configChanges="keyboardHidden|orientation"
            android:screenOrientation="portrait"
            android:theme="@style/Holo.Theme.Light.DarkActionBar"
            android:windowSoftInputMode="adjustResize" >
        </activity>
        <activity
            android:name=".app.activities.AddAccount"
            android:configChanges="keyboardHidden|orientation"
            android:screenOrientation="portrait"
            android:theme="@style/Holo.Theme.Light.DarkActionBar"
            android:windowSoftInputMode="adjustResize" >
        </activity>
        <activity
            android:name=".app.activities.AddNickname"
            android:configChanges="keyboardHidden|orientation"
            android:parentActivityName=".app.activities.AddAccount"
            android:screenOrientation="portrait"
            android:theme="@style/Holo.Theme.Light.DarkActionBar"
            android:windowSoftInputMode="adjustResize" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".app.activities.AddAccount" />
        </activity>
        <activity
            android:name=".app.activities.WhoOnCall"
            android:configChanges="keyboardHidden|orientation"
            android:parentActivityName=".app.activities.SelectAccount"
            android:screenOrientation="portrait"
            android:theme="@style/Holo.Theme.Light.DarkActionBar"
            android:windowSoftInputMode="adjustResize" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".app.activities.SelectAccount" />
        </activity>
        <activity
            android:name=".app.activities.SelectDepartment"
            android:configChanges="keyboardHidden|orientation"
            android:parentActivityName=".app.activities.AddNickname"
            android:screenOrientation="portrait"
            android:theme="@style/Holo.Theme.Light.DarkActionBar"
            android:windowSoftInputMode="adjustResize" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".app.activities.AddNickname" />
        </activity>
        <activity
            android:name=".app.activities.SelectAccount"
            android:configChanges="keyboardHidden|orientation"
            android:screenOrientation="portrait"
            android:theme="@style/Holo.Theme.Light.DarkActionBar"
            android:windowSoftInputMode="adjustResize" >
        </activity>
        <activity
            android:name=".app.activities.ManageSchedules"
            android:configChanges="keyboardHidden|orientation"
            android:parentActivityName=".app.activities.MyCalendar"
            android:screenOrientation="portrait"
            android:theme="@style/Holo.Theme.Light.DarkActionBar"
            android:windowSoftInputMode="adjustResize" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".app.activities.MyCalendar" />
        </activity>
        <activity
            android:name=".app.activities.EditSchedule"
            android:configChanges="keyboardHidden|orientation"
            android:parentActivityName=".app.activities.ManageSchedules"
            android:screenOrientation="portrait"
            android:theme="@style/Holo.Theme.Light.DarkActionBar"
            android:windowSoftInputMode="adjustResize" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".app.activities.ManageSchedules" />
        </activity>
        <activity
            android:name=".app.activities.EventDetail"
            android:configChanges="keyboardHidden|orientation"
            android:screenOrientation="portrait"
            android:theme="@style/Holo.Theme.Light.DarkActionBar"
            android:windowSoftInputMode="adjustResize" >
        </activity>
        <activity
            android:name=".app.activities.SelectSchedule"
            android:configChanges="keyboardHidden|orientation"
            android:parentActivityName=".app.activities.SelectAccount"
            android:screenOrientation="portrait"
            android:theme="@style/Holo.Theme.Light.DarkActionBar"
            android:windowSoftInputMode="adjustResize" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".app.activities.SelectAccount" />
        </activity>
        <activity
            android:name=".app.activities.MyCalendar"
            android:configChanges="keyboardHidden|orientation"
            android:parentActivityName=".app.activities.AmHome"
            android:screenOrientation="portrait"
            android:theme="@style/Holo.Theme.Light.DarkActionBar"
            android:windowSoftInputMode="adjustResize" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".app.activities.AmHome" />
        </activity>
        <activity
            android:name=".app.activities.NewPage"
            android:configChanges="keyboardHidden|orientation"
            android:parentActivityName=".app.activities.WhoOnCall"
            android:screenOrientation="portrait"
            android:theme="@style/Holo.Theme.Light.DarkActionBar"
            android:windowSoftInputMode="stateVisible" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".app.activities.WhoOnCall" />
        </activity>

        <service android:name=".app.services.SystemActivationServices" />

        <!-- Used for install referrer tracking -->
        <receiver android:name=".func.mycalendar.SynchronizationAmReceiver" >
            <intent-filter>
                <action android:name="com.myapp.synchonize" />
            </intent-filter>
        </receiver>

        <!-- REQUIRED for Urban Airship GCM -->
        <receiver android:name="com.urbanairship.CoreReceiver" />
        <receiver
            android:name="com.urbanairship.push.GCMPushReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

                <category android:name="com.myapp" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.PACKAGE_REPLACED" />

                <data android:scheme="package" />
            </intent-filter>
        </receiver>

        <service
            android:name="com.urbanairship.push.PushService"
            android:label="Push Notification Service" />
        <service
            android:name="com.urbanairship.analytics.EventService"
            android:label="Event Service" />


        <provider
            android:name="com.urbanairship.UrbanAirshipProvider"
            android:authorities="com.myapp.urbanairship.provider"
            android:exported="false"
            android:multiprocess="true" />
        <!-- END OF REQUIRED ITEMS -->


        <!-- OPTIONAL (for segments support) -->
        <service
            android:name="com.urbanairship.location.LocationService"
            android:label="Segments Service" />

        <receiver android:name="com.myapp.func.pushnotification.IntentReceiver" />
    </application>

</manifest>

Edit1: I added android:required="false" to all of my users-permision tags except INTERNET and ACCESS_NETWORK_STATE (because my app doesnt work without internet). Also added:

<uses-feature android:name="android.hardware.LOCATION" android:required="false" />
<uses-feature android:name="android.hardware.location.GPS" android:required="false" />
<uses-feature android:name="android.hardware.location.NETWORK" android:required="false"     />
<uses-feature android:name="android.hardware.screen.PORTRAIT" android:required="false" />
<uses-feature android:name="android.hardware.TELEPHONY" android:required="false" />
<uses-feature android:name="android.hardware.TOUCHSCREEN" android:required="false" />
<uses-feature android:name="android.hardware.WIFI" android:required="false" />

Still no good outcome.


回答1:


You do not need this:

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

nor this:

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

And instead of ACTION_CALL use ACTION_DIAL, and then you do not need this:

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

You now should be more tablet friendly.




回答2:


After 18 iteration of Trial and error I solved the problem by getting rid of many permissions that were in my manifest and I didn't need them (they were added by outsourced dev team). Also I noticed that having <supports-screens is not necessary neither.

Only permissions left in my manifest are

<!-- USES PERMISSSION -->

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

    <uses-permission android:name="android.permission.VIBRATE"/>
    <!-- REQUIRED FOR GCM -->
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <permission
        android:name="com.doximity.amiondroid.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.doximity.amiondroid.permission.C2D_MESSAGE" />
    <uses-permission android:name="android.permission.BROADCAST_STICKY" />

<!-- END OF USES PERMISSSION -->

Conclusion: There is no source available (as far as I looked) that can tell you what are the exact minimum requirements for supporting tablets.



来源:https://stackoverflow.com/questions/18219583/how-to-make-an-app-tablet-compatible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!