19. Geofencing
PendingIntent pi = PendingIntent.getService(
this, 0, new Intent("com.example.location"), 0);
Geofence geofence = new Geofence.Builder()
.setRequestId("id")
.setTransitionTypes(Geofence.GEOFENCE_TRANSITION_ENTER)
.setCircularRegion(10,10,10)
.setExpirationDuration(1000).build();
final List<Geofence> gfcs = new ArrayList<Geofence>();
gfcs.add(geofence);
mLocationClient.addGeofences(gfcs, pi,
new LocationClient.OnAddGeofencesResultListener() {
@Override
public void onAddGeofencesResult(int i, String[] strings) {
if (i != LocationStatusCodes.SUCCESS) {
Toast.makeText(
MyActivity.this,
"Cannot add geofences",
Toast.LENGTH_SHORT).show();
}
}
});
Monday, May 27, 13
20. Activity Recognition
• Riding, walking, cycling, still, tilting
// Connect to the ActivityRecognitionService
ActivityRecognitionClient mActivityRecognitionClient =
new ActivityRecognitionClient(this, this, this);
mActivityRecognitionClient.connect();
// Called when a connection to the ActivityRecognitionService
//has been established.
public void onConnected(Bundle connectionHint) {
Intent intent = new Intent(this, MyIntentService.class);
PendingIntent callbackIntent =
PendingIntent.getService(
this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
mActivityRecognitionClient.requestActivityUpdates(
30000, callbackIntent);
}
Monday, May 27, 13
24. Game API
• G+ SSO
• Achievements
• Leaderboards
Monday, May 27, 13
25. Game API
• G+ SSO
• Achievements
• Leaderboards
• Cloud Save
Monday, May 27, 13
26. Game API
• G+ SSO
• Achievements
• Leaderboards
• Cloud Save
• Multiplayer
Monday, May 27, 13
27. Game API
• G+ SSO
• Achievements
• Leaderboards
• Cloud Save
• Multiplayer
• Works on Android, iOS, Web (except multi)
Monday, May 27, 13
28. Game API
• G+ SSO
• Achievements
• Leaderboards
• Cloud Save
• Multiplayer
• Works on Android, iOS, Web (except multi)
• Quota 20mil req/day and 5req/sec/user
Monday, May 27, 13
33. Etc.
• In-app Purchase
• Simpler API for Google Cloud Messaging
• Cloud Connection Server = XMPP
• Synchronized notifications
• Google Play for Education
Monday, May 27, 13