-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(unique-device-add): add UniqueDeviceId plugin (#1064)
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Plugin, Cordova } from './plugin'; | ||
|
||
/** | ||
* @name UniqueDeviceID | ||
* @description | ||
* This plugin produces a unique, cross-install, app-specific device id. | ||
* | ||
* @usage | ||
* ``` | ||
* import { UniqueDeviceID } from 'ionic-native'; | ||
* | ||
* UniqueDeviceID.get() | ||
* .then((uuid: any) => doSomething(uuid)) | ||
* .catch((error: any) => console.log(error)); | ||
* | ||
* ``` | ||
*/ | ||
@Plugin({ | ||
pluginName: 'UniqueDeviceID', | ||
plugin: 'cordova-plugin-uniquedeviceid', // npm package name, example: cordova-plugin-camera | ||
pluginRef: 'window.plugins.uniqueDeviceID', // the variable reference to call the plugin, example: navigator.geolocation | ||
repo: 'https://github.com/Paldom/UniqueDeviceID' // the github repository URL for the plugin | ||
}) | ||
export class UniqueDeviceID { | ||
|
||
/** | ||
* Gets a unique, cross-install, app-specific device id. | ||
* @return {Promise<string>} Returns a promise that resolves when something happens | ||
*/ | ||
@Cordova() | ||
static get(): Promise<string> { | ||
return; // We add return; here to avoid any IDE / Compiler errors | ||
} | ||
|
||
} |