Slide 1

Slide 1 text

GDG DevFest @ Kathmandu, Nepal

Slide 2

Slide 2 text

Latest & Interesting updates #AndroidDev @pareshmayani

Slide 3

Slide 3 text

Paresh Mayani Android Developer Manager, GDG Ahmedabad

Slide 4

Slide 4 text

Interesting updates - #AndroidDev • Android Studio • Gradle Build System • Volley Library • Google Maps Android API v2 • Staged rollouts • Alpha and Beta Testing • Optimization Tips • App Translation Service @pareshmayani

Slide 5

Slide 5 text

Android Studio @pareshmayani

Slide 6

Slide 6 text

Android Studio • Android focused IDE (designed specifically for Android development) • New Android development environment based on IntelliJ IDEA • Similar to Eclipse with the ADT Plug-in • Contains All the Android SDK Tools to design, test, debug, and profile your app @pareshmayani

Slide 7

Slide 7 text

Gradle Build System @pareshmayani

Slide 8

Slide 8 text

Gradle Build System • Gradle is an advanced build management system based on Groovy • Its an Open source build system • Combines the power of Ant and Maven @pareshmayani

Slide 9

Slide 9 text

Features of Gradle build system • Dependency Management (Flexible approach to dependency management that can reuse existing maven repositories or reference local JARs) @pareshmayani

Slide 10

Slide 10 text

Features of Gradle build system • Dependency Management (Flexible approach to dependency management that can reuse existing maven repositories or reference local JARs) • A single build system (Gradle is the authoritative build across the IDE and the command-line.) @pareshmayani

Slide 11

Slide 11 text

Features of Gradle build system • Dependency Management (Flexible approach to dependency management that can reuse existing maven repositories or reference local JARs) • A single build system (Gradle is the authoritative build across the IDE and the command-line.) • Product Flavors (Free & Paid version), Build Variants (Play store OR Amazon OR Any other store), Build Type (Debug, QA, Release) @pareshmayani

Slide 12

Slide 12 text

Features of Gradle build system • Dependency Management (Flexible approach to dependency management that can reuse existing maven repositories or reference local JARs) • A single build system (Gradle is the authoritative build across the IDE and the command-line.) • Product Flavors (Free & Paid version), Build Variants (Play store OR Amazon OR Any other store), Build Type (Debug, QA, Release) • Binary Bundles for Libaries (.aar) (Gradle supports the new .aar binary bundle format for the library projects) @pareshmayani

Slide 13

Slide 13 text

Volley – “the simultaneous firing of a number of missiles” @pareshmayani

Slide 14

Slide 14 text

Android – Volley library “Volley is a library that makes networking for Android apps easier and most importantly, faster.” @pareshmayani

Slide 15

Slide 15 text

Advantages of using Volley Library • Volley automatically schedule all network requests. Volley will be taking care of all the network requests your app executes for fetching response or image from web. • Volley provides powerful customization abilities. • Volley provides Debugging and tracing tools. • Volley provides powerful cancellation request API. - You can cancel a single request or - You can set blocks or scopes of requests to cancel. @pareshmayani

Slide 16

Slide 16 text

How to get started? 1. Clone the Volley project 2. Import the code into your project @pareshmayani

Slide 17

Slide 17 text

Clone the Volley Project git clone https://android.googlesource.com/platform/frameworks/volley @pareshmayani

Slide 18

Slide 18 text

2 Main classes of Volley Library 2 main classes Request queue It is the interest you use for dispatching requests to the network It contains all the necessary details for making web API call Request @pareshmayani

Slide 19

Slide 19 text

Take a look at JsonObjectRequest JsonObjectRequest ObjJsonRequest = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener() { @Override public void onResponse(JSONObject response) { // Successful response } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { // Failure response } }); @pareshmayani

Slide 20

Slide 20 text

Basic Example import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.JsonObjectRequest; import com.android.volley.toolbox.Volley; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { …… …... RequestQueue queue = Volley.newRequestQueue(this); String url = “Web API URL”; // Prepare JSON Object request queue.add(ObjJsonRequest ); } @pareshmayani

Slide 21

Slide 21 text

Google Maps API v2 @pareshmayani

Slide 22

Slide 22 text

Google Maps Android API v2 • With v2 of Maps Android API, you can embed maps into an activity as a fragment @pareshmayani

Slide 23

Slide 23 text

Google Maps Android API v2 • With v2 of Maps Android API, you can embed maps into an activity as a fragment • The API is now distributed as part of the Google Play services SDK @pareshmayani

Slide 24

Slide 24 text

Google Maps Android API v2 • With v2 of Maps Android API, you can embed maps into an activity as a fragment • The API is now distributed as part of the Google Play services SDK • Maps are now 3D @pareshmayani

Slide 25

Slide 25 text

Google Maps Android API v2 • With v2 of Maps Android API, you can embed maps into an activity as a fragment • The API is now distributed as part of the Google Play services SDK • Maps are now 3D • The Maps API now uses vector tiles. Their data representation is smaller, so maps appear in your apps faster, and use less bandwidth. @pareshmayani

Slide 26

Slide 26 text

Google Maps Android API v2 • With v2 of Maps Android API, you can embed maps into an activity as a fragment • The API is now distributed as part of the Google Play services SDK • Maps are now 3D • The Maps API now uses vector tiles. Their data representation is smaller, so maps appear in your apps faster, and use less bandwidth. • Caching is improved @pareshmayani

Slide 27

Slide 27 text

Getting started with Map API v2 Step - 1 Install and Set up the Google Play Service SDK @pareshmayani

Slide 28

Slide 28 text

Getting started with Map API v2 Step - 2 Run the sample Once you've installed the Google Play services package, the Google Maps sample is located in /extras/google-play-services/samples/maps @pareshmayani

Slide 29

Slide 29 text

Basic example public class BasicMapActivity extends FragmentActivity { /** * Note that this may be null if the Google Play services APK is not available. */ private GoogleMap mMap; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.basic_demo); mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)) .getMap(); } @pareshmayani

