4. Google NYC 20% project,
2 people, from early 2007
Born as part of PrintAds
Released as ZXing
open source project
Just a demo app for
cameraAPI in Android 1.0
5. CameraAPI
Preview, SurfaceView
Focus, zoom, etc.
Fast image processing
Read/write contacts, bookmarks
Wi-fi configuration …
Intents
Web – App integration
6. < 1 person project
10.3M installs, 6M active
Growing ~33K per day
#8 Android Market app
Powers (directly or indirectly) most
barcode apps for iPhone, Android and RIM
…
1 rating :
~100 installs
7. Makes Barcode Scanner a dependency
Dependency drives downloads!
11. static final int DO_IT_RESULT = 0xDEADBEEF;
Intent doIt =
new Intent(“com.myapp.DO_IT”);
doIt.addCategory(Intent.CATEGORY_DEFAULT);
doIt.putExtra(“ARG1”, arg1);
startActivityForResult(doIt, DO_IT_RESULT);
12. public void onResume() {
Intent intent = getIntent();
String action = intent.getAction();
if (“com.myapp.DO_IT”.equals(action))) {
String arg1 =
intent.getStringExtra(“ARG1”);
// Do that something
...
}
...
}
13. Intent reply = new Intent(action);
// Put result values as Intent “extras”
reply.putExtra(“RES1”, res1);
reply.putExtra(“RES2”, res2);
setResult(RESULT_OK, reply);
finish();
14. public void onActivityResult(
int request, int result, Intent reply) {
if (request == DO_IT_REQUEST &&
result == RESULT_OK) {
String res1 = reply.getExtra(“RES1”);
String res2 = reply.getExtra(“RES2”);
// Process result
...
}
}
16. startActivityForResult(...);
} catch (ActivityNotFoundException anfe) {
// Prompt user with AlertDialog
// If user clicks “Yes”:
Uri uri = Uri.parse(
"market://search?q=pname:com.myapp");
Intent intent =
new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
20. public void onResume() {
Intent intent = getIntent();
String ds = intent.getDataString();
if (ds.startsWith(
“http://myapp.com/doIt”) {
Uri uri = Uri.parse(ds);
String arg1 =
uri.getQueryParameter(“ARG1”);
// Do that something
}
...
}
21. Uri uri = Uri.parse(
“http://myapp.com/doneIt?RES1=res”);
Intent reply = new Intent(
Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(reply);
finish();
23. Exposing an API can “leak” permissions
Example: App which retrieves contacts via Intent
Then any app can read contacts
(without Android permission)!
Think about abuses
Is API consistent with users’
permission expectations?
24.
25. Can’t open source? Open an API
API doesn’t have to mean free
“Open” looks good and is good
If you don’t, someone will
1
26. Think platform, not just app
Platforms get preinstalled
Platforms are hard to uninstall
Foothold for other services
2
27. Drive downloads – and hence users
Download is most of the battle
Users try what’s on the phone
Users stick with what they know
3