android accounts & sync

Post on 15-Aug-2015

20 Views

Category:

Mobile

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Przemek JakubczykSenior Android Developer

www.applause.com

Android Accounts & Sync

Why ?

● Storing credentials is problem for nearly every app

● Inventing another wheel?

● It’s simple, it’s easy

What do we have?

● File System

● Shared Preferences

● Database

● Account Manager

File System

● User credentials are stored in a simple file

● Requires boilerplate code for handling FS

● File format

Shared Preferences

● Easy API

● Fast

Database

● Big deal to store two values

● Usually the table has only one row

● Useful when DB queries requires a user

Account Manager

● Higher initial cost

● It’s recommended by Google

● Perfect place to share user credentials

● Authenticator provider

Sync service :)

What about security?

Sandbox System storage

File System

Shared Preferences

Database

Account Manager

Root meWarn user about possible security issues

EncryptionRequire encrypted File System

Let’s sync

● Most apps fetch data from servers

● Can’t block UI

● Triggered periodically

Sync Adapter

● Triggered by Android Service

ContentResolver.addPeriodicSync()

● Implicit and/or periodic run

ContentResolver.requestSync()

● If required can work as a separate process

<service android:process=":sync"/>

Authentication

● Perfect solution for application which share credentials:

- Enterprise

- Products of the same company

● Android proxies queries for authorization (package name)

● Sharing same certificates along apps allow access to credentials “Just Like

That”

Stop talkingKeep coding!

https://github.com/pjakubczyk/AndroidSyncAndAccounts

top related