Giter Site home page Giter Site logo

d0b1010r / cordova-android-accountmanager Goto Github PK

View Code? Open in Web Editor NEW

This project forked from spideroak/cordova-android-accountmanager

0.0 1.0 0.0 205 KB

Cordova Android AccountManager plugin

License: BSD 3-Clause "New" or "Revised" License

JavaScript 22.37% Shell 14.64% Java 62.99%

cordova-android-accountmanager's Introduction

cordova-android-accountmanager

Introduction

cordova-android-accountmanager is an Android AccountManager plugin for cordova-android.

It currently only supports explicit account handling (programatically adding/removing/settin/getting account details to the AccountManager).

Basic Usage (Explicit account handling)

var am = window.plugins.accountmanager;

// Add account explicitly
am.addAccountExplicitly('MyAccountType', 'bob', 'passwordbob', null, function(error, bob)
{
	// bob.name = 'bob'
	// bob.type = 'MyAccountType'

	// List all accounts of MyAccountType
	am.getAccountsByType('MyAccountType', function(error, accounts)
	{
		accounts.forEach(function(account)
		{
			console.log('Account: ' + JSON.stringify(account));
		});
	});

	// Get password
	am.getPassword(bob, function(error, password)
	{
		console.log("Bob's password: " + password);
	});

	// Get/Set user data
	am.setUserData(bob, 'age', 30);
	am.getUserData(bob, 'age', function(error, age)
	{
		console.log('Bob is ' + age + 'years old');
	});

	// Remove account
	am.removeAccount(bob);
});

Basic Usage (Authenticator based handling)

Not yet supported.

Project Setup

Installation

  1. Copy (or link) all the .java files into your project src (under the appropriate com.polychrom.cordova package).
  2. Copy accountmanager.js into your cordova app's www directory
  3. Add <script charset="utf-8" src="accountmanager.js"></script> to your cordova app's HTML.
  4. Copy (or link) authenticator.xml to your project's res/xml/ folder.

Authenticator Service

To register the AuthenticatorService with your application, the following will need to be added to your manifest's application element:

<!-- The authenticator service -->
<service android:name="com.polychrom.cordova.AuthenticatorService" android:exported="false">
	<intent-filter>
		<action android:name="android.accounts.AccountAuthenticator" />
	</intent-filter>
	<meta-data android:name="android.accounts.AccountAuthenticator" android:resource="@xml/authenticator" />
</service>

Permissions

Depending on the level of usage, the following permissions may be required by the plugin for correct usage:

See the AccountManager documentation for specific requirements for each function.

cordova-android-accountmanager's People

Contributors

mwheeler avatar devgeeks avatar

Watchers

David Klötzer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.