简体   繁体   中英

How can I determine the latest Android version programmatically?

I want to check within my app whether the device runs the latest version of Android.

Is there a way to do that?

Yes, I could update my app once a year, but I would rather solve that problem technically.

Try to add this and check

String androidOS = Build.VERSION.RELEASE;

And also following method will work

int version = Build.VERSION.SDK_INT;
String company = Build.MANUFACTURER;
String model = Build.MODEL;
String release = Build.VERSION.RELEASE;

Log.e("TAG", "company " + company)
Log.e("TAG", "model " + model)
Log.e("TAG", "version " + version)
Log.e("TAG", "release " + release)

Comment from Gabe Sechan :

Unless you want to create a webservice that publishes the version number of the latest Android and query it, no. There's no way to no without a service publishing it what the latest Android is. And even if you did, nobody ships stock Android- they all cherry pick additions and all use different minor build releases. So you could at most know if it was the right major version

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM