mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-23 10:32:52 +08:00
feat(unique-device-id): add unique-device-id plugin (#4455)
This commit is contained in:
parent
e51a1a79ef
commit
7fe3ad1daa
@ -0,0 +1,42 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Unique Device ID
|
||||||
|
* @description
|
||||||
|
* This plugin produces a unique, cross-install, app-specific device id.
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```typescript
|
||||||
|
* import { UniqueDeviceID } from '@awesome-cordova-plugins/unique-device-id/ngx';
|
||||||
|
*
|
||||||
|
* constructor(private uniqueDeviceID: UniqueDeviceID) { }
|
||||||
|
*
|
||||||
|
* ...
|
||||||
|
*
|
||||||
|
* this.uniqueDeviceID.get()
|
||||||
|
* .then((uuid: any) => console.log(uuid))
|
||||||
|
* .catch((error: any) => console.log(error));
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
pluginName: 'UniqueDeviceID',
|
||||||
|
plugin: 'cordova-plugin-uniquedeviceid',
|
||||||
|
pluginRef: 'window.plugins.uniqueDeviceID',
|
||||||
|
repo: 'https://github.com/Paldom/UniqueDeviceID',
|
||||||
|
install: '', // OPTIONAL install command, in case the plugin requires variables
|
||||||
|
installVariables: [], // OPTIONAL the plugin requires variables
|
||||||
|
platforms: ['Android', 'iOS', 'Windows Phone 8'], // Array of platforms supported, example: ['Android', 'iOS']
|
||||||
|
})
|
||||||
|
@Injectable()
|
||||||
|
export class UniqueDeviceID extends AwesomeCordovaNativePlugin {
|
||||||
|
/**
|
||||||
|
* Gets a unique, cross-install, app-specific device id.
|
||||||
|
* @return {Promise<string>} Returns a promise that resolves when something happens
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
get(): Promise<string> {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user