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
    
  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()

Get all accounts registered on Android device for requested type

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