Skip to content

Software Development Blogs: Programming, Software Testing, Agile Project Management

Methods & Tools

Subscribe to Methods & Tools
if you are not afraid to read more than one page to be a smarter software developer, software tester or project manager!

Programming

Android Design Support Library

Android Developers Blog - 4 hours 34 min ago

Posted by Ian Lake, Developer Advocate

Android 5.0 Lollipop was one of the most significant Android releases ever, in no small part due to the introduction of material design, a new design language that refreshed the entire Android experience. Our detailed spec is a great place to start to adopt material design, but we understand that it can be a challenge for developers, particularly ones concerned with backward compatibility. With a little help from the new Android Design Support Library, we’re bringing a number of important material design components to all developers and to all Android 2.1 or higher devices. You’ll find a navigation drawer view, floating labels for editing text, a floating action button, snackbar, tabs, and a motion and scroll framework to tie them together.

Navigation View

The navigation drawer can be an important focal point for identity and navigation within your app and consistency in the design here can make a considerable difference in how easy your app is to navigate, particularly for first time users. NavigationView makes this easier by providing the framework you need for the navigation drawer as well as the ability to inflate your navigation items through a menu resource.

You use NavigationView as DrawerLayout’s drawer content view with a layout such as:

<android.support.v4.widget.DrawerLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true">

    <!-- your content layout -->

    <android.support.design.widget.NavigationView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_gravity="start"
            app:headerLayout="@layout/drawer_header"
            app:menu="@menu/drawer"/>
</android.support.v4.widget.DrawerLayout>

You’ll note two attributes for NavigationView: app:headerLayout controls the (optional) layout used for the header. app:menu is the menu resource inflated for the navigation items (which can also be updated at runtime). NavigationView takes care of the scrim protection of the status bar for you, ensuring that your NavigationView interacts with the status bar appropriately on API21+ devices.

The simplest drawer menus will be a collection of checkable menu items:

<group android:checkableBehavior="single">
    <item
        android:id="@+id/navigation_item_1"
        android:checked="true"
        android:icon="@drawable/ic_android"
        android:title="@string/navigation_item_1"/>
    <item
        android:id="@+id/navigation_item_2"
        android:icon="@drawable/ic_android"
        android:title="@string/navigation_item_2"/>
</group>

The checked item will appear highlighted in the navigation drawer, ensuring the user knows which navigation item is currently selected.

You can also use subheaders in your menu to separate groups of items:

<item
    android:id="@+id/navigation_subheader"
    android:title="@string/navigation_subheader">
    <menu>
        <item
            android:id="@+id/navigation_sub_item_1"
            android:icon="@drawable/ic_android"
            android:title="@string/navigation_sub_item_1"/>
        <item
            android:id="@+id/navigation_sub_item_2"
            android:icon="@drawable/ic_android"
            android:title="@string/navigation_sub_item_2"/>
    </menu>
</item>

You’ll get callbacks on selected items by setting a OnNavigationItemSelectedListener using setNavigationItemSelectedListener(). This provides you with the MenuItem that was clicked, allowing you to handle selection events, changed the checked status, load new content, programmatically close the drawer, or any other actions you may want.

Floating labels for editing text

Even the humble EditText has room to improve in material design. While an EditText alone will hide the hint text after the first character is typed, you can now wrap it in a TextInputLayout, causing the hint text to become a floating label above the EditText, ensuring that users never lose context in what they are entering.

In addition to showing hints, you can also display an error message below the EditText by calling setError().

Floating Action Button

A floating action button is a round button denoting a primary action on your interface. The Design library’s FloatingActionButton gives you a single consistent implementation, by default colored using the colorAccent from your theme.

In addition to the normal size floating action button, it also supports the mini size (fabSize="mini") when visual continuity with other elements is critical. As FloatingActionButton extends ImageView, you’ll use android:src or any of the methods such as setImageDrawable() to control the icon shown within the FloatingActionButton.

Snackbar

Providing lightweight, quick feedback about an operation is a perfect opportunity to use a snackbar. Snackbars are shown on the bottom of the screen and contain text with an optional single action. They automatically time out after the given time length by animating off the screen. In addition, users can swipe them away before the timeout.

By including the ability to interact with the Snackbar through swiping it away or actions, these are considerably more powerful than toasts, another lightweight feedback mechanism. However, you’ll find the API very familiar:

Snackbar
  .make(parentLayout, R.string.snackbar_text, Snackbar.LENGTH_LONG)
  .setAction(R.string.snackbar_action, myOnClickListener)
  .show(); // Don’t forget to show!

You’ll note the use of a View as the first parameter to make() - Snackbar will attempt to find an appropriate parent of the Snackbar’s view to ensure that it is anchored to the bottom.

Tabs

Switching between different views in your app via tabs is not a new concept to material design and they are equally at home as a top level navigation pattern or for organizing different groupings of content within your app (say, different genres of music).

The Design library’s TabLayout implements both fixed tabs, where the view’s width is divided equally between all of the tabs, as well as scrollable tabs, where the tabs are not a uniform size and can scroll horizontally. Tabs can be added programmatically:

TabLayout tabLayout = ...;
tabLayout.addTab(tabLayout.newTab().setText("Tab 1"));

However, if you are using a ViewPager for horizontal paging between tabs, you can create tabs directly from your PagerAdapter’s getPageTitle() and then connect the two together using setupWithViewPager(). This ensures that tab selection events update the ViewPager and page changes update the selected tab.

CoordinatorLayout, motion, and scrolling

Distinctive visuals are only one part of material design: motion is also an important part of making a great material designed app. While there are a lot of parts of motion in material design including touch ripples and meaningful transitions, the Design library introduces CoordinatorLayout, a layout which provides an additional level of control over touch events between child views, something which many of the components in the Design library take advantage of.

CoordinatorLayout and floating action buttons

A great example of this is when you add a FloatingActionButton as a child of your CoordinatorLayout and then pass that CoordinatorLayout to your Snackbar.make() call - instead of the snackbar displaying over the floating action button, the FloatingActionButton takes advantage of additional callbacks provided by CoordinatorLayout to automatically move upward as the snackbar animates in and returns to its position when the snackbar animates out on Android 3.0 and higher devices - no extra code required.

CoordinatorLayout also provides an layout_anchor attribute which, along with layout_anchorGravity, can be used to place floating views, such as the FloatingActionButton, relative to other views.

CoordinatorLayout and the app bar

The other main use case for the CoordinatorLayout concerns the app bar (formerly action bar) and scrolling techniques. You may already be using a Toolbar in your layout, allowing you to more easily customize the look and integration of that iconic part of an app with the rest of your layout. The Design library takes this to the next level: using an AppBarLayout allows your Toolbar and other views (such as tabs provided by TabLayout) to react to scroll events in a sibling view marked with a ScrollingViewBehavior. Therefore you can create a layout such as:

 <android.support.design.widget.CoordinatorLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
     
     <! -- Your Scrollable View -->
    <android.support.v7.widget.RecyclerView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_behavior="@string/appbar_scrolling_view_behavior" />

    <android.support.design.widget.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
   <android.support.v7.widget.Toolbar
                  ...
                  app:layout_scrollFlags="scroll|enterAlways">

        <android.support.design.widget.TabLayout
                  ...
                  app:layout_scrollFlags="scroll|enterAlways">
     </android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>

Now, as the user scrolls the RecyclerView, the AppBarLayout can respond to those events by using the children’s scroll flags to control how they enter (scroll on screen) and exit (scroll off screen). Flags include:

  • scroll: this flag should be set for all views that want to scroll off the screen - for views that do not use this flag, they’ll remain pinned to the top of the screen
  • enterAlways: this flag ensures that any downward scroll will cause this view to become visible, enabling the ‘quick return’ pattern
  • enterAlwaysCollapsed: When your view has declared a minHeight and you use this flag, your View will only enter at its minimum height (i.e., ‘collapsed’), only re-expanding to its full height when the scrolling view has reached it’s top.
  • exitUntilCollapsed: this flag causes the view to scroll off until it is ‘collapsed’ (its minHeight) before exiting

