简体   繁体   中英

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

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:

在此处输入图片说明

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

如果用户不想在android版本低于17的情况下安装应用程序,请使用最低SDK版本为17。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM