Can you restrict a specific Android API version from running/downloading app from googlePlay store?

我只是一个虾纸丫 提交于 2019-12-25 04:56:24

问题


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).

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

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

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

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

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

Please help! Thank you!

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

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

Edit with relevant 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.


回答1:


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();

}



回答2:


So the problem I was having was caused by the pageTransformer that I was using. Android 4.1.1 really didn't like it. I don't know why but all I know is that if you're using pageTransformer with custom views and ActionBarSherlock you better be careful when using the pageTransformer to add animation to the page turns.



来源:https://stackoverflow.com/questions/21099508/can-you-restrict-a-specific-android-api-version-from-running-downloading-app-fro

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