One note: all views using the scroll flag must be declared before views that do not use the flag. This ensures that all views exit from the top, leaving the fixed elements behind.

Collapsing Toolbars

Adding a Toolbar directly to an AppBarLayout gives you access to the enterAlwaysCollapsed and exitUntilCollapsed scroll flags, but not the detailed control on how different elements react to collapsing. For that, you can use CollapsingToolbarLayout:

<android.support.design.widget.AppBarLayout
        android:layout_height="192dp"
        android:layout_width="match_parent">
    <android.support.design.widget.CollapsingToolbarLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">
        <android.support.v7.widget.Toolbar
                android:layout_height="?attr/actionBarSize"
                android:layout_width="match_parent"
                app:layout_collapseMode="pin"/>
        </android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>

This setup uses CollapsingToolbarLayout’s app:layout_collapseMode="pin" to ensure that the Toolbar itself remains pinned to the top of the screen while the view collapses. Even better, when you use CollapsingToolbarLayout and Toolbar together, the title will automatically appear larger when the layout is fully visible, then transition to its default size as it is collapsed. Note that in those cases, you should call setTitle() on the CollapsingToolbarLayout, rather than on the Toolbar itself.

In addition to pinning a view, you can use app:layout_collapseMode="parallax" (and optionally app:layout_collapseParallaxMultiplier="0.7" to set the parallax multiplier) to implement parallax scrolling (say of a sibling ImageView within the CollapsingToolbarLayout). This use case pairs nicely with the app:contentScrim="?attr/colorPrimary" attribute for CollapsingToolbarLayout, adding a full bleed scrim when the view is collapsed.

CoordinatorLayout and custom views

One thing that is important to note is that CoordinatorLayout doesn’t have any innate understanding of a FloatingActionButton or AppBarLayout work - it just provides an additional API in the form of a Coordinator.Behavior, which allows child views to better control touch events and gestures as well as declare dependencies between each other and receive callbacks via onDependentViewChanged().

Views can declare a default Behavior by using the CoordinatorLayout.DefaultBehavior(YourView.Behavior.class) annotation,or set it in your layout files by with the app:layout_behavior="com.example.app.YourView$Behavior" attribute. This framework makes it possible for any view to integrate with CoordinatorLayout.

Available now!

The Design library is available now, so make sure to update the Android Support Repository in the SDK Manager. You can then start using the Design library with a single new dependency:

 compile 'com.android.support:design:22.2.0'

Note that as the Design library depends on the Support v4 and AppCompat Support Libraries, those will be included automatically when you add the Design library dependency. We also took care that these new widgets are usable in the Android Studio Layout Editor’s Design view (find them under CustomView), giving you an easier way to preview some of these new components.

The Design library, AppCompat, and all of the Android Support Library are important tools in providing the building blocks needed to build a modern, great looking Android app without building everything from scratch.

Join the discussion on

+Android Developers
Categories: Programming

Grow your app installs with App Invites from Google

Google Code Blog - 9 hours 54 min ago

Posted by Ranjith Jayaram, Product Manager

If you’re looking to drive usage and grow a mobile app, you’re probably testing out referrals, recommendations, and the user onboarding experience. These product flows are resource-intensive to design, build, and optimize. What if you could use a set of tools that help your users share your app, and get more of the right people to download and use your app? What if you could craft a more personalized onboarding experience in your new user’s journey?

Now in beta, App Invites let mobile app developers increase their reach, deep link new users to custom experiences, and tap into your users’ device and Google-wide contacts as a source to drive referrals. This is available for both iOS and Android app developers. We’re launching with UrbanSitter, Yummly, The CW, Coinbase and Picsart apps.

Here’s what some of our early partners had to say:

  • For Andrea Barrett, co-founder and VP of Product at UrbanSitter, “App Invites gives our members the ability to easily share favorite sitters with their friends and Google contacts. As a service targeting busy parents, our user growth thrives on social recommendations and word-of-mouth referrals, so Google’s app invites are a natural fit for us.”
  • Sharing is an important part of TV network The CW’s app growth strategy. “Tools that help fans of our shows recommend The CW app to their contacts and friends are important. App Invites let’s specific users share their favorite shows with selected friends; it's the next evolution of ‘word of mouth’. We’re integrating App Invites into our episode sharing capabilities, so that fans can speak to each other about the The CW app.” - Zach Mannon, Director of Digital Media at Warner Brothers Television
  • For PicsArt, their fast growth to 250M installs has been driven by word-of-mouth. “Google’s new App Invites will accelerate our organic growth even further, giving people the opportunity to proactively invite their friends to join our mission of beautifying the world!" - Arusiak Kanetsyan, Director of Content and Communication
  • Yummly integrated app invites to expand their user base and generate awareness of their app, by allowing people to suggest the app to those who love to cook or are interested in food. “We see this expanding beyond just inviting new users to join our app. In the future, we hope to use this to share different meal ideas and have the opportunity to share your shopping list with family members or even inviting friends over for dinner. With the power of Google and personalized app invites, making a dinner everyone agrees on will never been easier." -- Brian Witlin, Chief Operating Officer

App Invites is available on both Android and iOS. Here’s what’s in the beta toolkit:

  1. Use app invites for expanded reach: Tap into SMS and email invites via your user’s phone and Google contacts.
  2. Make it easy for your users to send invites. We’ll recommend their closest contacts to share your app with, and suggest a preferred method of delivery.
  3. Send actionable invite cards: Include an install button right in an email invite.
  4. Faster Android install flows: Your new Android users can click App Invite and download your app straight from the Play Store, bypassing the browser windows that usually open in between.
  5. Create personalized onboarding flows: New users can get deep linked into a specific onboarding experience - for example, you can offer custom discount codes or content.
  6. Measure app invites using Google Analytics custom reports.

With App Invites, our goal is to take the hard work out of building user referral and onboarding flows and build a toolkit that works across platforms, so that you can focus on your core app experience. Visit https://developers.google.com/app-invites/ to get started To learn about opportunities to re-engage app users using goo.gl deep links, check out this post.

Categories: Programming

Microservices architecture principle #4: Asynchronous communication over synchronous communication

Xebia Blog - 11 hours 27 min ago

Microservices are a hot topic. Because of that a lot of people are saying a lot of things. To help organizations make the best of this new architectural style Xebia has defined a set of principles that we feel should be applied when implementing a Microservice Architecture. Over the next couple of days we will cover each of these principles in more detail in a series of blog posts.
This blog explains why we prefer asynchronous communication over synchronous communication

In a previous post in this series we explained that we prefer autonomy of Microservices over coordination between Microservices. That does not imply a Microservices landscape with all Microservices running without being dependent on any other Microservice. There will always be dependencies, but we try to minimise the number of dependencies.  Once you have minimised the number of dependencies, how should these be implemented such that autonomy is maintained as much as possible? Synchronous dependencies between services imply that the calling service is blocked and waiting for a response by the called service before continuing it's operation. This is tight coupling, does not scale very well, and the calling service may be impacted by errors in the called service. In a high available robust Microservices landscape that is not preferable. Measures can be taken (think of things like circuit breakers) but it requires extra effort.

The preferred alternative is to use asynchronous communication. In this pattern the calling service simply publishes it's request (or data) and continues with other work (unrelated to  this request). The service has a separate thread listening for incoming responses (or data) and processes these when they come in. It is not blocking and waiting for a response after it sent a request, this improves scalability. Problems in another service will not break this service. If other services are temporarily broken the calling service might not be able to complete a process completely, but the calling service is not broken itself. Thus using the asynchronous pattern the services are more decoupled compared to the synchronous pattern and which preserves the autonomy of the service .

