App to App: Design and Surface Local APIs

  • 2,150 views
Uploaded on

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
2,150
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
4
Comments
0
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. Ty Smith - @tylersmithnet Sr. Android Engineer, Evernote App to App: Design and Surface Local APIs Sunday, September 29, 13
  • 2. #EC2013 The S Note Story Sunday, September 29, 13
  • 3. #EC2013 The S Note Story Sunday, September 29, 13
  • 4. #EC2013 The S Note Story Sunday, September 29, 13
  • 5. #EC2013 The S Note Story Sunday, September 29, 13
  • 6. #EC2013 The S Note Story Sunday, September 29, 13
  • 7. #EC2013 The S Note Story Sunday, September 29, 13
  • 8. #EC2013 Web API vs Local API Sunday, September 29, 13
  • 9. #EC2013 Web API vs Local API Web API •Powerful •Flexible •Comfortable •Complex •Inconsistent data •Service limitations Local API •Immediate results •Managed complexity •Consistent data •Not as available •Too Simple Sunday, September 29, 13
  • 10. #EC2013 Web API vs Local API Web API •Powerful •Flexible •Comfortable •Complex •Inconsistent data •Service limitations Local API •Immediate results •Managed complexity •Consistent data •Not as available •Too Simple Sunday, September 29, 13
  • 11. #EC2013 Web API vs Local API Web API •Powerful •Flexible •Comfortable •Complex •Inconsistent data •Service limitations Local API •Immediate results •Managed complexity •Consistent data •Not as available •Too Simple Sunday, September 29, 13
  • 12. #EC2013 Web API vs Local API Web API •Powerful •Flexible •Comfortable •Complex •Inconsistent data •Service limitations Local API •Immediate results •Managed complexity •Consistent data •Not as available •Too Simple Sunday, September 29, 13
  • 13. #EC2013 Web API vs Local API Web API •Powerful •Flexible •Comfortable •Complex •Inconsistent data •Service limitations Local API •Immediate results •Managed complexity •Consistent data •Not as available •Too Simple Sunday, September 29, 13
  • 14. #EC2013 Web API vs Local API Web API •Powerful •Flexible •Comfortable •Complex •Inconsistent data •Service limitations Local API •Immediate results •Managed complexity •Consistent data •Not as available •Too Simple Sunday, September 29, 13
  • 15. #EC2013 What next? Sunday, September 29, 13
  • 16. #EC2013 What next? Sunday, September 29, 13
  • 17. #EC2013 Android Components Sunday, September 29, 13
  • 18. #EC2013 Android Components 1. Intents Sunday, September 29, 13
  • 19. #EC2013 Android Components 1. Intents 2. Content Provider Sunday, September 29, 13
  • 20. #EC2013 Android Components 1. Intents 2. Content Provider 3. Account Manager Sunday, September 29, 13
  • 21. #EC2013 Android Components 1. Intents 2. Content Provider 3. Account Manager 4. Sync Adapter Sunday, September 29, 13
  • 22. #EC2013 Android Components 1. Intents 2. Content Provider 3. Account Manager 4. Sync Adapter 5. Bound Service Sunday, September 29, 13
  • 23. #EC2013 Intents Sunday, September 29, 13
  • 24. #EC2013 Intents •Simple message between two components Sunday, September 29, 13
  • 25. #EC2013 Intents •Simple message between two components •Bundle - key/value data Sunday, September 29, 13
  • 26. #EC2013 Intents •Simple message between two components •Bundle - key/value data •Limited payload size (500k) Sunday, September 29, 13
  • 27. #EC2013 Intents •Simple message between two components •Bundle - key/value data •Limited payload size (500k) •Inefficient for batch operations Sunday, September 29, 13
  • 28. #EC2013 Intents •Simple message between two components •Bundle - key/value data •Limited payload size (500k) •Inefficient for batch operations •URI Support Sunday, September 29, 13
  • 29. #EC2013 Intents: Android Standards Sunday, September 29, 13
  • 30. #EC2013 Intents: Android Standards •Intent.ACTION_SEND Sunday, September 29, 13
  • 31. #EC2013 Intents: Android Standards •Intent.ACTION_SEND •Intent.EXTRA_STREAM Sunday, September 29, 13
  • 32. #EC2013 Intents: Android Standards •Intent.ACTION_SEND •Intent.EXTRA_STREAM •Intent.ACTION_VIEW Sunday, September 29, 13
  • 33. #EC2013 Intents: Android Standards •Intent.ACTION_SEND •Intent.EXTRA_STREAM •Intent.ACTION_VIEW •Intent.ACTION_EDIT Sunday, September 29, 13
  • 34. #EC2013 Intents: View And EDIT Sunday, September 29, 13
  • 35. #EC2013 Intents: View And EDIT •Set Action Sunday, September 29, 13
  • 36. #EC2013 Intents: View And EDIT •Set Action •Data URI Sunday, September 29, 13
  • 37. #EC2013 Intents: View And EDIT •Set Action •Data URI •MIME Type Sunday, September 29, 13
  • 38. #EC2013 Intents: View And EDIT •Set Action •Data URI •MIME Type •startActivity... ForResult() Sunday, September 29, 13
  • 39. #EC2013 Intents: View And EDIT •Set Action •Data URI •MIME Type •startActivity... ForResult() •onActivityResult() Sunday, September 29, 13
  • 40. #EC2013 Intents: Evernote CRUD gist.github.com/TylerSmithNet/6735496 Sunday, September 29, 13
  • 41. #EC2013 Intents: Evernote CRUD public static final String NOTE_PICKER = "com.evernote.action.NOTE_PICKER";   public static final String VIEW_NOTE = "com.evernote.action.VIEW_NOTE"; public static final String NEW_NOTE = "com.evernote.action.CREATE_NEW_NOTE";    public static final String EDIT_NOTE = "com.evernote.action.EDIT_NOTE";   public static final String UPDATE_NOTE = "com.evernote.action.UPDATE_NOTE";   public static final String DELETE_NOTE = "com.evernote.action.DELETE_NOTE"; gist.github.com/TylerSmithNet/6735496 Sunday, September 29, 13
  • 42. #EC2013 Intents: New Note Overview gist.github.com/TylerSmithNet/6735496 Sunday, September 29, 13
  • 43. #EC2013 Intents: New Note Overview gist.github.com/TylerSmithNet/6735496 Sunday, September 29, 13
  • 44. #EC2013 Intents: New Note Overview gist.github.com/TylerSmithNet/6735496 Sunday, September 29, 13
  • 45. #EC2013 Intents: New Note Overview gist.github.com/TylerSmithNet/6735496 Sunday, September 29, 13
  • 46. #EC2013 Intents: New Note Overview gist.github.com/TylerSmithNet/6735496 Sunday, September 29, 13
  • 47. #EC2013 Intents: New Note Overview gist.github.com/TylerSmithNet/6735496 Sunday, September 29, 13
  • 48. #EC2013 Intents: New Note Overview New Note Intent gist.github.com/TylerSmithNet/6735496 Sunday, September 29, 13
  • 49. #EC2013 Intents: New Note Overview New Note Intent gist.github.com/TylerSmithNet/6735496 Sunday, September 29, 13
  • 50. #EC2013 Intents: New Note Overview New Note Intent gist.github.com/TylerSmithNet/6735496 Sunday, September 29, 13
  • 51. #EC2013 Intents: New Note Overview New Note Intent onActivityResult() gist.github.com/TylerSmithNet/6735496 Sunday, September 29, 13
  • 52. #EC2013 Intents: Evernote New Note gist.github.com/TylerSmithNet/6735496 Sunday, September 29, 13
  • 53. #EC2013 Intents: Evernote New Note public static final String NEW_NOTE = "com.evernote.action.CREATE_NEW_NOTE"; public void newNoteWithContent(Uri image) {   String title = "Sample Title";   String text = "Sample description.";     Intent intent = new Intent();   intent.setAction(ACTION_NEW_NOTE);    // Set the note's title and plaintext content   intent.putExtra(Intent.EXTRA_TITLE, title);   intent.putExtra(Intent.EXTRA_TEXT, text); // Set the Data URI for the image intent.setData(image);   startActivityForResult(intent); } gist.github.com/TylerSmithNet/6735496 Sunday, September 29, 13
  • 54. #EC2013 Content Provider Sunday, September 29, 13
  • 55. #EC2013 Content Provider •A well defined database access layer Sunday, September 29, 13
  • 56. #EC2013 Content Provider •A well defined database access layer •SQLite Sunday, September 29, 13
  • 57. #EC2013 Content Provider •A well defined database access layer •SQLite •Interact with large volumes of data Sunday, September 29, 13
  • 58. #EC2013 Content Provider •A well defined database access layer •SQLite •Interact with large volumes of data •Authority Sunday, September 29, 13
  • 59. #EC2013 Content Provider •A well defined database access layer •SQLite •Interact with large volumes of data •Authority •Permissions Sunday, September 29, 13
  • 60. #EC2013 Content Provider: URI content:// com.example / notes / 1 Sunday, September 29, 13
  • 61. #EC2013 Content Provider: URI content:// com.example / notes / 1 Scheme Sunday, September 29, 13
  • 62. #EC2013 Content Provider: URI content:// com.example / notes / 1 Scheme Authority Sunday, September 29, 13
  • 63. #EC2013 Content Provider: URI content:// com.example / notes / 1 Scheme Authority Data Type Sunday, September 29, 13
  • 64. #EC2013 Content Provider: URI content:// com.example / notes / 1 Scheme Authority Data Type Id Sunday, September 29, 13
  • 65. #EC2013 Content Provider: Implementing Sunday, September 29, 13
  • 66. #EC2013 Content Provider: Implementing •Override Methods Sunday, September 29, 13
  • 67. #EC2013 Content Provider: Implementing •Override Methods •URI Matcher Sunday, September 29, 13
  • 68. #EC2013 Content Provider: Implementing •Override Methods •URI Matcher •Cursors Sunday, September 29, 13
  • 69. #EC2013 Content Provider: Implementing •Override Methods •URI Matcher •Cursors •File Handlers Sunday, September 29, 13
  • 70. #EC2013 Content Provider: Query Sunday, September 29, 13
  • 71. #EC2013 Content Provider: Query Uri authUri = Uri.parse("content://com.evernote.evernoteprovider");  Uri notesUri = Uri.withAppendedPath(authUri, "notes");   String[] projection = new String[]{"guid", "title"};   Cursor cursor = getContentResolver().query( notesUri, projection, null, null, null); Sunday, September 29, 13
  • 72. #EC2013 Account Manager Sunday, September 29, 13
  • 73. #EC2013 Account Manager •Accessible Account Sunday, September 29, 13
  • 74. #EC2013 Account Manager •Accessible Account •Third Party Auth Sunday, September 29, 13
  • 75. #EC2013 Account Manager •Accessible Account •Third Party Auth •Consistent Settings Sunday, September 29, 13
  • 76. #EC2013 Account Manager: OAuth Sunday, September 29, 13
  • 77. #EC2013 Account Manager: OAuth Sunday, September 29, 13
  • 78. #EC2013 Account Manager: OAuth Sunday, September 29, 13
  • 79. #EC2013 Account Manager: OAuth Sunday, September 29, 13
  • 80. #EC2013 Account Manager: OAuth Sunday, September 29, 13
  • 81. #EC2013 Account Manager: OAuth Sunday, September 29, 13
  • 82. #EC2013 Account Manager: OAuth getAuthToken(...) Sunday, September 29, 13
  • 83. #EC2013 Account Manager: OAuth getAuthToken(...) Sunday, September 29, 13
  • 84. #EC2013 Account Manager: OAuth getAuthToken(...) Sunday, September 29, 13
  • 85. #EC2013 Account Manager: OAuth getAuthToken(...) Future<Bundle> Sunday, September 29, 13
  • 86. #EC2013 Sync Adapter Sunday, September 29, 13
  • 87. #EC2013 Sync Adapter •Synchronizes App and Web Service Sunday, September 29, 13
  • 88. #EC2013 Sync Adapter •Synchronizes App and Web Service •Network/battery optimized syncing Sunday, September 29, 13
  • 89. #EC2013 Sync Adapter •Synchronizes App and Web Service •Network/battery optimized syncing •Provided to third party apps Sunday, September 29, 13
  • 90. #EC2013 Sync Adapter •Synchronizes App and Web Service •Network/battery optimized syncing •Provided to third party apps •Schedule and GCM Sunday, September 29, 13
  • 91. #EC2013 Sync Adapter: Caveats Sunday, September 29, 13
  • 92. #EC2013 Sync Adapter: Caveats •Requires Content Provider and Account Manager Sunday, September 29, 13
  • 93. #EC2013 Sync Adapter: Caveats •Sync every hour ContentResolver.addPeriodicSync(account, EvernoteContract.AUTHORITY, new Bundle(), 3600); •Requires Content Provider and Account Manager Sunday, September 29, 13
  • 94. #EC2013 Sync Adapter: Caveats •Sync every hour ContentResolver.addPeriodicSync(account, EvernoteContract.AUTHORITY, new Bundle(), 3600); •Requires Content Provider and Account Manager Sunday, September 29, 13
  • 95. #EC2013 Sync Adapter: Caveats •Sync every hour ContentResolver.addPeriodicSync(account, EvernoteContract.AUTHORITY, new Bundle(), 3600); •Sync with Jitter int jitter = new Random().nextInt(300); ContentResolver.addPeriodicSync(account, EvernoteContract.AUTHORITY, new Bundle(), 3600+jitter); •Requires Content Provider and Account Manager Sunday, September 29, 13
  • 96. #EC2013 Bound Service Sunday, September 29, 13
  • 97. #EC2013 Bound Service •Android Interface Definition Language (AIDL) Sunday, September 29, 13
  • 98. #EC2013 Bound Service •Android Interface Definition Language (AIDL) •Directly call defined methods Sunday, September 29, 13
  • 99. #EC2013 Bound Service •Android Interface Definition Language (AIDL) •Directly call defined methods •Communicate between process or app Sunday, September 29, 13
  • 100. #EC2013 Bound Service •Android Interface Definition Language (AIDL) •Directly call defined methods •Communicate between process or app •Requires consumer to contain interface Sunday, September 29, 13
  • 101. #EC2013 Bound Service: Evernote and Dashclock github.com/TylerSmithNet/EvernoteReminderDashclock Sunday, September 29, 13
  • 102. #EC2013 Bound Service: Evernote and Dashclock •Implements Dashclock jar (AIDL) github.com/TylerSmithNet/EvernoteReminderDashclock Sunday, September 29, 13
  • 103. #EC2013 Bound Service: Evernote and Dashclock •Implements Dashclock jar (AIDL) •Queries Evernote Content Provider github.com/TylerSmithNet/EvernoteReminderDashclock Sunday, September 29, 13
  • 104. #EC2013 Bound Service: Evernote and Dashclock •Implements Dashclock jar (AIDL) •Queries Evernote Content Provider •Note list intent for clicks github.com/TylerSmithNet/EvernoteReminderDashclock Sunday, September 29, 13
  • 105. #EC2013 Bound Service: Evernote and Dashclock •Implements Dashclock jar (AIDL) •Queries Evernote Content Provider •Note list intent for clicks •Open Source github.com/TylerSmithNet/EvernoteReminderDashclock Sunday, September 29, 13
  • 106. #EC2013 Wrap up Sunday, September 29, 13
  • 107. #EC2013 Wrap up •Let the system do the work Sunday, September 29, 13
  • 108. #EC2013 Wrap up •Let the system do the work •Base API design choice on user stories Sunday, September 29, 13
  • 109. #EC2013 Wrap up •Let the system do the work •Base API design choice on user stories •Give the user the best experience Sunday, September 29, 13
  • 110. Ty Smith Evernote @tylersmithnet Thanks, Questions? dev.evernote.com Sunday, September 29, 13