Wednesday, December 30, 2015

Get ready for Javascript “Promises” with Google and Udacity

Sarah Clark, Program Manager, Google Developer Training

Front-end web developers face challenges when using common “asynchronous” requests. These requests, such as fetching a URL or reading a file, often lead to complicated code, especially when performing multiple actions in a row. How can we make this easier for developers?

Javascript Promises are a new tool that simplifies asynchronous code, converting a tangle of callbacks and event handlers into simple, straightforward code such as: fetch(url).then(decodeJSON).then(addToPage)...

Promises are used by many new web standards, including Service Worker, the Fetch API, Quota Management, Font Load Events,Web MIDI, and Streams.


We’ve just opened up a online course on Promises, built in collaboration with Udacity. This brief course, which you can finish in about a day, walks you through building an “Exoplanet Explorer” app that reads and displays live data using Promises. You’ll also learn to use the Fetch API and finally kiss XMLHttpRequest goodbye!

This short course is a prerequisite for most of the Senior Web Developer Nanodegree. Whether you are in the paid Nanodegree program or taking the course for free, won’t you come learn to make your code simpler and more reliable today?

Friday, December 18, 2015

Google Play Services 8.4 SDK is available

Posted by Laurence Moroney, Developer Advocate

We’re delighted to announce the availability of Google Play services 8.4. There’s a lot of new information to share with you about what’s available to you in this release.



Custom Email App Invites

App Invites is a technology that enables your users to share apps with people they know. In Google Play services 8.4 we’ve updated this to make it easier for them to share via email. Before this you could create a custom email that contained user defined text and an image, but now we’re allowing you to add content from the app directly into the message. It allows you to fully define the email body using HTML, and set the email subject line. So, for example, if you have a favorite cooking app that you want to share with your friends, your invite to use the app can include a favorite recipe from the app. They get the immediate benefit of being able to access the desired content, giving them a more informed choice about whether or not they decide to install the app to get richer and more content. Check out the App Invites sample on GitHub here.

Predicting User spend and churn in games

The Play Games Analytics developer experience is designed to enable game developers to better understand, manage, and optimize game experiences throughout the player lifecycle. With this in mind, we’ve extended the Player Stats API to help you better understand your players behavior, and based on this, entice them to stay in your game.

The churn prediction method will return data on the probability that the player will churn, i.e., stop playing the game. You can create content in response to this to entice them to stay in your game.

Additionally, the spend prediction method will return the probability that the player will spend something in the game. It’s up to you how to handle this data, but -- for example -- if there’s a low probability that the player will spend something, you could provide discounted in-app purchases or show ads.

Fused Location Provider Updates

The Fused Location Provider (FLP) in Google Play services provides location to your apps using a number of sensors, including GPS, WiFi and Cell Towers.

When desiring to save battery power, and using coarse updates, the FLP doesn’t use Global Positioning Services (GPS), and instead uses WiFi and Cell tower signals. In Google Play services 8.4, we have greatly improved how the FLP detects location from cell towers. Prior to this, we would get the location information relative to only the primary cell tower. Now, the FLP takes the primary tower and other towers nearby to provide a more accurate location. We’ve also improved location detection from WiFi access points, particularly in areas where GPS is not available -- such as indoors.

Maps API Improvements

Have you ever wished you could easily handle a tap on a suburb without having to add another layer on the map to intercept the taps? We’ve added an onClickListener for polygons, so you can easily add transparent polygons and intercept the taps directly. We’ve also added on click listeners to polylines and ground overlays.

Here’s how you can use a listener to detect a click on a polygon:

 map.setOnPolygonClickListener(new GoogleMap.OnPolygonClickListener() {  
       @Override  
       public void onPolygonClick(Polygon polygon) {  
        ...  
       }  
     });  

Info windows now also offer an OnInfoWindowCloseListener and an OnInfoWindowLongClickListener. The on close listener is particularly useful if you wish to zoom back out on the map after the user has looked at the detail associated with a particular marker.

 mMap.setOnInfoWindowCloseListener(new GoogleMap.OnInfoWindowCloseListener() {...});  

 mMap.setOnInfoWindowLongClickListener(new GoogleMap.OnInfoWindowLongClickListener() {...});  

For more details, and an example that uses these, see the ApiDemos sample on GitHub and check out the historical changes to this sample, so you can see how the new APIs work. Also see the Release Notes.

Support for Aztec bar codes

In Google Play services 7.8, we launched Vision APIs that supported face and barcode detection. One bar code format we didn’t support was Aztec bar codes, so with Google Play services 8.4 we’ve now added support for these.