Android M Developer Preview & Tools

Android Developers Blog - Fri, 05/29/2015 - 07:16

By Jamal Eason, Product Manager, Android

Today at Google I/O, we announced a developer preview of the next version of Android, the M release. Last year’s developer preview was a first for Android and we received great feedback. We want to continue to give you developers early access to Android so you have time to get your apps ready for the next version of Android. This time with the M Developer Preview, we will provide a clear timeline for testing and feedback plus more updates to the preview build.

Visit the M Developer Preview for downloads and documentation

The Android M release: improving the fundamentals

For the M release, we focused on improving the core user experience of Android, from fixing thousands of bugs, to making some big changes to the fundamentals of the platform:

  • Permissions - We are giving users control of app permissions in the M release. Apps can trigger requests for permissions at runtime, in the right context, and users can choose whether to grant the permission. Making permission requests right when they’re needed means users can get up and running in your app faster. Also, users have easy access to manage all their app permissions in settings. On M, as a developer, you should design your app to prompt for permissions in context and account for permissions that don’t get granted. As more devices upgrade to M, app permission behavior will be a critical development flow to test.
  • Runtime App Permissions

  • App links - We are making it even easier to link between apps. Android has always allowed apps to register to natively handle URLs. Now you can add an autoVerify attribute to your app manifest so that users can be linked deep into your native app without any disambiguation prompt. App links, along with App Indexing for Google search, make it easier for users to discover and re-engage with your app.
  • Battery - We’re making Android devices smarter about managing power through a new feature called Doze. With M, Android uses significant motion detection to learn if a device has been left unattended for a while. In this state, Android will exponentially back off background activity, trading off a little bit of app freshness for longer battery life. Consider how this may affect your app; for instance, if you’re building a chat app, you may want to make use of high priority messages to wake your app when the device is dozing.

The Android M release: advancing assistance and payments

We are also delighted to announce a couple of big new features:

  • Now on tap - We are making it even easier for Android users to get assistance with Now on tap -- whenever they need it, wherever they are on their device. For example, if your friend texts you about dinner at a new restaurant, without leaving the app, you can ask Google Now for help. Using just that context, Google can find menus, reviews, help you book a table, navigate there, and deep link you into relevant apps. As a developer, you can implement App Indexing for Google search to let users discover and re-engage with your app through Now on tap.
  • Now on tap

  • Android Pay & Fingerprint - We’ve built on our work with Near Field Communications (NFC) in Gingerbread and Host Card Emulation in Kitkat to develop Android Pay. Android Pay will enable Android users to simply and securely use their Android phone to pay in stores or in thousands of Android Pay partner apps. With M, native fingerprint support enhances Android Pay by allowing users to confirm a purchase with their fingerprint. Moreover, fingerprint on M can be used to unlock devices and make purchases on Google Play. With new APIs in M, it’s easy for you to add fingerprint authorization to your app and have it work consistently across a range of devices and sensors.

These are just a few highlights from the M Developer Preview that we announced today. The M preview will be available for download right after the keynote.

Android Developer Tools

In addition to the developer preview, we are launching new tools to help you in the development of your Android App:

  • Android Studio v1.3 Preview - To help take advantage of the M Developer Preview features, we are releasing a new version of Android Studio. Most notable is a much requested feature from our Android NDK & game developers: code editing and debugging for C/C++ code. Based on JetBrains Clion platform, the Android Studio NDK plugin provides features such as refactoring and code completion for C/C++ code alongside your Java code. Java and C/C++ code support is integrated into one development experience free of charge for Android app developers. Update to Android Studio v1.3 via the Canary channel and let us know what you think.
  • Android Studio 1.3 with Android NDK Support

  • Android Design Support Library - Making Material design apps gets even easier with the new Android Design support library. We have packaged a set a key design components (e.g floating action button, snackbar, navigation view, motion enabled Toolbars) that are backward compatible to API 7 and can be added to your app to create a modern, great looking Android app without building everything from scratch.
  • Google Play Services - Today we also are releasing v7.5 of Google Play services which includes new features ranging from Smart Lock for Passwords, new APIs for Google Cloud Messaging and Google Cast, to Google Maps API on Android Wear devices.
Get Started

The M Developer Preview includes an updated SDK with tools, system images for testing on the official Android emulator, and system images for testing on Nexus 5, Nexus 6, Nexus 9, and Nexus Player devices. We are excited to expand the program and give you more time to ensure your apps support M when it launches this fall. Based on your feedback, we plan to update the M Developer preview system images often during the developer preview program. The sooner we hear from you, the more feedback we can integrate, so let us know!

To get started with the M Developer Preview and prepare your apps for the full release, just follow these steps:

  1. Update to Android Studio v1.3+ Preview
  2. Visit the M Developer Preview site for downloads and documentation.
  3. Explore the new APIs & App Permissions changes
  4. Explore the Android Design Support Library & Google Play Services APIs
  5. Get the emulator system images through the SDK Manager or download the Nexus device system images.
  6. Test your app with your supported Nexus device or emulator
  7. Give us feedback
Join the discussion on

+Android Developers
Categories: Programming

Empowering successful global businesses on Google Play

Android Developers Blog - Fri, 05/29/2015 - 05:49

Posted by Ellie Powers, Product Manager, Google Play

With more than 50 billion app installs over the past year from users across 190 countries, Google Play continues to see incredible growth thanks to developers like you creating amazing experiences. Play is now reaching more than one billion users every month.

In February, we announced that we had paid out more than $7 billion to developers in the prior year alone. This week at Google I/O, we’re introducing new and powerful tools to help you further grow your business, improve decision making based on smarter insights, and better engage your user base with more relevant content.

Acquire users from the Developer Console

Once you’ve built a great app, the next important step is to proactively find ways to promote it and grow a loyal user base. App install ads are one powerful way to do that. In the coming months, you’ll be able to quickly and easily set up ad campaigns right from within the Google Play Developer Console for the first time.

All you need to do is set a total budget and the cost you're willing to pay per user and we’ll scale your app promotion across our networks, including Google Search, AdMob, YouTube and the search ads we’re piloting on Google Play. With this new feature, you will will be able to better find the customers that are most likely to install your app.

Actionable insights with the Acquisition and Conversion Funnel

Whether you pay to acquire users or not, you want to know where they’re coming from. Through the Developer Console, you will soon be able to get a snapshot of how many users visit your Store listing, install your app, and make purchases. You’ll see where your most valuable users come from — across organic and paid traffic — and better understand where to focus your efforts.

Optimize your Play store listing with experiments

Your Play Store listing is extremely important, as it’s often the first touch point users have with your app. Starting today, we’re making it easier to optimize this page with support for A/B tests. You can run experiments with different versions of text and graphics to see which are most effective in converting visits into installs on Google Play. In our pilot program, we were thrilled to see that some developers like Kongregate achieved double-digit improvements in their install rates so far.

Test your app automatically on real devices with Cloud Test Lab

With the large variety of Android form factors in the market, testing your app on real devices is a critical step to ensuring a positive user experience on any device. However, you may not have access to every device that your users do. So we’re integrating the newly announced Cloud Test Lab into the Developer Console, which will allow you to automatically test your apps on hundreds of popular physical Android devices for free. We’re going to be rolling out this pilot program gradually, so we’ll welcome your feedback on it.

For each APK you upload to an alpha or beta channel, Google Play will execute fully automated testing of your app against physical devices matching your app targeting criteria and output a report with a detailed analysis of issues, including screenshots and logs. Google Cloud Test Lab will roll out to all developers later this year; you can sign-up to become a tester in the Developer Console now.

Build a data-driven games business with Player Analytics

Google Play Games has activated more than 180M new users in the past six months and continues to be the fastest growing mobile gaming platform in history.