Slide 30

Slide 30 text

Placing Marker // latitude and longitude double latitude = ; double longitude = ; // create marker MarkerOptions marker = new MarkerOptions().position(new LatLng(latitude, longitude)).title(“Hello World!"); // adding marker googleMap.addMarker(marker); @pareshmayani

Slide 31

Slide 31 text

Placing Marker private static final LatLng AHMEDABAD= new LatLng(23.0300, 72.5800); // Uses a colored icon. Marker mBrisbane = mMap.addMarker(new MarkerOptions() .position(AHMEDABAD) .title(“Ahmedabad") .snippet("Population: 5.571 million ") .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE))); // Uses a custom icon. Marker mSydney = mMap.addMarker(new MarkerOptions() .position(AHMEDABAD) .title(“Ahmedabad") .snippet("Population: 5.571 million ") .icon(BitmapDescriptorFactory.fromResource(R.drawable.arrow))); // Creates a draggable marker. Long press to drag. Marker mMelbourne = mMap.addMarker(new MarkerOptions() .position(AHMEDABAD) .title(“Ahmedabad") .snippet("Population: 5.571 million ") .draggable(true)); @pareshmayani

Slide 32

Slide 32 text

Staged Rollouts @pareshmayani

Slide 33

Slide 33 text

Staged Rollouts • With a staged rollout, you can publish your app to a certain percentage of the market first to make sure that your app works properly before rolling it out to everybody. • Users receiving the staged rollout can leave public reviews in Google Play. @pareshmayani

Slide 34

Slide 34 text

Staged Rollouts Step - 1 Publish APK as staged rollout @pareshmayani

Slide 35

Slide 35 text

Staged Rollouts Step - 2 Publish app to certain percentage @pareshmayani

Slide 36

Slide 36 text

Alpha and Beta Testing @pareshmayani

Slide 37

Slide 37 text

Alpha and Beta Testing • Google Play Developer console allows you to test two different version of your app at the same time in addition to your production version. • It’s FREE • Testing by real users before app goes live @pareshmayani

Slide 38

Slide 38 text

Alpha and Beta Testing Step - 1 Upload new APK to Beta/Alpha @pareshmayani

Slide 39

Slide 39 text

Alpha and Beta Testing Step - 2 Publish now to Beta/Alpha @pareshmayani

Slide 40

Slide 40 text

Alpha and Beta Testing Step - 3 Selecting groups of testers @pareshmayani

Slide 41

Slide 41 text

Alpha and Beta Testing Move to Alpha/Beta/Production @pareshmayani

Slide 42

Slide 42 text

Google Play Services Optimization Tips @pareshmayani

Slide 43

Slide 43 text

Optimization Tips @pareshmayani

Slide 44

Slide 44 text

Optimization Tips @pareshmayani

Slide 45

Slide 45 text

App Translation Service @pareshmayani

Slide 46

Slide 46 text

App Translation Service • Google Play can help you quickly find and purchase translations of your app. • In the Developer Console, you can browse a list of third- party vendors who are pre-qualified by Google to offer high- quality translation at competitive prices. Steps: 1. Upload the strings you want translated, select the languages you want to translate into. 2. Select your translation vendor based on time and price. @pareshmayani

Slide 47

Slide 47 text

Links 1. https://github.com/PareshMayani/Android-Volley-Example 2. https://developers.google.com/maps/documentation/andro id/ 3. http://developer.android.com/distribute/googleplay/publish /localizing.html#gp-trans @pareshmayani

Slide 48

Slide 48 text

Paresh Mayani Manager, GDG Ahmedabad Android Developer [email protected] @pareshmayani < Stay in Touch >