您可以限制运行/从GOOGLEPLAY商店下载应用程序特定的Andr​​oid API版本? [英] Can you restrict a specific Android API version from running/downloading app from googlePlay store?

查看:323
本文介绍了您可以限制运行/从GOOGLEPLAY商店下载应用程序特定的Andr​​oid API版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,所以我有这个一个问题一个应用程序我的工作和规划的出台,但问题只出现在Android SDK(版本4.1.1 API 16)的一个版本。

Alright so I'm having this one problem with an app I'm working on and planning on releasing, but the problem is only occurring on one version of the android SDK (Version 4.1.1 API 16).

我可以从下载和运行我的应用程序限制让Android版本4.1.1 API 16?

Can I restrict JUST android version 4.1.1 API 16 from downloading and running my app?

我知道GOOGLEPLAY有限制某些设备列表中,但问题是由于操作系统版本,而不是设备发生,至少看起来是这样,从调试...

I know googlePlay has a restrict certain device list, but the problem is occurring because of the OS version, NOT the device, at least it seems that way from debugging...

我也知道有一个在清单文件中使用-SDK属性:

I also know there's the uses-sdk attributes in the manifest file:

<uses-sdk android:minSdkVersion="integer"
          android:targetSdkVersion="integer"
          android:maxSdkVersion="integer" />

但Android的设置:的minSdkVersion 17便一路走高,无法提供给多个用户,我也投入了大量的工作,使应用程序向后兼容和pre工作正常3.0的设备,它只是这个版本的Andr​​oid 4.1.1 API 16,是造成我的麻烦...

But setting the android:minSdkVersion to 17 will be way to high and not be available to many users, I also put a lot of work into making the app backwards compatible and works fine on pre 3.0 devices, it's just this android version 4.1.1 API 16 that is causing me trouble...

请帮帮忙!谢谢!

修改:这是我目前使用-SDK在我的应用程序清单:

Edit: This is my current uses-sdk in my apps manifest:

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

修改相关code

//button listener for the number buttons. Each button will display a number 1 - 10
//upon clicking the button the number that is displayed on the button will be
//added to what is displayed in the textView
//
//mCurrentWorkingText is the current expression that is being added updated.
View.OnClickListener genericNumberButtonListener = new View.OnClickListener() {

    @Override
    public void onClick(View v) {
    //cast the incoming view to a textView so we can get
    //the text the button displays
        TextView textView = (TextView) v;
        String textFromButton = textView.getText().toString();

        if (mCurrentWorkingText.length() == 0) {
            mWorkingTextView.setText(mWorkingTextView.getText()
                    .toString().concat(textFromButton));
            mCurrentWorkingText = textFromButton;
        } else {
                    // if the working TextView isn't zero we need to
                    // append
                    // the
                    // textFromButton to what is already there.
                    mWorkingTextView.setText(mWorkingTextView.getText()
                            .toString().concat(textFromButton));
                    mCurrentWorkingText = mCurrentWorkingText
                            .concat(textFromButton);


        }
    }
};

修改与日志的问题

Edit with log of problem:

该字符串改变几乎随机到一个完全随机数的最后一个日志声明。

The string changes almost randomly to a completely random number in the last log statement.

推荐答案

不,你不能prevent从的minSdkVersion maxSDKVersion / targetSDKVersion

You can prevent the app from running.

And no, you cannot prevent the app from downloading when on an API in between minSDKVersion and maxSDKVersion/targetSDKVersion

您可以检查它是这样的:

You can check it like this:

if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD &&         android.os.Build.VERSION.SDK_INT <= android.os.Build.VERSION_CODES.HONEYCOMB) {

 // For gingerbread but lesser than HONEYCOMB, show a dialog or something and close the app
 finish();

}

这篇关于您可以限制运行/从GOOGLEPLAY商店下载应用程序特定的Andr​​oid API版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