Over the coming months, we're adding new reports, player segments, game metrics, and event types to Player Analytics to help you manage your games business. We're also bringing enhancements to our live operations tools that will enable dynamic content updates that make games feel more alive and engaging, gameplay to respond to changing player needs, and more fun, personalized user experiences. As the bar for success in mobile gaming continues to rise, we’re continuing to evolve our tools to help you meet the soaring expectations of players.

Find great apps – developer pages and search results

There are several ways in which we are improving the discoverability of great apps and games on Google Play to help drive more engagement. Starting today, you can create a unique homepage on Google Play to promote your entire app catalog. With your own developer page, you are able to upload graphics, explain what your company is all about and pick a special app to feature. This gives you a single destination to promote all of your apps on Google Play.

We are also helping guide users with broad interests (e.g. “shopping”) in a new search results experience.

The focus is on organizing results in an intuitive way that allows users to narrow their intent -- such as grouping shopping apps into coupons apps and fashion apps. By doing so, users will be able to better see the range of apps that satisfy their needs, while also increasing the chances of discovering new and innovative apps that you’re building.

Family-friendly content in Google Play

Starting today, we’re making it easier to find family-friendly content on Google Play through new discovery features. On the Apps & Games and Movies & TV homepages, users can now hit the “Family” star to see a curated set of options for specific age groups. In Play Books, tap the “Children’s Books” star. These pages let you browse by age ranges to find content that’s the best fit for the family. If you’ve already opted-in your apps to the Designed for Families program and they’ve met the requirements, they’ll be included in the new family section so that parents can find suitable, trusted, high-quality apps and games more easily. Find out more about opting-in to the Designed for Families program.

Join us at Google I/O 2015

To learn more, tune-in live to “Developers connecting the world through Google Play” at 1pm PT / 4pm ET / 9pm GMT on May 29 on google.com/io.

If you’re at I/O 2015, come along to our breakout sessions where we’ll be talking about and demo’ing these new features. Find our sessions in the I/O 2015 schedule.

Check out developer.android.com/distribute over the coming weeks and months as we add I/O videos and more details about these and other new features.

Join the discussion on

+Android Developers
Categories: Programming

Announcing the Material Design Showcase and Awards

Android Developers Blog - Fri, 05/29/2015 - 05:00

Posted by Rich Fulcher, Material Design Team

When we first announced material design in June 2014, we shared an aspirational highlights reel that demonstrated key material principles for motion, interaction, and visual design across a range of hypothetical apps. “Hypothetical” being the key word here—back then, material design was just an idea. Sure, designers and engineers at Google were already working hard on applying material to Google’s Android, iOS, and web apps, but the notion of a single design system that can work across platforms and brands was just an idea.

Fast-forward to today, and thousands of Android apps are adopting material design using the Android 5.0 SDK and AppCompat, while designers and developers begin to experiment with material design on iOS and the web as well. These apps are starting to realize that aspirational vision we set out with that sizzle reel.

Today, we’re celebrating the amazing design work from Google Play developers and announcing the Material Design Showcase and Material Design Awards.

With the Material Design Showcase, we’re highlighting 18 great material design apps through a collection on Google Play, just like with the Beautiful Design collection in years past.

Of those 18 apps, we’re recognizing 6 with a special award, which we handed out during Google I/O today and announced at the Material Now session hosted by Matias Duarte.

These 6 winners of our first ever Material Design Awards represent best-in-class applications of specific aspects of material design:

B&H Photo Video Audio Pro for Immersive Imagery

New York Times for Elegant Typography

Pocket for Adaptive Layouts

Pocket Casts for Seamless Browsing

Tumblr for Delightful Animation

Weather Timeline for Crafted Simplicity

So today, we have a new highlights reel, featuring these six wonderful and very real apps:


The individuals, teams, and companies behind these apps have made the promise of material design that much more of a reality.

What’s next

But remember, this is only the beginning. We’ll continue to recognize excellent material design in the future, evolving the awards as we evolve material design itself—together as a community.

If you’re a designer or developer just starting out with material design, make sure to check out these 18 apps in the Material Design Showcase. They’re a great source of inspiration, in addition to the awesome content on community sites like Dribbble. And if you’re wondering how to start implementing some of these ideas, get started today with the Creating Apps with Material Design training docs. When you publish your next great app with material design, be sure to let us know on Google+ and Twitter!

Categories: Programming

Polymer 1.0 Released!

Google Code Blog - Fri, 05/29/2015 - 01:33

Posted by Taylor Savage, Product Manager, Polymer

Today we released the 1.0 version of the Polymer library. Polymer is a new way of thinking about building web applications - a sugaring layer on top of Web Components, making it easy for you to create interoperable custom elements. These elements can then be put together to create app-like immersive experiences on the web.

Since the “Developer Preview” release, we’ve re-written the library from the ground up, focusing on cross-browser performance while keeping the developer-friendly ergonomics. The new library is about 3x faster on Chrome, 4x faster on Safari, and a third less code than in developer preview. And it’s ready to be used in production applications.

Get started with the new library

We’ve updated the polymer-project.org site with documentation for the 1.0 release. Major new and updated features include:

  • Brand-new, fast, and easy-to-use data binding system
  • Element theming and styling using custom CSS properties
  • Fast and lightweight Shadow DOM shim for non-supporting browsers
  • “Behaviors” mechanism for sharing behavior between elements

It’s easier than ever to create high-quality, production-ready elements using Polymer, to use in your app or share with other developers.

Browse, demo, and learn how to use the latest elements built by the Polymer team

Check out the many brand-new element product lines built by the Polymer team with the Polymer elements catalog. There you can browse for elements to help create or add features to your web app - whether you need buttons or layouts, Google maps or push notifications. For just about any problem you might need to solve on the web, there’s an element for that.

Kick off your app with the Polymer Starter Kit

Looking for a fast and easy way to get started building a production-ready web application using Polymer? Use the Polymer starter kit. Packed with the latest elements, ready-to-use boilerplate, and an end-to-end toolchain to use from development through production deployment, the starter kit works out of the box so you can focus on adding features right away.

We’re incredibly excited about this release, and can’t wait to see what you’ll build!

Categories: Programming

Introducing the Google Identity Platform

Google Code Blog - Thu, 05/28/2015 - 22:34

Posted by Adam Dawes, Product Manager

Identity is an important building block to any app. Even if it’s not top of mind when you’re building out new features, authentication is critical to get right. We realize developers want their users to have an efficient and secure experience with their products rather than dealing with forgotten passwords that prevent app usage. The Google Identity Platform is a suite of developer tools that cuts friction out of every step of getting people signed in: Smart Lock for Passwords, Google Sign-in, and Identity Toolkit.

New: Get people automatically signed-in with Smart Lock for Passwords

Smart Lock is a password manager built into your Google account. It can automatically sign you into an Android app, and autofills credentials on websites viewed with Chrome. It removes the need to remember and type in password credentials.

We're now extending Smart Lock as an API to app developers and publishers, starting with Android. Android developers can programmatically save and retrieve credentials, and automatically sign their users in across devices and websites in Chrome. Companies like Eventbrite, Orbitz, Netflix, Instacart, the New York Times, and soon — LinkedIn, are using Smart Lock for Passwords to get people automatically signed-in across their properties.

For new account sign-ups, or first-time sign ins, your users now have the option to save their passwords to Smart Lock, and be automatically signed-in subsequently.

How does Smart Lock for Passwords work for your app or site? It recognizes and pre-fills login credentials across devices. When a user signs into or signs-up on your property, they’ll see a Smart Lock prompt to save their password for future use. If they accept, they’ll never have to enter a password again on your Android app or website on Chrome. In turn, this helps your app or site boost sign-up and sign-in rates for new and existing users.

