Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Testing and securing android studio applications

You're reading from  Testing and securing android studio applications

Product type Book
Published in Aug 2014
Publisher Packt
ISBN-13 9781783988808
Pages 162 pages
Edition 1st Edition
Languages

AccountManager


The AccountManager class provides access to all the registered users' online accounts. This way, the user only needs to provide his/her credentials once for each account and then he/she can grant access to these applications in a simpler way. Using the AccountManager class, you can get a token that can be used as a form of authentication in different services.

The steps that you need to take in order to make use of this feature are as follows:

  1. First, you need to modify the manifest file and add permission to use credentials:

    <uses-permission 
      android:name="android.permission.USE_CREDENTIALS">
    </uses-permission>
  2. Once your application can use credentials, you can get an instance of AccountManager using the get(Context c) method:

    AccountManager am = AccountManager.get(this);
  3. Now, you have an instance of AccountManager, but you need to know which accounts are available. To do this, you can use the getAccountsByType(String s) method. The String parameter is the name of...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}