Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

callback compatibility issue when initialing method #40

Open
PSDroid2022 opened this issue Aug 26, 2022 · 0 comments
Open

callback compatibility issue when initialing method #40

PSDroid2022 opened this issue Aug 26, 2022 · 0 comments

Comments

@PSDroid2022
Copy link

We confirm a callback compatibility issue which might threaten the robustness of your app and give a detailed suggestion for you.

In ''be.brunoparmentier.openbikesharing.app.activities.MapActivity", you super the framework API "<android.app.Activity: void onRequestPermissionsResult(int,java.lang.String[],int[])>" in "onRequestPermissionsResult" method as shown in following. But actually, this method is added in API level 23 (https://developer.android.google.cn/reference/android/app/Activity?hl=en#onRequestPermissionsResult(int,%20java.lang.String[],%20int[])).

@Override
    public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
        switch (requestCode) {
            case REQUEST_LOC_PERMISSION_CODE:
                if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                    mooveToLocation();
                } else if(!ActivityCompat.shouldShowRequestPermissionRationale(this,
                        Manifest.permission.ACCESS_FINE_LOCATION)) {
                    Toast.makeText(this, getString(R.string.location_not_granted), Toast.LENGTH_LONG).show();
                }
                break;
            default:
                super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        }
    }

So when the app try to initial related funtion on devices level 21 and 22, your app will run with an unpredictable results. So we suggest you add an "if(SDK_INT>22)" or change your app miniSDK from 21 to 23 to fix this potential issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant