How to detect installed Chrome version from my Android App?

Jhonty

I am working on a feature where I need to transition user from Android Native APP to Chrome custom tab only if chrome version installed on the device is greater than version 65. So my question is, is there a way we can detect chrome version from Android Native App ?

MatPag
private boolean isChromeInstalledAndVersionGreaterThan65() {
    PackageInfo pInfo;
    try {
        pInfo = getPackageManager().getPackageInfo("com.android.chrome", 0);
    } catch (PackageManager.NameNotFoundException e) {
        //chrome is not installed on the device
        return false;
    }
    if (pInfo != null) {
        //Chrome has versions like 68.0.3440.91, we need to find the major version
        //using the first dot we find in the string
        int firstDotIndex = pInfo.versionName.indexOf(".");
        //take only the number before the first dot excluding the dot itself
        String majorVersion = pInfo.versionName.substring(0, firstDotIndex);
        return Integer.parseInt(majorVersion) > 65;
    }
    return false;
}

Obviously this will work until Chrome will be versioned how they did until now, if they will decide to change the versioning the logic should be updated as well. (I don't think this will happen but for max safety put everything in a try-catch)

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

How to detect installed Chrome version from my Android App?

分類Dev

How to detect programmatically if "Android App" is running in chrome book or in Android phone

分類Dev

How to check which version of v8 is installed with my NodeJS?

分類Dev

How to expose component from installed app to be visible to instant app?

分類Dev

How to detect page title change in Google Chrome from an extension?

分類Dev

How to check if an app is installed from a web-page on an iPhone?

分類Dev

how to check if app is installed in user device when redirecting from deeplink

分類Dev

My version of chrome is not the latest but it says it is

分類Dev

Swift (4.1) how to detect if me app was open from external source

分類Dev

How to pass a blob from a Chrome extension to a Chrome app

分類Dev

Getting error while detect chrome extension installed or not using javascript

分類Dev

How to determine the minimal required .NET framework version to run my app

分類Dev

How to choose best layout for my android app?

分類Dev

How to hook system calls of my android app

分類Dev

How can I send message to specific contact through WhatsApp from my android app?

分類Dev

how to use app links to pass parameter to android playstore to be retrieved when app is installed

分類Dev

How to open IOS Linkedin Learning App from my app

分類Dev

How to prevent my app from opening within another app?

分類Dev

Installed older software from Software Centre. Newer version available elsewhere. How to update?

分類Dev

How to automatically increment version number from my sbt and uploaded to git

分類Dev

Can I force my Android app to update from the Play Store?

分類Dev

NoSuchMethodException when trying to launch my app from Android Studio

分類Dev

Can I localize my whole android app from a button click

分類Dev

Retrieving the user name and email id from Facebook into my android app

分類Dev

Chrome Version 66.0.3359.139 lost my sessions on reboot

分類Dev

how to change version number of an App from iTunesConnect with state Prepare for Submission

分類Dev

How can I find the version of Ubuntu that is installed?

分類Dev

Android : First version of my app supports 2.3 and now I am planning to support only 4+ in next version

分類Dev

fastboot not detect my android device - ubuntu

Related 関連記事

  1. 1

    How to detect installed Chrome version from my Android App?

  2. 2

    How to detect programmatically if "Android App" is running in chrome book or in Android phone

  3. 3

    How to check which version of v8 is installed with my NodeJS?

  4. 4

    How to expose component from installed app to be visible to instant app?

  5. 5

    How to detect page title change in Google Chrome from an extension?

  6. 6

    How to check if an app is installed from a web-page on an iPhone?

  7. 7

    how to check if app is installed in user device when redirecting from deeplink

  8. 8

    My version of chrome is not the latest but it says it is

  9. 9

    Swift (4.1) how to detect if me app was open from external source

  10. 10

    How to pass a blob from a Chrome extension to a Chrome app

  11. 11

    Getting error while detect chrome extension installed or not using javascript

  12. 12

    How to determine the minimal required .NET framework version to run my app

  13. 13

    How to choose best layout for my android app?

  14. 14

    How to hook system calls of my android app

  15. 15

    How can I send message to specific contact through WhatsApp from my android app?

  16. 16

    how to use app links to pass parameter to android playstore to be retrieved when app is installed

  17. 17

    How to open IOS Linkedin Learning App from my app

  18. 18

    How to prevent my app from opening within another app?

  19. 19

    Installed older software from Software Centre. Newer version available elsewhere. How to update?

  20. 20

    How to automatically increment version number from my sbt and uploaded to git

  21. 21

    Can I force my Android app to update from the Play Store?

  22. 22

    NoSuchMethodException when trying to launch my app from Android Studio

  23. 23

    Can I localize my whole android app from a button click

  24. 24

    Retrieving the user name and email id from Facebook into my android app

  25. 25

    Chrome Version 66.0.3359.139 lost my sessions on reboot

  26. 26

    how to change version number of an App from iTunesConnect with state Prepare for Submission

  27. 27

    How can I find the version of Ubuntu that is installed?

  28. 28

    Android : First version of my app supports 2.3 and now I am planning to support only 4+ in next version

  29. 29

    fastboot not detect my android device - ubuntu

ホットタグ

アーカイブ