This also means when your users buy and activate new devices, they can easily download and get logged right back into your app using the proper account. You don’t have to spend resources in re-acquiring them again, or encounter forgotten passwords along the way.

Integrating with Smart Lock for Passwords lets your users save their password on one device, and be automatically be signed-in on other devices.

Here’s how early partners are using Smart Lock for Passwords, which you can see rolling out in their Android apps and websites on Chrome.

  • Eventbrite easily integrated and tested SmartLock in their app to increase the number of signed in users, because signing in "gives users a more personalized event discovery experience and a more seamless ticket purchase experience", says Atul Kakkar, Senior Product Manager at Eventbrite.
  • For Instacart, “Smart Lock makes sign-in much faster, sparing the need for users to type in their information - across devices. Many people first browse Instacart on mobile or desktop web and then download the app. With all their credentials ready, our customers can get their groceries even faster. We’re excited for integrating with Smart Lock to help save customer time, and increase business conversions.” - Maksim Golivkin, Android Engineer
  • Netflix is using Smart Lock for Passwords to keep viewers signed in and consuming content no matter what device they’re watching on, even in the living room on Android TV. "Wherever possible, we want to reduce friction in getting our members authenticated across devices. Smart Lock can help, particularly on big screens, where entering user credentials is more cumbersome than on mobile or PC." - Rob Caruso, Director of Partner Engagement
  • In addition to helping pave the way for paid subscribers, the New York Times is using Smart Lock to help build a better cross-device experience for their readers. “This is a retention strategy for us, and part of an ongoing push to create registration and signed-in usage in the app. Smart Lock for Passwords makes it essentially frictionless for someone to do so. Readers who log in or create a registration have a higher propensity to subscribe, and this goes up further if they’re interacting with us on multiple platforms.” - Rachel Kirscht, Android Marketing Manager
  • “When consumers sign-in on Orbitz they benefit in a number of ways. For example, people can get quick access to the travel searches they’ve done on Orbitz using a different device and have a streamlined booking experience with minimal data entry. While traveling, signed-in app users receive push notifications to stay on top of flight delays and gate changes. Desktop Orbitz.com users can now get all these benefits automatically in our app when they utilize Smart Lock, avoiding the usual friction of sign-in or having to know that sign-in comes with benefits.” - Ryan Kowalczyk, Senior Director, Product Strategy
  • For beta partner LinkedIn, "We are thrilled to be Google's launch partner for their Smart Lock debut, which helps to further simplify the log-in experience for our existing LinkedIn members as well as streamline the sign-up process for new members.” - Bob Rosin, VP of Business Development at LinkedIn

Later on this year, we’re planning to offer new features including support for sync passphrases and Smart Lock for Passwords API support on other platforms. Stay tuned!

Give people a trusted registration system with Google Sign-in

Google Sign-in is the gateway to securely connecting Google’s users and services to your app or site. It reduces the burden of login for your users, by enabling them to sign in with their Google account—the same account they already use with Gmail, Play, Google+, and other Google services. The New York Times was able attribute a 20% lift in new registered user signups to the implementation of Google Sign-In, in the months immediately following launch.

Implement authentication in-a-box with Identity Toolkit

Identity Toolkit gives you a robust, more secure authentication system that helps you do sign-in the right way, and can grow with your app. The toolkit supports email and password authentication as well as major identity providers including Google and Facebook. Even non-technical developers can add future sign-in options and migrate existing users with simple configuration changes. Getting started with Identity Toolkit lets you easily scale your auth system as you grow across platforms.

We hope that the Google Identity Platform makes it easy for your users to sign in, so that you can deliver them more personalized, engaging experiences. To view documentation, visit developers.google.com/identity

Categories: Programming

Python: Look ahead multiple elements in an iterator/generator

Mark Needham - Thu, 05/28/2015 - 21:56

As part of the BBC live text scraping code I’ve been working on I needed to take an iterator of raw events created by a generator and transform this into an iterator of cards shown in a match.

The structure of the raw events I’m interested in is as follows:

  • Line 1: Player booked
  • Line 2: Player fouled
  • Line 3: Information about the foul

e.g.

events = [
  {'event': u'Booking     Pedro (Barcelona) is shown the yellow card for a bad foul.', 'sortable_time': 5083, 'match_id': '32683310', 'formatted_time': u'84:43'}, 
  {'event': u'Rafinha (FC Bayern M\xfcnchen) wins a free kick on the right wing.', 'sortable_time': 5078, 'match_id': '32683310', 'formatted_time': u'84:38'}, 
  {'event': u'Foul by Pedro (Barcelona).', 'sortable_time': 5078, 'match_id': '32683310', 'formatted_time': u'84:38'}
]

We want to take these 3 raw events and create one ‘booking event’. We therefore need to have access to all 3 lines at the same time.

I started with the following function:

def cards(events):
    events = iter(events)
 
    item = events.next()
    next = events.next()
    event_id = 0
 
    for next_next in events:
        event = item["event"]
        booking = re.findall("Booking.*", event)
        if booking:
            player = re.findall("Booking([^(]*)", event)[0].strip()
            team = re.findall("Booking([^(]*) \((.*)\)", event)[0][1]
 
            associated_foul = [x for x in [(next, event_id+1), (next_next, event_id+2)]
                                 if re.findall("Foul by.*", x[0]["event"])]
 
            if associated_foul:
                associated_foul = associated_foul[0]
                yield event_id, associated_foul[1], player, team, item, "yellow"
            else:
                yield event_id, "", player, team, item, "yellow"
 
        item = next
        next = next_next
        event_id += 1

If we run the sample events through it we’d see this output:

>>> for card_id, associated_foul, player, team, item, card_type in cards(iter(events)):
      print card_id, associated_foul, player, team, item, card_type
 
0 2 Pedro Barcelona {'match_id': '32683310', 'event': u'Booking     Pedro (Barcelona) is shown the yellow card for a bad foul.', 'formatted_time': u'84:43', 'sortable_time': 5083} yellow

In retrospect, it’s a bit of a hacky way of moving a window of 3 items over the iterator of raw events and yielding a ‘booking’ event if the regex matches.

I thought there was probably a better way of doing this using itertools and indeed there is!

First we need to create a window function which will return us an iterator of tuples containing consecutive events:

from itertools import tee, izip
 
def window(iterable, size):
    iters = tee(iterable, size)
    for i in xrange(1, size):
        for each in iters[i:]:
            next(each, None)
    return izip(*iters)

Now let’s have a look at how it works using a simple example:

>>> numbers = iter(range(0,10))
>>> for triple in window(numbers, 3):
      print triple
 
(0, 1, 2)
(1, 2, 3)
(2, 3, 4)
(3, 4, 5)
(4, 5, 6)
(5, 6, 7)
(6, 7, 8)
(7, 8, 9)

Exactly what we need. Now let’s plug the windows function into our cards function:

def cards(events):
    events = iter(events)
    for event_id, triple in enumerate(window(events, 3)):
        item = triple[0]
        event = triple[0]["event"]
 
        booking = re.findall("Booking.*", event)
        if booking:
            player = re.findall("Booking([^(]*)", event)[0].strip()
            team = re.findall("Booking([^(]*) \((.*)\)", event)[0][1]
 
            associated_foul = [x for x in [(triple[1], event_id+1), (triple[2], event_id+2)]
                                 if re.findall("Foul by.*", x[0]["event"])]
 
            if associated_foul:
                associated_foul = associated_foul[0]
                yield event_id, associated_foul[1], player, team, item, "yellow"
            else:
                yield event_id, "", player, team, item, "yellow"

And finally check it still processes events correctly:

>>> for card_id, associated_foul, player, team, item, card_type in cards(iter(events)):
      print card_id, associated_foul, player, team, item, card_type
 
