如何使应用平板电脑兼容?

时间:2013-08-13 21:31:25

标签: android android-layout android-manifest

我想让我的应用平板电脑兼容,我已经阅读了所有相关内容,并确保没有任何用途功能特定于手机,并添加了所有尺寸的支持屏幕(如我在清单中所见)。但我仍然看到Playstore无法将我的应用程序识别为平板电脑兼容。请向我提供一步一步的说明,以帮助我解决此问题或兼容的清单副本。 (我已经找了一些开源应用程序,他们没有提供这些标签,但仍可在平板电脑上使用。例如: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:我向所有用户添加了android:required =“false” - 除INTERNET和ACCESS_NETWORK_STATE之外的permision标签(因为我的应用程序在没有互联网的情况下无法工作)。 还添加了:

<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" />

仍然没有好结果。

2 个答案:

答案 0 :(得分:1)

你不需要这个:

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

也不是:

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

而不是ACTION_CALL使用ACTION_DIAL,而你不需要这个:

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

你现在应该更加平板电脑了。

答案 1 :(得分:1)

经过18次试验和错误的迭代后,我通过删除我的清单中的许多权限来解决问题,我不需要它们(它们是由外包开发团队添加的)。我也注意到<supports-screens也没有必要。

我的清单中只剩下权限

<!-- 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 -->

结论:没有可用的资源(据我所知)可以告诉您支持平板电脑的最低要求是什么。