Skip to content

Cordova/phonegap plugin to get Android installed applications with icons

License

Notifications You must be signed in to change notification settings

nick-denry/cordova-plugin-intent-list

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple phonegap plugin to get Android installed apps with base64 icons

Version Downloads Platforms License PayPayl donate button

Demo.

1. Installation

cordova plugin add cordova-plugin-intent-list

or directly via git (unstable)

cordova plugin add https://github.com/nick-denry/cordova-plugin-intent-list

2. Usage

navigator.IntentList.getList(success, error);
navigator.IntentList.getList(function(applist) {
    console.log(applist);
}, function(errorMesssage) {
    console.log(errorMesage);
});

applist will contain array of JSON objects.

[
  {
    "label": "Chrome",
    "package": "com.android.chrome",
    "packageIcon": "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAJAAAACQCAYAAADnRuK4AAAABHNCSVQICAgIfAhkiAAAIABJREF..."
  },
  ...
]

3. Update Content Security Policy

Add img-src 'self' data:; to your CSP declaration to allow data:image images, i.e.:

<!-- This is a wide open CSP declaration. To lock this down for production, see below. -->
<meta http-equiv="Content-Security-Policy" content="default-src * 'unsafe-inline' gap:; style-src 'self' 'unsafe-inline'; img-src 'self' data:; media-src *" />

⚠️ NOTE Do not use wide open CSP declaration in production. @see https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-whitelist/#content-security-policy

4. Credits

5. License

Licensed under Apache 2.0. Please see License File for more information.