0 2 Pedro Barcelona {'match_id': '32683310', 'event': u'Booking     Pedro (Barcelona) is shown the yellow card for a bad foul.', 'formatted_time': u'84:43', 'sortable_time': 5083} yellow
Categories: Programming

Add Google to your iOS Apps with CocoaPods

Google Code Blog - Thu, 05/28/2015 - 20:43

Posted by Jonathan Beri, Product Manager

Today, we’re announcing that CocoaPods will be the primary channel to acquire Google SDKs for iOS. CocoaPods is a popular, free dependency manager for iOS that significantly simplifies the process of importing libraries and frameworks into Xcode. And it will help you manage your dependencies between our various libraries.

While there was a small but growing number of official Google Pods, as well as a few Pods written by other iOS developers, it was often difficult for developer to find the right SDK. With today’s announcement, some of our key libraries, like Google Cloud Messaging and the Google Maps SDK for iOS can now be found on the public CocoaPods service. Going forward, new iOS SDKs will be packaged and documented as Pods and published on cocoapods.org. You can find the full list of Google Pods and all supporting documentation at developer.google.com/ios/cocoapods.

If you haven't used CocoaPods yet, now is a great time to give it a try. Add GoogleAnalytics to a Podfile to start counting new users. Or pod install your way to adding AdMob ads in your app. And check out pod try, a CocoaPods plugin that allows you to quickly launch our demo projects.

For more iOS developer protips and to learn more about Google’s iOS SDKs, please check out the Route 85 video series from Todd Kerpelman. We look forward to all the great Google-powered iOS apps you will create!

Categories: Programming

Google I/O 2015: Develop, Engage & Earn

Google Code Blog - Thu, 05/28/2015 - 20:41

Posted by Jason Titus, Senior Director of Engineering

This morning, we kicked off our 8th annual Google I/O conference, joined by 5,600 developers at Moscone Center, 530 I/O Extended communities around the world, and millions via the I/O Live stream. This year’s event is focused on delivering incredible experiences on mobile and helping developers build successful businesses through these key themes: Develop, Engage, and Earn.

During the keynote, we had a number of announcements that covered the evolution of the mobile platform, tools for Android, iOS, and Web developers, and the push towards more immersive mobile experiences with VR. Here’s a closer look at the news:

Develop
  • Android M Developer Preview — Get an early look at the next version of Android.
  • Google Play services 7.5 — Check out new features like Smart Lock for Passwords, new APIs for Google Cloud Messaging and
  • Google Cast, and the Google Maps API on Android Wear devices.
  • Android Studio 1.3 — Preview Android Studio v1.3, now with improved Gradle build speed, a new memory profiler, and full editing and debugging support for C/C++.
  • Polymer 1.0 — As the first production-ready release for the web components library, we’re also adding new product lines of elements. Features range from toolbars and menus to offline caching.
  • iOS & CocoaPods — Access your favorite libraries via CocoaPods, the official distribution channel for Google SDKs on iOS.
  • Cloud Test Lab — Building on the technology from our acquisition of Appurify, cloud Test Lab automates the testing of your mobile apps.
  • Firebase — Firebase makes it easy to build apps quickly, without spinning up servers or writing server-side code.
Engage
  • App Indexing — Index your app’s content into Google Search, just like you would with a website. Available for Android, and now piloting on iOS.
  • Google Cloud Messaging — As one of the most popular ways to send messages from the cloud to user's devices on Android and Chrome, GCM is now also available on iOS.
  • Engagement on the Web — Access previously unavailable native functionality on the web with push notifications from your mobile website and add to homescreen.
  • Empowering successful global businesses on Google Play — Get new and powerful tools to help you further grow your business, improve decision making based on smarter insights, and engage and retain a valuable user base.
  • Universal App Campaigns coming soon — Set up app install ads with just a few inputs like your budget and the cost you’re willing to pay per user--we take care of the rest.
  • Measure App Installs Ads with Google Analytics — Measure app install campaigns based on engagement and lifetime value. On iOS, Google Analytics is now integrated with 20+ ad networks making it easy to understand how to spend your acquisition budget.
Earn
  • AdMob — Monetize your apps intelligently on a single platform, so you can gain insights about your users, drive more in-app purchases and maximize your ad revenue.
What’s Next
  • Android Nanodegree — Enroll in the industry's first Android Nanodegree, developed in collaboration with Udacity. The curriculum was built from the ground up s to meet the high standard we have for Android development. The Nanodegree covers everything from fundamentals to advanced development skills, as well as Google Play services and Material Design.
  • Cardboard SDK — The Cardboard SDK for Unity now supports both Android and iOS.
Categories: Programming

A Closer Look at Google Play services 7.5

Android Developers Blog - Thu, 05/28/2015 - 20:27

Posted by Ian Lake, Developer Advocate

At Google I/O, we announced the rollout of Google Play services 7.5 that deliver new capabilities and optimizations to devices across the Android ecosystem. Google Play services ensures that you can build on the latest features from Google for your users, with the confidence that those services will work properly on Android 2.3 and higher devices.

You’ll find the addition of Smart Lock for Passwords, Instance ID, new APIs for Google Cloud Messaging and Google Cast, as well as access to the Google Maps API on Android Wear devices.

Smart Lock for Passwords

Typing in a password, particularly on a mobile device, is never a pleasant experience. In many cases, your users have already logged in on the web or another device - shouldn’t your login process know that? Smart Lock for Passwords builds on the Chrome Password Manager, adding a new CredentialsApi API and UI on Android to retrieve saved credentials as part of your login process and saving new credentials for later use on other Android devices and any Chrome browser. Both password-based and Identity Provider (IDP, like Google Sign-In) credentials are supported. Keep your users logged in as they move between and to new devices; don’t let them drop off, get frustrated, or end up with multiple accounts.

Learn more about Smart Lock for Passwords on the developer site.

Instance ID, Identity, and Authorization

Instance ID (IID) allows you to retrieve a unique identifier for every app instance, providing a mechanism to authenticate and authorize actions, even if your app does not have user registration and accounts. For example, this allows you to uniquely determine which app instance is sending a request from by including the Instance ID token. We’ve also made it easy to handle edge cases to ensure that you’ll have valid Instance ID tokens.

Google Cloud Messaging

Google Cloud Messaging (GCM) gives developers a battery efficient mechanism for sending information to your users as well as send upstream messages from a device to your server.

Google Cloud Messaging and InstanceID

Previously, GCM used a unique registration ID to refer to each device - while these IDs will continue to work, you can now utilize Instance ID tokens for GCM, gaining all of the advantages of InstanceID around handling error cases. Instance ID tokens are fully compatible with user notifications, allowing you to send notifications to all of a user's devices.

Topic based subscriptions

You’ll also get another new feature for switching to InstanceID with GCM - topic based subscriptions! This makes it easy to publish a message to exactly the right audience and have GCM handle all the heavy lifting of sending to all subscribed instances. Your app can subscribe to multiple topics, allowing you to create any set of topics needed to best handle your app’s messaging needs.

Receiving messages with GCM

Of course, just subscribing to receive messages is only half the battle: receiving GCM messages can now be done using a GcmReceiver and a subclass of GcmListenerService. These two classes make it easy to help your app reliably process messages, even when the device is awakened from deep sleep.

GCM Network Manager

Applications often need to sync data with their servers when new information is available. In GCM we refer to this model as “send to sync”. We made this task much simpler with the introduction of the GCM Network Manager APIs, which handles many of the common implementation patterns such as waiting for network connectivity, device charging, network retries, and backoff. GcmNetworkManager will schedule your background tasks when it is most appropriate and it can batch multiple tasks together for efficiency and battery savings, even utilizing the JobScheduler APIs for best performance on Android 5.0+ devices. With support for both one-off tasks and periodic tasks, this API serves as a flexible framework for many different types of operations.

App Invites Beta

