Your SlideShare is downloading. ×
0
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
R.A.P. (Rely on Android Platform)
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

R.A.P. (Rely on Android Platform)

766

Published on

Slides for droidcon spain 2014.

Slides for droidcon spain 2014.

Published in: Technology
1 Comment
0 Likes
Statistics
Notes
  • Be the first to like this

No Downloads
Views
Total Views
766
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
6
Comments
1
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. R.A.P. Rely on Android Platform
  • 2. DISCLAIMER
  • 3. @ibai_iturricha ● NFC ● Android ● Django CTO en Aditium
  • 4. Why should I RAP?
  • 5. My app … manages user accounts loads/pulls data from/to server works without connection and ...
  • 6. I want to be a winner!
  • 7. Decouple authentication from business logic
  • 8. Isolate synchronization strategy
  • 9. Offline first
  • 10. Modular UI Components
  • 11. http://rapgenius.com/discussions/12681-New-version-of-the-last-supper Time to RAP homies!
  • 12. Android Platform crew Account Manager manages user credentials Sync Manager keeps data up to date Content Provider stores structured data Loaders make data available
  • 13. Account Manager “Account Manager provides access to a centralized registry of the user's online accounts” Android developers
  • 14. Android Platform Account Manager Your App Service AbstractAccountAuthenticator AccountAuthenticatorActivity
  • 15. Android Platform Account Manager Your App Service AbstractAccountAuthenticator AccountAuthenticatorActivity Your app Add account Get auhtToken Delete account
  • 16. AbstractAccountAuthenticator
  • 17. Sync Manager/Adapter “The ability of the system to help you synchronize remote and local content” Virgil Dobjanschi (Google IO 201)
  • 18. App 1 App 2 App 3 App 4 Perform a sync → Network request, parceling, DB operations, etc...
  • 19. Sepherd wanted!
  • 20. Sync Manager Framework App 1 App 2 App 3 App 4 App 1 App 3 App 4 App 2
  • 21. Android Platform Sync Manager Your App Service AbstractThreadedSyncAdapter
  • 22. Synchronization Strategy Selection ● On demand ○ E.g. User press button ‘refresh’ ● Regular interval ○ E.g. Each hour ● When network connection available ○ E.g. Sync automatically when connected ● When device data changes ○ E.g. Every time my database changes ● When server data changes ○ E.g. Every push message received
  • 23. Android Platform Sync Manager Your App Service AbstractThreadedSyncAdapter Your app PerformSync On demand example
  • 24. Android Platform Sync Manager Your App Service AbstractThreadedSyncAdapter Your app PerformSync Server push sync Your server
  • 25. AbstractThreadedSyncAdapter
  • 26. Content provider “Content providers manage access to a structured set of data” Android developers
  • 27. Android Platform Content Resolver Your App ContentProvider SQLiteOpenHelper SQLite
  • 28. Android Platform Content Resolver Your App ContentProvider SQLiteOpenHelper SQLite Your app Query Insert Delete Update Bulk
  • 29. ContentProvider
  • 30. SQLiteOpenHelper
  • 31. Loaders “Loaders make it easy to asynchronously load data in an activity or fragment” Android developers
  • 32. Android Platform Loader Manager Your App ContentProvider SQLiteOpenHelper SQLite Fragment | Activity implements LoaderCallbacks<Cursor> Query
  • 33. UI thread Background thread 1. getLoaderManager().initLoader(...) 2. onCreateLoader(...) query specific code 4. onLoadFinished(...) swap adapter 3. Execute query on DB
  • 34. LoaderManager.LoaderCallbacks<Cursor>
  • 35. Conclusion
  • 36. Your app Account Provider Sync Model Android Platform Activities & Fragments & Loaders
  • 37. Demo time
  • 38. Server side PLAIN API POST api/v1/account/new/ Creates new account and returns auth_token POST api/v1/account/login/ Validates username & password tuple and returns auth_token AUTHORIZED API GET api/v1/spots/ Returns spots on the database → auth_token → position → limit

×