Applications using BarcodeDetector in its default configuration (no barcode format restrictions) will automatically start decoding AZTEC codes.

Background Beacon Scanning

With Google Play services 8.4, the Nearby Messages API now supports background scanning for Eddystone, the open beacon format from Google. With this update, your app can be woken up when a BLE beacon is sighted. Back in July, Google Play Services 7.8 introduced the Nearby Messages API with a simple publish-subscribe interface. In the case of beacons, developers publish content by adding attachments to beacon records using Proximity Beacon API. These attachments are served back to your app when Nearby sights a beacon of interest.

New methods that we’ve added include a subscribe method for background beacon subscriptions where BLE scans are triggered at screen-on events; an associated unsubscribe event; and the ability to handle intents that you get when the Nearby API calls back during a background subscription.

Fitness Platform HistoryApi Improvements

We now support consistent step counts across the Google Fit app, other fitness apps and Android Wear watch faces with the HistoryApi.readDailyTotal() method. Please see the following documentation for more detail: http://ift.tt/1NBQeu7

We also have a new HistoryApi.updateData() method. This method allows you to update data in one API call without having to delete and insert with two calls.

Place Picker Autocomplete Widget

Today we are announcing the mobile autocomplete widget, the latest addition to our existing set of programmatic autocomplete features on Android and iOS, as well as the addition of Autocomplete to our place picker widget. Autocomplete functionality assists users by automatically completing the name and address of a place as they type. Widgets make it even easier for developers to add autocomplete functionality to their application with just a small amount of code. Learn more about this at this blog post.

Thursday, December 17, 2015

The Learning Continues! New lessons for Advanced Android course

Posted by Joanna Smith, Developer Advocate

Magic moments happen when your app does something very useful with minimal effort from your users -- like figuring out their location for them automatically. The new Places lesson in the Advanced Android App Development course teaches you how to add a Place Picker to your app so that users can pick a nearby location without having to type anything.

The Advanced Android App Development course, built by Udacity in conjunction with Google, is a follow-up course to Developing Android apps. The advanced course is for Android Developers who are ready to learn how to polish, productionize and publish their app, and even distribute it through Google Play.



Updates to the course also include an explanation of the new GCM Receiver, as well as an entirely new lesson on publishing your app, which explains how to build and sign an APK so you you can distribute your app on Google Play.

After all, why build an app if you can’t get it to your users?
Get started now, because it's going to be awesome!

Wednesday, December 16, 2015

Invitation: Your Ultimate 31-Course Holiday Banquet

Posted by Shanea King-Roberson, Program Manager

The Holidays. Food for the body. Food for the mind. Google and Udacity offer you 31 courses that will make your mouth water and your mind dance. Savor one or several of our 31 self-paced online training courses to indulge your curiosity, expand your knowledge, and hone new skills. Choose from Android, Web, Entrepreneurship, or Cloud and Backend tracks. Are you ready?

Android

More and more people around the world are embracing mobile at an increasing pace, whether on their phones, in their cars, at home, and around their wrists. Learn to build apps for them!


Web

Refine your web development skills for mobile. Create fast, fluid user experiences. Deploy for all desktop and mobile devices. Streamline checkout and payment. Learn how to build beautiful, performant, responsive applications for the world's largest platform.


Cloud and Backend

Does your app need to support more users? (Congratulations!) Do you want to move data handling for an existing app from the device to the cloud? Learn how to take advantage of public cloud infrastructure to support millions of users and terabytes of data.


Entrepreneurship

Start the year with a new start up. That says it all. Take these courses to learn how to do it successfully.

And that’s it. 31 courses that will catapult your skills and make 2016 your best year yet! Happy Holidays!

Monday, December 14, 2015

Leveraging product flavors in Android Studio for hermetic testing

Posted by Jose Alcérreca, Developer Programs Engineer and Wojtek Kaliciński, Developer Advocate



During our recent talk at Android Dev Summit, we discuss the state of testing on Android on the example of a simple Notes application that we created as part of our testing codelab. In one section of the talk, we discuss the problem of test flakiness and introduce a simple solution for setting up a hermetic testing environment.

Combatting flaky tests

UI tests with frameworks like Espresso or UI Automator can easily get flaky if the application has external dependencies that can sometimes fail or take long to respond. In short, flaky tests are tests that are not reliable (they can pass or fail randomly) which defeats the whole purpose of having tests in the first place.