Now in beta, App Invites is new functionality for both Android and iOS that provides a standard UI for users to invite their contacts to install your app and optionally deep link specifically to selected content, using your users’ device and Google-wide contacts as a source to drive referrals to increase the reach of your app.

With the ability to send invites via SMS or email, this provides a great mechanism to organically grow your user base, give your users a consistent way to share your app with exactly who would like it, and track how effective your invites are.

With App Invites, our goal is to take the hard work out of building user referral and onboarding flows, so that you can focus on your core app experience. Learn more about App Invites on the developer site!

Google Cast

Google Cast is a technology that lets you easily cast content from your mobile device or laptop right to your TV or speakers. With the new ability to use remote display on any Android, iOS, or Chrome app, better media support, better game support, we hope your Google Cast experience is better than ever!

Remote Display API

We are making it easy for mobile developers to bring graphically intensive apps or games to Google Cast receivers with Google Cast Remote Display APIs for Android and iOS. The new Remote Display API allows you to build a tailored, integrated second screen experience, without requiring an identical mirroring of content between mobile devices and the Google Cast device.

Learn more about Remote Display on the Google Cast Developers Site!

Autoplay and Queuing APIs

Playing single media items on Chromecast has been something RemoteMediaPlayer (or CastCompanionLibrary’s VideoCastController) has been doing well for some time. With this release, RemoteMediaPlayer is gaining a full media queue and support for autoplay for a seamless media playback experience. This ensures that all connected devices can easily maintain a synchronized queue of upcoming media items, opening up new possibilities of creating collaborative Google Cast media experiences.

Game Manager APIs for Google Cast

Bringing your game to Google Cast can make for a great multiplayer experience, using a mobile device as a game controller and the TV to display the action. To make it easier to send messages and state changes to all connected clients and the cast receiver, Google Play services 7.5 introduces the GameManagerClient and the Game Manager APIs for Google Cast, available for Android, iOS, Chrome, and for receivers.

Android Wear

Watches are great devices for telling time. But what if in addition showing you when you are, watches could easily show you where you are? With the new release, you can now use the familiar Maps APIs on Android Wear devices:

This makes it possible to display fully interactive maps, as well as lite mode maps, directly on Android Wear devices. You’ll be able to scroll and zoom interactive maps, show the user’s current location, and more. Check out the full list of supported features in the developer documentation and check out all the details on the Geo Developers blog.

Google Fit

Google Fit is an open platform designed to make building fitness apps, whether that means retrieving sensor data like current location and speed, collecting and storing activity data, or automatically aggregating that data into a single view of the user’s fitness data.

You’ll now be able to use the RecordingApi for gathering estimated distance traveled and calories burned data, making it available to your app and other Google Fit enabled apps via the HistoryApi.

Being active can take many forms. While some activities are easily measured in terms of steps or distance, strength training is measured in terms of type, resistance and repetitions. This type of data can now be stored in Google Fit via new support for a large number of workout exercises, helping users build a complete view of their activity.

SDK is now available!

Google Play services 7.5 is now available: get started with updated SDK now!

To learn more about Google Play services and the APIs available to you through it, visit the Google APIs for Android site.

Join the discussion on

+Android Developers
Categories: Programming

Announcing new Google Cast APIs

Google Code Blog - Thu, 05/28/2015 - 20:20

Posted by Nathan Camarillo and David Allison, Google Cast Product Managers

Google Cast makes it easy for developers to extend their mobile experiences to bigger screens and speakers. Since the launch of Chromecast, the first Google Cast device, we’ve seen tremendous success. 17 million Chromecast devices have been sold, with 1.5 billion touches of the Cast button, changing the way people watch TV. In the US, active Chromecast users are consuming 66% more content per day than at launch in July 2013. We see a 45% increase in YouTube watch time upon a Chromecast activation.

The Google Cast ecosystem continues to grow, with a range of new entertainment devices with Google Cast built-in-- from Chromecast and Android TV devices to speakers and soundbars.

Today at Google I/O, we are announcing new developer tools specifically for mobile app and game developers to bring new experiences to the TV.

Google Cast Remote Display APIs (Beta)

We are making it easy for mobile developers to bring graphically intensive apps or games to Google Cast receivers with Google Cast Remote Display APIs for Android and iOS.

While Casting your Android screen is an existing option for users, the new Remote Display API allows mobile developers to build a tailored, integrated second screen experience, without requiring an identical mirroring of content between mobile devices and the Google Cast device.

Remote Display will be available both iOS and Android. Your app will contain the same Google Cast icon allowing users to select a device. On Android, you’ll connect to the device using the helper class CastRemoteDisplayLocalService, then create a subclass of CastPresentation where you can call setContentView() to display any content you want (including drawing directly on a SurfaceView!). The contents of your CastPresentation are then sent over to the connected Google Cast device for display. On iOS, you’ll use the core Google Cast SDK to discover receivers and connect to one, then GCKRemoteDisplayChannel to establish a new Remote Display session. Your app will then send video and audio frames via the session. Adaptors for OpenGL ES and Metal are provided to help integrating Remote Display with existing rendering code.

There’s no need to write a receiver app as the Remote Display APIs are supported natively by all Google Cast receivers. However, you’ll still need to register a Remote Display App ID using the Google Cast SDK Developer Console.

See Remote Display in action with Driver® Speedboat Paradise:

Autoplay and Queuing APIs

Autoplay and Queuing APIs allow developers to create content queues and begin buffering a second video while a first video is finishing playback. This enables the creation of a continuous playback experience and can significantly increase watch time, helping lift per-session watch times by 10-20% or more.

Playing single media items on Chromecast has been something RemoteMediaPlayer (or CastCompanionLibrary’s VideoCastController) has been doing well for some time. With this release, RemoteMediaPlayer is gaining a full media queue, allowing you to queue up multiple MediaQueueItems, skip between items, set a repeat mode, reorder the queue, and enable autoplay for a seamless media playback experience. The MediaStatus returned to you will be augmented with the current queue of items as well as new OnPreloadStatusUpdatedListener, allowing you to display what will be played next. This ensures that all connected devices can easily maintain a synchronized queue of upcoming media items, opening up new possibilities of creating collaborative Google Cast media experiences.

Game Manager APIs for Google Cast

Since last November, Cast has had the ability to turn your TV screen into a game board, racetrack, dance floor, or trivia quiz—inviting everyone in your living room to use their phone as a personal game controller. Now we’re introducing new Game Manager APIs that will simplify the process for developers to build multiplayer games. To make it easier to synchronize game state across a potentially large number of players, Google Play services 7.5 introduces the Cast Game Manager API. This API, available for Android via the GameManagerClient class, iOS, Chrome, and for receivers, allows you to send messages and state changes to all connected clients and the receiver. All of the send methods also have a method that includes a specific player ID, making it possible to have multiple players sharing a single sender device.

All of these APIs are available on Android today. iOS and Chrome SDK updates will be available in the coming days.

You can learn more about these Google Cast APIs on the Google Cast Developers Site. We’re excited to see what you come up with to bring more mobile-centric experiences to the living room.

Categories: Programming

Team Sizes and Schedule Basics - New Lectures Posted

10x Software Development - Steve McConnell - Thu, 05/28/2015 - 19:19

I've posted this week's lecture in my Understanding Software Projects series at https://cxlearn.com. Most of the lectures that have been posted are still free. Lectures posted so far include:  

0.0 Understanding Sofware Projects - Intro

0.1 Introduction - My Background
     0.2 Reading the News

1.0 The Software Lifecycle Model - Intro
     1.1 Variations in Iteration 
     1.2 Lifecycle Model - Defect Removal

2.0 Software Size
     2.1 Size - Staff Sizes (New this week)
     2.2 Size - Schedule Basics (New this week)

Check out the lectures at http://cxlearn.com!

Understanding Software Projects - Steve McConnell

 

