mDevCamp - The Best from Google IO
Upcoming SlideShare
Loading in...5
×
 

mDevCamp - The Best from Google IO

on

  • 592 views

 

Statistics

Views

Total Views
592
Views on SlideShare
592
Embed Views
0

Actions

Likes
0
Downloads
8
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    mDevCamp - The Best from Google IO mDevCamp - The Best from Google IO Presentation Transcript

    • The Best from Google IOOndra Zahradník@ondrazMonday, May 27, 13
    • Agenda• Gradle• Volley• Mobile Backend Starter• Location• Activity Recognition• Games• Google Play Console etc.Monday, May 27, 13
    • Gradle• Dependency mgmt.• Library support• Reuse of code and resources• Build variants• Testing, CI, SCM automation• Use Gradle 1.6 and android plugin 0.4!• Android Studio integrationMonday, May 27, 13
    • Monday, May 27, 13
    • Gradle Build Script//configuration for gradle buildbuildscript {repositories {maven { url http://repo1.maven.org/maven2 }}dependencies {classpath com.android.tools.build:gradle:0.4}}//gradle android pluginapply plugin: android//android DSLandroid {compileSdkVersion 17buildToolsVersion "17.0.0"}Monday, May 27, 13
    • Gradle BuildType• Defines how app is build• Signing, proguard on/off, zipalign• Package name suffixsigningConfigs {inmite {storeFile file("inmite.keystore")keyAlias "inmite_android"}}buildTypes {debug {packageNameSuffix ".debug"versionNameSuffix "-debug"}release {signingConfig signingConfigs.inmite}}Monday, May 27, 13
    • Gradle - Variants• Free vs. Paid• Multi-apk support• Different runtimes,...• Flavors = productFlavors• Multi-flavor variants = flavorGroupsMonday, May 27, 13
    • Gradle Project Structure/src/main/java/eu/inmite.gradle.example/res/drawables/values...AndroidManifest.xml/resources/paid/java.../src/instrumentTestMonday, May 27, 13
    • Gradle Libraries• binary .aar package in existing repos• supports proguard• custom lint rules come later//dependence on an external jar library//configurations - compile, instrumentTestCompile// debugCompile, releaseCompiledependencies {compile files(libs/android-support-v4.jar)compile com.google.guava:guava:14.0.1}Monday, May 27, 13
    • Gradle Tasks• assemble• assembleDebug• assembleRelease• check• deviceCheck• build• cleanMonday, May 27, 13
    • Volley• Typical catches• single-thread• screen rotations = reloading• not using recycled views• Apache HTTP vs. URLConnectionMonday, May 27, 13
    • Volley• Yet another networking library?• 4 threads in background, prioritization• mem/disk cache• request cancellation• !NetworkImageView!• Network layers - OkHttp, URLConnection,ApacheHttp, SPDY,...Monday, May 27, 13
    • Volley - RequestmRequestQueue = ((Application) getApplication()).getRequestQueue();mImageLoader = new ImageLoader(mRequestQueue, new BitmapLRUCache());mRequestQueue.add(new JsonObjectRequest("https://dl.dropboxusercontent.com/u/5296640/a.json",null,new Response.Listener<JSONObject>() {@Overridepublic void onResponse(JSONObject jsonObject) {try {final JSONArray urls = (JSONArray) jsonObject.getJSONArray("images");final String[] data = new String[urls.length()];for (int i = 0; i < urls.length(); i++) {data[i] = urls.getString(i);}mImageAdapter = new ImageAdapter(data);setListAdapter(mImageAdapter);} catch (JSONException e) {Toast.makeText(..., getString(R.string.parse_error), ...).show();}}},null));Monday, May 27, 13
    • Volley - NetworkImageView@Overridepublic View getView(int i, View view, ViewGroup viewGroup) {...final ViewHolder vh = (ViewHolder) view.getTag();vh.iv.setImageUrl(data[i], mImageLoader);return view;}private class ViewHolder {NetworkImageView iv;}Monday, May 27, 13
    • Mobile Backend Starter• No code backend• Google auth built in• Google Cloud Messaging• Continuous queriesMonday, May 27, 13
    • Beyond the Blue Dot• Contextual apps• Fused location provider = sensors in play• ListenersmLocationClient = new LocationClient(this, this, this);mLocationClient.connect();Location location = mLocationClient.getLastLocation();LocationRequest mLocationRequest = LocationRequest.create().setInterval(5000).setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);mLocationClient.requestLocationUpdates(mLocationRequest,mLocationListener);Monday, May 27, 13
    • Beyond the Blue Dot• PendingIntentmLocationClient = new LocationClient(this, this, this);mLocationClient.connect();LocationRequest mLocationRequest = LocationRequest.create().setInterval(5000).setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);PendingIntent pi = PendingIntent.getService(this, 0,new Intent("com.example.location"), 0);mLocationClient.requestLocationUpdates(mLocationRequest, pi);Monday, May 27, 13
    • GeofencingMonday, May 27, 13
    • GeofencingPendingIntent 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() {@Overridepublic 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
    • Activity Recognition• Riding, walking, cycling, still, tilting// Connect to the ActivityRecognitionServiceActivityRecognitionClient 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
    • Game APIMonday, May 27, 13
    • Game API• G+ SSOMonday, May 27, 13
    • Game API• G+ SSO• AchievementsMonday, May 27, 13
    • Game API• G+ SSO• Achievements• LeaderboardsMonday, May 27, 13
    • Game API• G+ SSO• Achievements• Leaderboards• Cloud SaveMonday, May 27, 13
    • Game API• G+ SSO• Achievements• Leaderboards• Cloud Save• MultiplayerMonday, May 27, 13
    • Game API• G+ SSO• Achievements• Leaderboards• Cloud Save• Multiplayer• Works on Android, iOS, Web (except multi)Monday, May 27, 13
    • Game API• G+ SSO• Achievements• Leaderboards• Cloud Save• Multiplayer• Works on Android, iOS, Web (except multi)• Quota 20mil req/day and 5req/sec/userMonday, May 27, 13
    • Google Play ConsoleMonday, May 27, 13
    • Google Play ConsoleMonday, May 27, 13
    • Google Play ConsoleMonday, May 27, 13
    • Google Play ConsoleMonday, May 27, 13
    • Etc.• In-app Purchase• Simpler API for Google Cloud Messaging• Cloud Connection Server = XMPP• Synchronized notifications• Google Play for EducationMonday, May 27, 13
    • Thank You!@ondrazMonday, May 27, 13