PhoneGap Utils
Switch branches/tags
Nothing to show
Clone or download
Latest commit 4e8f24a Apr 17, 2017
Permalink
Failed to load latest commit information.
src update openStore/openApp Jun 16, 2015
www remove comments from js May 20, 2014
.fetch.json first commit May 8, 2014
README.md update docs Apr 17, 2017
plugin.xml change namesapce May 8, 2014

README.md

PhoneGap Utils

Phonegap 3.*.* plugin that contains many helpful utils.

Installation

Install phonegap plugin add https://github.com/ahmad-moussawi/pgutils.git

Remove phonegap plugin rm org.apache.cordova.pgUtils

Usage:

getUniqueDeviceId

param type required note
successCallback function(string deviceId) no function with deviceId as argument
errorCallback function(object error) no
navigator.PGUtils.getUniqueDeviceId(function(deviceId) {
	console.log(deviceId);
}, 
function(error) {
	console.log(error);
});

openApp

param type required note
appId string yes the package id for android i.e. com.twitter.android and the app schema for iOs i.e. id8787663 or myAppId
successCallback function(string status) no status can be on of OK, MARKET if the app is not found and the market has opened, MARKET-BROWSER (only for android) if the app is not found and the market is opened via the browser
errorCallback function(object error) no
// on iOS: the appId should be in the following format: <scheme>/<storeId>, e.g. `myapp/id876656`
navigator.PGUtils.openApp(appId, function(status){
    console.log(status);
},
function(error) {
    console.log(error);
});

openStore

param type required note
appId string yes the package id for android i.e. com.twitter.android and the app schema for iOs i.e. id8787663 or myAppId
successCallback function(string status) no status can be on of MARKET, MARKET-BROWSER (only for android) if the market is opened via the browser
errorCallback function(object error) no
// on iOS: the appId should be in the following format: <scheme>/<storeId>, e.g. `myapp/id876656`
navigator.PGUtils.openStore(appId, function(status){
    console.log(status);
},
function(error) {
    console.log(error);
});

Permissions:

Android: This plugin requires the android.permission.READ_PHONE_STATE permission to calculate the deviceId

iOS note

  • Add the following flag -fno-objc-arc to KeychainItemWrapper.m, PGUtils.m and DeviceManager.m (Build Phases >> Compile Sources Section)
  • Add the Security.framework (Project settings >> Linked Frameworks and Libraries section)

Copyright

This plugin is developed By FOO, all copyright are reserved.