A common solution to this problem is hermetic testing or, in other words, making sure that your tests are isolated from dependencies. Using fake implementations or fake servers that just return predefined data is a common way of dealing with this problem. Here are some good examples:

  • Network calls can be made via a fake API client or fake server that immediately returns data from files stored on disk instead of hitting the network. This bypasses the network's latency and flakiness as well as any errors originating on the real server.
  • Interactions with low-level framework APIs (especially those for accessing hardware, like camera or storage) can be passed through an intermediate interface. A fake implementation of this interface could return immediately, providing a reference to preloaded data, such as an image, without relying on the hardware.
  • Any sensors can be replaced with fakes too: GPS, microphone, accelerometer etc., giving you a chance to test on data that would be difficult to provide for the test in real life, like a preset location or a set of inputs simulating a gesture.

Dependency Injection (DI) is a software design pattern that facilitates testing, reusing modules and making them interchangeable. DI frameworks can help you deal with the boilerplate associated with this pattern but it can take a considerable amount of time to set them up and understand how they work. Before you are ready to commit to one of those frameworks for your app, you might want to explore an easier way, especially if your project requirements are simple.

Managing dependencies with product flavors

Product flavors is a powerful feature of Android Studio and our Android Gradle plugin that lets you swap Java classes at compile time and doesn't require additional libraries. Some typical examples of flavor dimensions are:

  • free/paid flavors to generate two different APKs that will be released on your distribution channels
  • stable/experimental to keep experiments in a different source set and generate beta versions quickly

We can leverage the same mechanism to create two separate versions of our app to help with hermetic testing:

  • prod - uses real implementation of services and components, using real data and resources
  • mock - for a version that contains fake implementations of dependencies that are hard to test

The procedure is very simple:

  1. Create the flavors in your app/build.gradle file.
     android {  
          productFlavors {  
               mock {   
                    applicationIdSuffix = ".mock"  
               }  
               prod  
          }  
     }  
    
    
  2. Create two directories: app/src/prod and app/src/mock
  3. Create the class that you want to use for production code in the prod/java folder or move it from main/java. Make sure the main/java folder does not contain this class.
  4. Create the same class (with the exact same class and file name) in the mock/java folder, but providing a different (fake) implementation that will be used for tests.
  5. In the Build Variants window in Android Studio, choose the variant that you want to install or run tests against. A variant is the combination of a flavor and a build type.

Note: In gradle, the task names change when you add flavors. Instead of installDebug, you will now have to choose installProdDebug or installMockDebug.

Running your tests

With the prod and mock flavors configured and your mock implementation in place, you can now use the following gradle tasks to choose how your tests should run:

  • connectedMockDebugAndroidTest will merge the androidTest and androidTestMock directories and run every test found in the resulting source set. As these tests are run in a hermetic way, they will be faster and less flaky. This is ideal for a pre-submit check.
  • connectedProdDebugAndroidTest will use the real APIs and sensors so they might fail from time to time. If you have a Continuous Integration system, this task could be executed every night or used manually as a acceptance end-to-end test. Note that this task will run the tests in androidTest even if androidTestProd doesn't exist.

You can refer to our Android Testing Codelab to see how we used this method to provide different Injection class implementations, the one in prod providing real data and the other (mock) serving fake dependencies that use fake data for isolated test execution.

When you’re happy with your hermetic setup, you might want to give more flexibility to your build process and add even more dimensions to be able to interchange different components in your app. While the method discussed above is suitable for simple projects, for more complex situations it would be much better to invest some time to learn about and add a Dependency Injection framework to your project.

Thursday, December 10, 2015

Android Studio 2.0 Preview: Android Emulator

Posted by, Jamal Eason, Product Manager, Android

An early preview of the new Android Emulator is now available to try out. As a part of Android Studio 2.0, the latest version of the Android Emulator can help you test your app on a wide range of screens size and configurations beyond the physical Android hardware you use to test.Moreover, using the official Android emulator enables you to test with latest Android versions. Building on this foundation, the top two benefits of new Android emulator are:
  • Speed & Performance: When emulating the latest Android 6.0 release (Marshmallow), we now support Symmetric Multi-Processing and have made significant I/O improvements in both the emulator and ADB. This means you will have faster performance when you are testing your app.
  • Usability & User Interface: The new Android Emulator includes a brand new user interface to make the emulator easy to use. You no longer have to rely on command-line parameters to use the Android emulator. Common tasks and emulator features are now just a mouse click or a keyboard shortcut away.

