好吧,我正在开发并计划发布的应用程序遇到了这个问题,但该问题仅发生在 Android SDK 的一个版本(版本 4.1.1 API 16)上。
我可以限制仅 Android 版本 4.1.1 API 16 下载和运行我的应用吗?
我知道 googlePlay 对某些设备列表有限制,但问题是由于操作系统版本而不是设备而发生的,至少从调试来看是这样...
我还知道 list 文件中有 use-sdk 属性:
<uses-sdk android:minSdkVersion="integer"
android:targetSdkVersion="integer"
android:maxSdkVersion="integer" />
但是将 android:minSdkVersion 设置为 17 会太高,并且对许多用户来说不可用,我还投入了大量的工作来使应用程序向后兼容并在 3.0 之前的设备上正常工作,这只是这个 android 版本4.1.1 API 16 给我带来了麻烦...
请帮忙!谢谢!
编辑:这是我当前在应用程序 list 中使用的 SDK:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
使用相关代码进行编辑:
//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);
}
}
};
编辑问题日志:
最后一个日志语句中的字符串几乎随机更改为完全随机的数字。
最佳答案
您可以阻止应用运行。
不,您无法阻止应用程序在 minSDKVersion
和 maxSDKVersion/targetSDKVersion
之间的 API 上下载
你可以这样检查:
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();
}
关于java - 您可以限制特定的 Android API 版本从 googlePlay 商店运行/下载应用程序吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21099508/