Need help upgrading to Ionic Framework 4.0? Get assistance with our Enterprise Migration Services EXPLORE NOW

Device Accounts

Improve this doc

Gets the Google accounts associated with the Android device

Repo: https://github.com/danielsogl/cordova-device-accounts

Installation

  1. Install the Cordova and Ionic Native plugins:
    $ ionic cordova plugin add cordova-device-accounts
    $ npm install --save @ionic-native/device-accounts@4
    
  2. Add this plugin to your app's module

Supported platforms

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

API

Native

General