Device Accounts
Gets the Google accounts associated with the Android device
Repo: https://github.com/danielsogl/cordova-device-accounts
Installation
- Install the Cordova and Ionic Native plugins:
$ ionic cordova plugin add cordova-device-accounts $ npm install --save @ionic-native/device-accounts@4
- Add this plugin to your app's module
Supported platforms
- Android
Usage
import { DeviceAccounts } from '@ionic-native/device-accounts';
constructor(private deviceAccounts: DeviceAccounts) { }
...
this.deviceAccounts.get()
.then(accounts => console.log(accounts))
.catch(error => console.error(error));
Instance Members
get()
Gets all accounts registered on the Android Device
Returns: Promise<AndroidAccount[]>
getByType(type)
Get all accounts registered on Android device for requested type
Param | Type | Details |
---|---|---|
type |
string
|
Returns: Promise<AndroidAccount[]>
getEmails()
Get all emails registered on Android device (accounts with ‘com.google’ type)
Returns: Promise<string[]>
getEmail()
Get the first email registered on Android device
Returns: Promise<string>
AndroidAccount
Param | Type | Details |
---|---|---|
CREATOR |
AndroidAccount
|
Account creator |
name |
string
|
Account name |
type |
string
|
Account type |