# cordova-plugin-get-app-info

> A Cordova plugin to get the icon and label of an app based on its package name

Latest version **1.0.1** (published 2017-11-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install cordova-plugin-get-app-info
pnpm add cordova-plugin-get-app-info
yarn add cordova-plugin-get-app-info
bun add cordova-plugin-get-app-info
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-11-19 |
| First published | 2017-11-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Emanuel Sartor |
| Maintainers | esartor |
| Keywords | cordova, ecosystem:cordova, cordova-android |

## Links

- npm: https://www.npmjs.com/package/cordova-plugin-get-app-info
- Repository: https://github.com/esartor/cordova-plugin-get-app-info
- Issues: https://github.com/esartor/cordova-plugin-get-app-info/issues
- npm.io page: https://npm.io/package/cordova-plugin-get-app-info

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2017-11-19
- 1.0.0 — 2017-11-19

## README

# Get App Info Cordova Plugin

A Cordova plugin to get the icon and label of an app based on its package name.


## Install

```
cordova plugin add cordova-plugin-get-app-info
```

## Usage


Get app label:

```
cordova.plugins.GetAppInfo.getAppLabel(function(label) {
    console.log(label);
}, function(error) {
    console.error(error);
});
```

Get app icon in Base64 string format:

```
cordova.plugins.GetAppInfo.getAppIcon(function(base64Icon) {
    console.log(base64Icon);
}, function(error) {
    console.error(error);
});
```

## Using with Ionic Framework

In order for the plugin to be injectable into your providers/components and to use it the same way you use Ionic Native plugins, follow these steps:

1. Install the plugin as described in the _Install_ section.

2. Create a Ionic Native wrapper for `cordova-plugin-get-app-info`. A reasonable location for the wrapper is `src/plugins/get-app-info/get-app-info.ts`:

    ```
    import { Injectable } from '@angular/core';
    import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
    
    @Plugin({
      pluginName: 'GetAppInfo',
      plugin: 'cordova-plugin-get-app-info',
      pluginRef: 'cordova.plugins.GetAppInfo',
      repo: 'https://github.com/esartor/cordova-plugin-get-app-info',
      platforms: ['Android']
    })
    @Injectable()
    export class GetAppInfo extends IonicNativePlugin {
      @Cordova()
      getAppIcon(packageName: string): Promise<string> {
        return;
      }
    
      @Cordova()
      getAppLabel(packageName: string): Promise<string> {
        return;
      }
    }
    ```

    Read [this guide](https://github.com/ionic-team/ionic-native/blob/master/DEVELOPER.md) for a full explanation on how to wrap Cordova plugins with Ionic Native.

3. Inject the plugin into your providers/components and access the `getAppLabel` and `getAppIcon` methods which will return a promise. Example code:

    ```
    import { Injectable } from '@angular/core';
    import { Platform } from 'ionic-angular';
    import { GetAppInfo } from '../../plugins/get-app-info/get-app-info';


    @Injectable()
    export class MyProvider {

      constructor(
        private platform: Platform,
        private getAppInfo: GetAppInfo
      ) {}

      myMethod() {
        if (this.platform.is(CORDOVA_PLATFORM)) {
          getAppInfo.getAppIcon('random.package.id').then((base64Icon) => {
            console.log(base64Icon);
          });
        }
      }
    }
    ```

## Supported platforms

* Android

## License
MIT

---
_Source: https://npm.io/package/cordova-plugin-get-app-info · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
