Skip to content

Latest commit

 

History

History
48 lines (38 loc) · 1.18 KB

File metadata and controls

48 lines (38 loc) · 1.18 KB

Cordova Google Play Services Version

This plugin provides the currently installed version of Google Play Services.

In addition, it is able to ask the user to perform an update if the version is not sufficient.

There are plugins that require a certain version of Google Play Services, for example: cordova-plugin-background-geolocation.

It is helpful if you want to build a fallback solution or if you just want to inform the user why some functionality is missing.

Installation

cordova plugin add https://github.com/kolbasa/cordova-plugin-google-play-services-version

Usage

Query the version:

cordova.plugins.playservices.getVersion(
    function (oVersion) {
        // success callback
    },
    function (err) {
        // error callback
    }
);

Example result:

{
    versionName: '16.0.89 (040700-239467275)',
    versionCode: 16089022,
    lastUpdateTime: 1554936328000 // unix timestamp
}

Prompting the user to update:

cordova.plugins.playservices.showUpdateDialog(
    function () {
        // success callback
    },
    function (err) {
        // error callback
    }
);