restrict a user to download the app from google play if android version is older

依然范特西╮ 提交于 2019-12-11 04:47:25

问题


How to restrict a user to download the app from google play(google app store) if user's android version(SDK) is lower then a specific version. I am using Titanium to develop the app.

Detail: I have created an application for a client and it works fine with version 4.2.2 and above but there are some issues with 4.2.1 and below now client wants that if any user having version below 4.2.1 tries to download the app from app store, user get a message/notification about version.

I tried to set minSdkVersion in manifest file also setup the default sdk version in properties to 4.2 but still all user can download and install the app. Is there any way to restrict user by downloading the app on the basis of android version.

I also added the property in tiapp.xml

 <android xmlns:android="http://schemas.android.com/apk/res/android">
        <tool-api-level>8</tool-api-level>
        <manifest>
            <uses-sdk android:minSdkVersion="4"/>
            <!--android:targetSdkVersion="7" -->
        </manifest>
    </android>

Here is the manifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.contingent.pcc" android:versionCode="4"
    android:versionName="1.2">
    <uses-sdk android:minSdkVersion="4" />

    <!-- TI_MANIFEST -->

    <application android:icon="@drawable/appicon"
        android:label="CNS PCC" android:name="CnsPccApplication"
        android:debuggable="false">

        <!-- TI_APPLICATION -->

        <activity android:name=".CnsPccActivity"
            android:label="CNS PCC" android:theme="@style/Theme.Titanium"
            android:configChanges="keyboardHidden|orientation">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <!--<category android:name="android.intent.category.LAUNCHER" />-->
                <data android:scheme="cnspcc" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>


        <activity android:name="org.appcelerator.titanium.TiActivity"
            android:configChanges="keyboardHidden|orientation" />
        <activity android:name="org.appcelerator.titanium.TiTranslucentActivity"
            android:configChanges="keyboardHidden|orientation"
            android:theme="@android:style/Theme.Translucent" />
        <activity android:name="org.appcelerator.titanium.TiModalActivity"
            android:configChanges="keyboardHidden|orientation"
            android:theme="@android:style/Theme.Translucent"
        />
        <activity android:name="ti.modules.titanium.ui.TiTabActivity"
            android:configChanges="keyboardHidden|orientation" />
        <activity android:name="ti.modules.titanium.ui.android.TiPreferencesActivity" />

        <service android:name="org.appcelerator.titanium.analytics.TiAnalyticsService"
            android:exported="false" />


    </application>

    <supports-screens android:anyDensity="false"/>  

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/> 
    <uses-permission android:name="android.permission.VIBRATE"/> 
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> 
    <uses-permission android:name="android.permission.CAMERA"/> 
    <uses-permission android:name="android.permission.INTERNET"/> 
    <uses-permission android:name="android.permission.READ_CONTACTS"/> 
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>           

</manifest>

Also check the properties:


回答1:


You are using minsdk version as 4. But it must be 17 for 4.2 So make a try with adding 17. This will not allow the user who have the OS version less that 4.

Read more details at uses-sdk detail and Dashboards




回答2:


If the user doesnot want to install the application if the android version is below 17. Use the minium SDK version as 17.

          <uses-sdk android:minSdkVersion="17" />


来源:https://stackoverflow.com/questions/16536050/restrict-a-user-to-download-the-app-from-google-play-if-android-version-is-older

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