We previewed the user interface at the Android Dev Summit. You can try it out today along with the new version of ADB for faster APK installation and file transfers to the emulator. Check out the video for a demonstration of the new Android Emulator.



Android Dev Summit 2015: Emulator Demo

We are seeking early feedback to continue to deliver the experience and features that will make you more productive.

New Features in Android Emulator Preview


Performance Improvements

  • CPU Performance


    Android Studio now uses CPU acceleration on x86 emulator system images by default. Combined with new Symmetric Multi-Processor (SMP) support in Android 6.0 Marshmallow system images, the Android emulators can perform even faster than many physical Android devices. Multi-core support not only makes your apps and the emulator run faster but it provides the added advantage of speeding up common developer tasks such as installing APKs. Also, with SMP you can test apps that specifically target multi-processor Android devices.
  • Faster ADB


    In addition to faster CPU speeds in the emulator, there are a number of under-the-hood improvements that will make the experience faster. One of the bottlenecks in the development process that we worked on is the speed of pushing data between Android Studio and your device using ADB (Android Debug Bridge). When you use Android 6.0 Marshmallow and higher system images with the new Android Emulator, you can now push files across ADB up to five times faster than a real device. This will help you if you push large APK or files during your app development cycle.

User Interface


  • Toolbar
    The new interface exposes some of the most common emulator actions in a new toolbar and control panel instead of solely relying on command line options. For the preview, the Android Emulator toolbar enables actions, such as volume control, screen rotation, and screen-shots of the emulator window.

  • Window Zooming & Scaling

    Now you can resize your window simply by dragging a corner. You can also zoom and scroll to get a closer look at a portion of your screen.
Left: Zooming
Right: Window Scaling
  • Drag & Drop

    With the new emulator, you can not only drag and drop APKs for quick installation, but you can also drag and drop any file to your emulator’s internal SD card to help in testing.

Drag and Drop Files
  • Extended UI Controls

    In the extended controls window, additional options help you validate and test features in your app. As shown below, you can initiate a range of emulator actions such as making a virtual call, sending a virtual SMS, or controlling the power level of the emulator. You can additionally send a single GPS location point to the emulator or play back a custom set of KML or GPX points as well.

Phone Controls

Battery Controls

We are continuing to add more functionality and we will keep you up to date as we add more features.

What's Next & Setup

This is just the beginning of developments on the Android Emulator, so expect more features such as support more APIs levels, and adding more sensors with future versions of Android Studio. The new emulator along with Android Studio are available today on the Android Studio canary channel and tools preview channel.

Click here for details on how to setup the preview of the new Android Emulator.

We appreciate your feedback. Connect with us, the Android Studio development team, on Google+.

Wednesday, December 9, 2015

Android Developer Story: SGN game ‘Cookie Jam’ increases user conversions with Store Listing Experiments

Posted by Lily Sheringham, Google Play team

Founded in 2010, SGN is a Los Angeles based mobile game developer with hit titles including Cookie Jam, Panda Pop, Juice Jam and Book of Life: Sugar Smash. They now have more than 200 employees and are one of the fastest growing cross-platform gaming developers.

SGN used Store Listing experiments to test multiple variants across their portfolio of games. For Cookie Jam, they saw an 8 percent increase in conversions simply by changing the background color of their app icon. They also saw increased installs following tests with the Panda Pop app icon and by changing the character in their Book of Life: Sugar Smash app icon.

Watch Josh Yguado, Co-founder and President of SGN, and Matthew Casertano, SVP of Game Operations, talk about how using Store Listing Experiments helped SGN improve their ROI, conversion rates and gamer retention.



Find out more about how to run tests on your Store Listing to increase installs and achieve success with the new guide to ‘Secrets to App Success on Google Play’.

Tuesday, December 8, 2015

A new Family Playbook to help you find success with family and kid-focused apps and games on Google Play

Posted by Lily Sheringham, The Google Play Apps & Games team

We recently released the second edition of “The Secrets to App Success on Google Play” to help you find success with your app or game business. Today we’re releasing our first companion to the guide, “The Family Playbook”, which includes tips and advice to tailor your apps for families and kids and provide high quality, age-appropriate content.

Get The Family Playbook on Google Play today. The guide includes advice and useful resources to help you optimize your user interface design for children, build interactive features that both educate and entertain, develop a business model, understand legal considerations, and plan age-appropriate marketing.

If you’re creating family apps, opt-in to the Designed for Families developer program to designate your apps and games as family-friendly. Participating apps are eligible for family-focused experiences on Google Play that help parents discover great, age-appropriate content and make more informed choices.