Harold Almon Took Charge of His Software Development Career

Making the Complex Simple - John Sonmez - Thu, 05/28/2015 - 16:00

When Harold Almon emailed me to tell me about the transformation he had in his career after listening to an episode of JavaScript Jabber and then not just reading, but actually implementing the advice on this blog, I knew I had to share it. Too many people talk about doing things to improve their career […]

The post Harold Almon Took Charge of His Software Development Career appeared first on Simple Programmer.

Categories: Programming

The Power Of Persistence

Making the Complex Simple - John Sonmez - Thu, 05/28/2015 - 15:00

In this video, I talk about a skill that I think a lot of people can develop to help them succeed – persistence. Full transcript:   John:               Hey, this is John Sonmez from simpleprogrammer.com. So in this video I want to talk to you about something that I feel has been really important for me […]

The post The Power Of Persistence appeared first on Simple Programmer.

Categories: Programming

Episode 227: Eric Brewer: The CAP Theorem, Then and Now

Robert Blumen talks with Eric Brewer, who discovered the CAP (consistency, availability, partition tolerance) theorem. The first part of the show focuses on Brewer’s original thesis presented at the 2000 ACM Symposium on Principles of Distributed Computing (PODC): What set of problems motivated the formulation of CAP? How was it understood at the time? What are […]
Categories: Programming

Microservices Architecture Principle #3: small bounded contexts over one comprehensive model

Xebia Blog - Wed, 05/27/2015 - 21:18

Microservices are a hot topic. To help organizations make the best of this new architectural style Xebia has defined a set of principles that we feel should be applied when implementing a Microservice Architecture. Over the next couple of days we will cover each of these principles in more detail in a series of blog posts. Today we discuss the Domain Driven Design (DDD) concept of "Bounded Context" and how it plays a major role in designing Microservices.

One of the discussion points around Microservices, since the term was coined in 2013, is how big (or rather, how small) a Microservice should be. Some people, such as Fred George, claim services should be small, maybe between 100-1000 lines of code (LoC). However, LoC is a poor metric for measuring software in general and even more so for determining the scope of a Microservice. Rather, when identifying the scope of our Microservices, we look at the functionality that a service needs to provide, and how the service relates to other services. Our aim is to design Microservices that are autonomous, ie. have a low coupling with other services, have well defined interfaces, and implement a single business capability, ie. have high cohesion.

A technique that can be used for this is "Context Mapping".  Via this technique we identify the various contexts in the IT landscape and their boundaries. The Context Map is the primary tool used to make boundaries between domains explicit. A Bounded Context encapsulates the details of a single domain, such as domain model, data model, application services, etc., and defines the integration points with other bounded contexts/domains. This matches perfectly with our definition of a Microservice: autonomous, well defined interfaces, implementing a business capability. This makes Context Mapping (and DDD in general) an excellent tool in the architects toolbox for identifying and designing Microservices.

Another factor in sizing our services is that we would like to have models that can "fit in your head", so as to be able to reason about them efficiently. Most projects define a single comprehensive model encompassing the full domain, as this seems natural, and appears easier to maintain as one does not have to worry about the interaction between multiple models, or translate from one context to the other.

For small systems this may be true, but for large systems the costs will start to outweigh the benefits: maintaining a single model requires centralization. Naturally the model will tend to fragment: a domain expert from the accounting domain will think differently about 'inventory' than a logistics domain expert, for example. It requires lots of coordinated efforts to disambiguate all terms across all domains. And worse, this 'unified vocabulary' is awkward and unnatural to use, and will very likely be ignored in most cases. Here bounded contexts will help again: they make clear where we can safely use the natural domain terms and where we will need to bridge to other domains. With the right boundaries and sizes of our bounded contexts we can make sure our domain models "fit in your head" and that we do not have to switch between models too often.

So maybe the best answer to the question of how big a Microservice should be is: it should have a well defined bounded context that will enable us to work without having to consider, or swap, between contexts.

Get ready for even more material design

Google Code Blog - Wed, 05/27/2015 - 20:11

Posted by Monica Bagagem, Developer Marketing

Google I/O 2015 starts tomorrow, and, like last year, we’ve got an exciting lineup of design-focused content for both developers and designers to experience in-person and online. Just a year ago, we announced material design - a system for cross-platform visual, motion, and interaction design. This year at I/O, we’ll see how material has been adopted and implemented by the community, and our approach on design across our platforms.

Sessions

At 4PM PDT on Thursday, May 28, join Matias Duarte’s “Material Now” session to recap where we’ve been and get a sneak peek of where we’re going with design at Google. We’ll be recognizing some of the phenomenal material design work from across the community, so definitely tune in if you’re an Android developer or designer. For more details, check Matias’ post on Google+.

The session will be live streamed so you can follow along in real-time even if you’re not at Moscone. Recordings will also be available shortly after on the I/O website.

Add Design Sessions to your I/O schedule

Design Sandbox

We’ve dedicated an entire section of Moscone West to design-related programming, including one-on-one and group UX reviews with members of the material design team. Appointments will be on a first-come, first-serve basis, but we'll also have Google designers on hand for more casual questions.

Add Material Design Reviews to your I/O schedule

Sandbox Talks

Google designers and engineers will host several deep-dive, 20 minute tech talks in a breakout area within the Design Sandbox on Level 2. The space has been designed to facilitate conversation and discussion with small audiences, so come prepared with questions! We’ll be covering a range of topics such as cross-platform and responsive design, designing for platforms like Google Cast and Android Auto, and how to adapt material design to your brand. As an added bonus, most Sandbox Talks will take place twice throughout the conference giving you more flexibility to adjust your schedule.

Add Design Sandbox Talks to your I/O schedule

Explore the full Google I/O schedule here.

Be sure to follow +GoogleDesign and @GoogleDesign, where we’ll be posting design-related announcements throughout the conference. You can also follow and join the general conversation about I/O at #io15. See you tomorrow!

Categories: Programming

App deep linking with goo.gl

Google Code Blog - Wed, 05/27/2015 - 19:36

Posted by Fabian Schlup, Software Engineer

Starting now, goo.gl short links function as a single link you can use to all your content — whether that content is in your Android app, iOS app, or website. Once you’ve taken the necessary steps to set up App Indexing for Android and iOS, goo.gl URLs will send users straight to the right page in your app if they have it installed, and everyone else to your website. This will provide additional opportunities for your app users to re-engage with your app.

This feature works for both new short URLs and retroactively, so any existing goo.gl short links to your content will now also direct users to your app.

Zillow shares a short URL on Twitter that automatically links to their native app.

Share links that ‘do the right thing’

You can also make full use of this feature by integrating the URL Shortener API into your app’s share flow, so users can share links that automatically redirect to your native app cross-platform. This will also allow others to embed links in their websites and apps which deep link directly to your app.

Take Google Maps as an example. With the new cross-platform goo.gl links, the Maps share button generates one link that provides the best possible sharing experience for everyone. When opened, the link auto-detects the user’s platform and if they have Maps installed. If the user has the app installed, the short link opens the content directly in the Android or iOS Maps app. If the user doesn’t have the app installed or is on desktop, the short link opens the page on the Maps website.

Try it out for yourself! Don’t forget to use a phone with the Google Maps app installed: http://goo.gl/maps/xlWFj.

How to set it up

To set up app deep linking on goo.gl:

  1. Complete the necessary steps to participate in App Indexing for Android and iOS at g.co/AppIndexing. Note that goo.gl deep links are open to all iOS developers, unlike deep links from Search currently. After this step, existing goo.gl short links will start deep linking to your app.
  2. Optionally integrate the URL Shortener API with your app’s share flow, your email campaigns, etc. to programmatically generate links that will deep link directly back to your app.

We hope you enjoy this new functionality and happy cross-platform sharing!

Categories: Programming