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

Compatibility issue when calling method #682

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

Compatibility issue when calling method #682

PSDroid2022 opened this issue Aug 25, 2022 · 0 comments

Comments

@PSDroid2022
Copy link

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

In ''cz.martykan.forecastie.AlarmReceiver", you invoke the framework API "<android.net.ConnectivityManager: android.net.NetworkInfo getActiveNetworkInfo()>" in "isNetworkAvailable" method as shown in following. But actually, this method is deprecated after API level 29 (https://developer.android.google.cn/reference/kotlin/android/net/ConnectivityManager?hl=en#getActiveNetworkInfo()).

 private boolean isNetworkAvailable() {
        ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
        return activeNetworkInfo != null && activeNetworkInfo.isConnected();
    }

So when the app try to invoke this API on devices after API level 29, your app will run with an unpredictable results. So we suggest you add an "if(SDK_INT <30)" to fix this potential issue.

@PSDroid2022 PSDroid2022 changed the title A compatibility issue Compatibility issue when calling method Aug 25, 2022
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