mirror of
https://github.com/purplecabbage/phonegap-plugins.git
synced 2026-04-24 03:00:11 -04:00
36 lines
1.2 KiB
Plaintext
36 lines
1.2 KiB
Plaintext
AccountList Phonegap Plugin for Android
|
|
=======================================
|
|
This plugin allows you to obtain an array containing all the accounts configured on the device
|
|
|
|
Adding the Plugin to your project
|
|
=================================
|
|
|
|
To install the plugin, copy accountlist.js to your project's www folder and include a reference to it in your html files.
|
|
|
|
<script type="text/javascript" src="accountlist.js"></script>
|
|
|
|
Create a folder called 'com/seltzlab/mobile' within your project's src folder and copy AccountList.java file into that new folder.
|
|
|
|
Add a plugin line to res/xml/plugins.xml
|
|
<plugin name="AccountList" value="com.seltzlab.mobile.AccountList" />
|
|
|
|
Add a permission line to the AndroidManifest.xml
|
|
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
|
|
|
Using the plugin
|
|
================
|
|
window.plugins.AccountList.get(
|
|
{
|
|
type: 'account type' // if not specified get all accounts
|
|
// google account example: 'com.google'
|
|
},
|
|
function (result) {
|
|
console.log(result.length);
|
|
for (i in res)
|
|
console.log(result[i]);
|
|
},
|
|
function (error) {
|
|
console.log(error);
|
|
}
|
|
);
|