Once you’ve checked out the guide, we’d love to hear your feedback so we can continue to improve our developer resources, please let us know what you think.

Monday, November 23, 2015

Android Studio 2.0 Preview

Posted by, Jamal Eason, Product Manager, Android


One the most requested features we receive is to make app builds and deployment faster in Android Studio. Today at the Android Developer Summit, we’re announcing a preview of Android Studio 2.0 featuring Instant Run that will dramatically improve your development workflow. With Android Studio 2.0, we are also including a preview of a new GPU Profiler.

All these updates are available now in the canary release channel, so we can get your feedback. Since this initial release is a preview, you may want to download and run an additional copy of Android Studio in parallel with your current version.

New Features in Android Studio 2.0


Instant Run: Faster Build & Deploy

Android Studio’s instant run feature allows you to to quickly see your changes running on your device or emulator.


Getting started is easy. If you create a new project with Android Studio 2.0 then your projects are already setup. If you have a pre-existing app open Settings/Preferences, the go to Build, Execution, Deployment → Instant Run. Click on Enable Instant Run... This will ensure you have the correct gradle plugin for your project to work with Instant Run.

Enable Instant Run for Android Studio projects

Select Run as normal and Android Studio will perform normal compilation, packaging and install steps and run your app on your device or emulator. After you make a edits to our source code or resources, pressing Run again will deploy your changes directly into the running app.

New Run & Stop Actions in Android Studio for Instant Run

For a more detailed guide setup and try Instant Run, click here.

GPU Profiler

Profiling your OpenGL ES Android code is now even easier with the GPU Profiler in Android Studio. The tool is in early preview, but is very powerful and not only shows details about the GL State and Commands, you can record entire sessions and walk through the GL Framebuffer and Textures as your app is running OpenGL ES Code.

Android Studio GPU Profiler
To get started, first download the GPU Debugging Tools package from the Android Studio SDK Manager. Click here for more details about the GPU Profiler tool and how to set up your Android app project for profiling.

Whats Next

This is just a taste of some of the bigger updates in this latest release of Android Studio. We'll be going through the full release in more detail at the Android Developer Summit (livestreamed on Monday and Tuesday). Over the next few weeks, we'll be showing how to take advantage of even more features in Android Studio 2.0, so be sure to check back in.

If you're interested in more Android deep technical content, we will be streaming over 16 hours of content from the inaugural Android Developer Summit over the next two days, and together with Codelabs, all of this content will be available online after the Summit concludes.

Android Studio 2.0 is available today on the Android Studio canary channel. Let us know what you think of these new features by connecting with the Android Studio development team on Google+.

Thursday, November 19, 2015

Android Studio 1.5

Posted by, Jamal Eason, Product Manager, Android

Android Studio 1.5 is now available in the stable release channel. The latest release is focused on delivering more stability, with most of the enhancements being made under the hood (along with addressing several bugs).



Some of the specific bug fixes, include the ability to use short names when code-completing custom views.

In addition to the stability improvements and bug fixes, we’ve added a new feature to the memory profiler. It can now assist you in detecting some of the most commonly known causes of leaked activities.

There are also several new lint checks. Here's one below which warns you if you are attempting to override resources referenced from the manifest.

If you’re already using Android Studio, you can check for updates from the navigation menu (Help → Check for Update [Windows/Linux] , Android Studio → Check for Updates [OS X]). For new users, you can learn more about Android Studio, or download the stable version from the Android Studio site.

As always, we welcome your feedback on how we can help you. You can also connect with the Android developer tools team via Google+. And don’t worry about what’s in the box from the video. It’s nothing. Really. Forget I mentioned it.

Android Developer Story: Gifted Mom reaches more mothers across Africa with Android

Android Developer Story: Gifted Mom reaches more mothers across Africa with Android Posted by Lily Sheringham, Google Play team

Gifted Mom is an app developed in Cameroon which provides users with basic, yet critical information about pregnancy, breastfeeding and child vaccinations. The widespread use of Android smartphones in Africa has meant that Gifted Mom has been able to reach more people at scale and improve lives.

Watch the creators of Gifted Mom, developer Alain Nteff and doctor Conrad Tankou, explain how they built their business and launched Gifted Mom on Google Play. They also talk about their plans to grow and help people in other developing countries across the continent in the next three years, in order to ultimately tackle maternal and infant mortality.



Find out more about building apps for Android and how to find success on Google Play.

Related Posts Plugin for WordPress, Blogger...