Tag Archives: developers

Getting your Android app ready for Autofill

Posted by Wojtek Kalicinski, Android Developer Advocate, Akshay Kannan, Product Manager for Android Authentication, and Felipe Leme, Software Engineer on Android Frameworks

Starting in Oreo, Autofill makes it easy for users to provide credit cards, logins, addresses, and other information to apps. Forms in your apps can now be filled automatically, and your users no longer have to remember complicated passwords or type the same bits of information more than once.

Users can choose from multiple Autofill services (similar to keyboards today). By default, we include Autofill with Google, but users can also select any third party Autofill app of their choice. Users can manage this from Settings->System->Languages>Advanced->Autofill service.

What's available today

Today, Autofill with Google supports filing credit cards, addresses, logins, names, and phone numbers. When logging in or creating an account for the first time, Autofill also allows users to save the new credentials to their account. If you use WebViews in your app, which many apps do for logins and other screens, your users can now also benefit from Autofill support, as long as they have Chrome 61 or later installed.

The Autofill API is open for anyone to implement a service. We are actively working with 1Password, Dashlane, Keeper, and LastPass to help them with their implementations towards becoming certified on Android. We will be certifying password managers and adding them to a curated section in the Play Store, which the "Add service" button in settings will link to. If you are a password manager and would like to be certified, please get in touch.

What you need to do as a developer

As an app developer, there are a few simple things you can do to take advantage of this new functionality and make sure that it works in your apps:

Test your app and annotate your views if needed

In many cases, Autofill may work in your app without any effort. But to ensure consistent behavior, we recommend providing explicit hints to tell the framework about the contents of your field. You can do this using either the android:autofillHints attribute or the setAutofillHints() method.

Similarly, with WebViews in your apps, you can use HTML Autocomplete Attributes to provide hints about fields. Autofill will work in WebViews as long as you have Chrome 61 or later installed on your device. Even if your app is using custom views, you can also define the metadata that allows autofill to work.

For views where Autofill does not make sense, such as a Captcha or a message compose box, you can explicitly mark the view as IMPORTANT_FOR_AUTOFILL_NO (or IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS in the root of a view hierarchy). Use this field responsibly, and remember that users can always bypass this by long pressing an EditText and selecting "Autofill" in the overflow menu.

Affiliate your website and mobile app

Autofill with Google can seamlessly share logins across websites and mobile apps ‒ passwords saved through Chrome can also be provided to native apps. But in order for this to work, as an app developer, you must explicitly declare the association between your website with your mobile app. This involves 2 steps:

Step 1: Host a JSON file at yourdomain.com/.well-known/assetlinks.json

If you've used technologies like App Links or Google Smart Lock before, you might have heard about the Digital Asset Links (DAL) file. It's a JSON file placed under a well known location in your website that lets you make public, verifiable statements about other apps or websites.

You should follow the Smart Lock for Passwords guide for information about how to create and host the DAL file correctly on your server. Even though Smart Lock is a more advanced way of signing users into your app, our Autofill service uses the same infrastructure to verify app-website associations. What's more, because DAL files are public, third-party Autofill service developers can also use the association information to secure their implementations.

Step 2: Update your App's Manifest with the same information

Once again, follow the Smart Lock for Passwords guide to do this, under "Declare the association in the Android app."

You'll need to update your app's manifest file with an asset_statements resource, which links to the URL where your assetlinks.json file is hosted. Once that's done, you'll need to submit your updated app to the Play Store, and fill out the Affiliation Submission Form for the association to go live.

When using Android Studio 3.0, the App Links Assistant can generate all of this for you. When you open the DAL generator tool (Tools -> App Links Assistant -> Open Digital Asset Links File Generator), simply make sure you enable the new checkbox labeled "Support sharing credentials between the app and website".

Then, click on "Generate Digital Asset Links file", and copy the preview content to the DAL file hosted on your server and in your app. Please remember to verify that the selected domain names and certificates are correct.

Future work

It's still very early days for Autofill in Android. We are continuing to make some major investments going forward to improve the experience, whether you use Autofill with Google or a third party password manager.

Some of our key areas of investment include:

  1. Autofill with Google: We want to provide a great experience out of the box, so we include Autofill with Google with all Oreo devices. We're constantly improving our field detection and data quality, as well as expanding our support for saving more types of data.
  2. WebView support: We introduced initial support for filling WebViews in Chrome 61, and we'll be continuing to test, harden, and make improvements to this integration over time, so if your app uses WebViews you'll still be able to benefit from this functionality.
  3. Third party app support: We are working with the ecosystem to make sure that apps work as intended with the Autofill framework. We urge you as developers to give your app a spin on Android Oreo and make sure that things work as expected with Autofill enabled. For more info, see our full documentation on the Autofill Framework.

If you encounter any issues or have any suggestions for how we can make this better for you, please send us feedback.

Start building apps for the Indian Google Assistant

https://lh3.googleusercontent.com/1h4wgmQMUKoeQGlNSAhXpnSUf6EuKvvX_l4mTRBkeaUvCBYjdhs_w5jyn1UkEBC1PyCeTppO86xfcFEm5RoEGtXiVysq8nWNM6RWsw1aTqEHYwkOFiJBCIs7YRDbuHbKNrDafj0D
Whether you’re searching for a great restaurant for biryani, mapping your travels or helping the kids with their homework, your Google Assistant is always ready to help. You can ask about your day or your commute, explore your favorite topics, and get answers to hundreds of small and big questions during your day. But to be truly successful, your Google Assistant should be able to connect you across the apps and services in your life. So starting today, developers and companies can build apps to engage with Indian users through Actions on Google, the developer platform for the Google Assistant. And as a user, you’ll soon be able to access more of your favorite services and content straight through your Google Assistant.
For anyone who wants to build for the Assistant, resources such as developer tools, documentation and a simulator are available on the Actions on Google developer website, making it easy to create, test and deploy apps. Eligible developers will also be invited to join the Google Assistant Developer Community Program to get support for their efforts.


Now that we’re launching the ability for everyone to create apps on the Google Assistant, Indians will soon have easy and fast access to all types of apps. Once an app works with the Assistant, you can just tell your Assistant to connect you with the app of your choice with a simple voice command – whether it’s on eligible Android phones or iPhones. And the best thing? You won’t need to install anything extra, we’ll connect you straight with the app you’d like to interact with. For example, just say “Ok Google, talk to….” to fire up an app.


Stay tuned as local Indian apps rollout soon, and dive in today by trying one of the many apps already available.  

We hope that this growing platform will give more Indians the help they need, at home or on-the-go – from the morning rush hour to the weekend unwind. Together with developers from Kashmir to Kanyakumari, we look forward to exploring and delivering these new possibilities for the Indian Google Assistant.


Posted by Brad Abrams, Group Product Manager, Google Assistant

Gmail add-ons framework now available to all developers



Email remains at the heart of how companies operate. That’s why earlier this year, we previewed Gmail Add-ons—a way to help businesses speed up workflows. Since then, we’ve seen partners build awesome applications, and beginning today, we’re extending the Gmail add-on preview to include all developers. Now anyone can start building a Gmail add-on.

Gmail Add-ons let you integrate your app into Gmail and extend Gmail to handle quick actions. They are built using native UI context cards that can include simple text dialogs, images, links, buttons and forms. The add-on appears when relevant, and the user is just a click away from your app's rich and integrated functionality.

Gmail Add-ons are easy to create. You only have to write code once for your add-on to work on both web and mobile, and you can choose from a rich palette of widgets to craft a custom UI. Create an add-on that contextually surfaces cards based on the content of a message. Check out this video to see how we created an add-on to collate email receipts and expedite expense reporting.

Per the video, you can see that there are three components to the app’s core functionality. The first component is getContextualAddOn()—this is the entry point for all Gmail Add-ons where data is compiled to build the card and render it within the Gmail UI. Since the add-on is processing expense reports from email receipts in your inbox, the createExpensesCard()parses the relevant data from the message and presents them in a form so your users can confirm or update values before submitting. Finally, submitForm() takes the data and writes a new row in an “expenses” spreadsheet in Google Sheets, which you can edit and tweak, and submit for approval to your boss.

Check out the documentation to get started with Gmail Add-ons, or if you want to see what it's like to build an add-on, go to the codelab to build ExpenseIt step-by-step. While you can't publish your add-on just yet, you can fill out this form to get notified when publishing is opened. We can’t wait to see what Gmail Add-ons you build!

[Q&A] Behind the scenes with Lucidchart: building new diagramming add-on in Google Slides


You might have seen that we recently announced new Google Slides add-ons. We worked closely with several technology partners to build these new add-on solutions to help speed up workflows. 

One partner, Lucidchart, worked closely with Google to create a new integration that brings added diagramming functionality to Slides. We sat down with Tim Winchester, engineering lead at Lucidchart, to learn more about how his team built the new Lucidchart add-on for Slides.

Tell us about the Google Slides add-on you built for Lucidchart. 

We built it as a sidebar add-on that allows users to insert diagrams directly into Google Slides from within Slides (instead of having to export diagrams from Lucidchart). You can also create a new Lucidchart diagram from within Slides, and simply select “Back to Slides” once you’re finished creating your diagram in the Lucidchart editor. You can modify an existing diagram by clicking “Edit” within Slides. This option will direct you to the Lucidchart editor so you can revise as needed. Once you’ve finished revising, or any time you know a diagram has been updated in Lucidchart, select the refresh button from the Lucidchart Diagrams sidebar.

What prompted you to create your add-on? 

Specifically, how did you envision your add-on would improve user experience? Lucidchart is a visual communication platform, but we know our users sometimes need to have their diagrams available in other places. One of the most popular uses for Lucidchart is in presentations, so an add-on for Slides was a natural fit.

Tell us about how you built your solution. 

Since we already had existing add-ons for Docs and Sheets, this project was less about building from scratch and more about adapting what we already had, then doing rewrites as needed. We started by abstracting app-specific functionality of our existing add-ons into a pluggable IntegratedApp interface. We then implemented the interface for Slides using the new SlidesApp API. Once we had reached feature parity, we created a few new additions, such as a “Refresh All Inserted Diagrams” button, which users could find more easily than a top bar menu entry.



At the same time, the Lucidchart add-on was undergoing a major UI overhaul, which was the most challenging and time-intensive part of the project. Because we liked the results of the UI update in Slides, we refactored the add-on code to make it more generalizable, then ported it back to our Docs and Sheets add-ons.

Did anything surprise you during the build? 

As a security measure, the sidebar iframe can only render elements within its borders, so we couldn’t simply throw a <div> into the center of the screen in client code. Instead, we had to fire an event that the Apps Script backend would handle to create a modal dialog, using printing scriptlets to add whatever data we needed into the dialog’s HTML. Thus, any JS object sent from the sidebar to a modal has to be serialized and deserialized in the process, which means that the sidebar cannot directly detect any events emitted by the modal.

Do you have any code snippets that you can share? 

Because we have multiple Google Apps Script add-ons that share lots of functionality, it was very useful to concentrate app-specific code and strings into a wrapper object (called IntegratedApp), which we then referenced elsewhere in the codebase instead of calling SlidesApp directly. So, in the click handler for the insert button, instead of writing this...
SlidesApp.getActivePresentation()
.getSelection()
.getCurrentPage()
.insertImage(image);

...we write this.
IntegratedApp.insertImage(image);

And then we keep the app-specific implementation in our IntegratedApp object (abridged for clarity):
var IntegratedApp = {
// direct mapping to function
createAddonMenu: SlidesApp.getUi().createAddonMenu.bind(SlidesApp.getUi()),

// wrapper to create consistent behavior across apps
insertImage: function(image) {
return SlidesApp.getActivePresentation()
.getSelection()
.getCurrentPage()
.insertImage(image);
},

// app-specific strings
phrases: {
docType: 'Slide',
name: 'Google Slides',
nameWithDocType: 'Google Slides Presentation'
}
};

This technique allows us to keep the same UI code and business logic across apps; we only need to change the implementation of the IntegratedApp object. So in Sheets (for example), our IntegratedApp.insertImage() function becomes:
insertImage: function(image) {
var sheet = SpreadsheetApp.getActiveSheet();
var cell = sheet.getActiveCell();

sheet.insertImage(image, cell.getColumn(), cell.getRow());
}

What advice would you give other developers looking to build similar add-ons? 

If you are planning to develop multiple similar add-ons that mainly differ in the G Suite app with which they integrate, you should find this technique of reducing the overall code amount by isolating duplicative code immensely useful.

After completing the first add-on, creating another add-on for a new G Suite app is just a matter of updating a new copy of IntegratedApp to work with the new app; the rest of the codebase can be commonly shared. In our case, it means that the updated UI was easily added to our Docs and Sheets add-on after we completed the Slides add-on.

Learn more about how you can create your own Slides add-ons or choose from a number of publicly available APIs to customize your G Suite applications. If you’re interested in becoming a Google Cloud technology partner, you can also join our partnership program.

Now anyone can explore machine learning, no coding required

From helping you find your favorite dog photos, to helping farmers in Japan sort cucumbers, machine learning is changing the way people use code to solve problems. But how does machine learning actually work? We wanted to make it easier for people who are curious about this technology to learn more about it. So we created Teachable Machine, a simple experiment that lets you teach a machine using your camera—live in the browser, no coding required.

Teachable Machine is built with a new library called deeplearn.js, which makes it easier for any web developer to get into machine learning by training and running neural nets right in the browser. We’ve also open sourced the code to help inspire others to make new experiments.

Check it out at g.co/teachablemachine.

Now anyone can explore machine learning, no coding required

From helping you find your favorite dog photos, to helping farmers in Japan sort cucumbers, machine learning is changing the way people use code to solve problems. But how does machine learning actually work? We wanted to make it easier for people who are curious about this technology to learn more about it. So we created Teachable Machine, a simple experiment that lets you teach a machine using your camera—live in the browser, no coding required.

Teachable Machine is built with a new library called deeplearn.js, which makes it easier for any web developer to get into machine learning by training and running neural nets right in the browser. We’ve also open sourced the code to help inspire others to make new experiments.

Check it out at g.co/teachablemachine.

Source: Education


Generating Google Slides from images using Apps Script



Today, we announced a collection of exciting new features in Google Slides—among these is support for Google Apps Script. Now you can use Apps Script for Slides to programmatically create and modify Slides, plus customize menus, dialog boxes and sidebars in the user interface.

Programming presentations with Apps Script

Presentations have come a long way—from casting hand shadows over fires in caves to advances in lighting technology (magic lanterns) to, eventually, (in)famous 35mm slide shows of your Uncle Bob's endless summer vacation. More recently, we have presentation software—like Slides—and developers have been able to write applications to create or update them. This is made even easier with the new Apps Script support for Google Slides. In the latest G Suite Dev Show episode, we demo this new service, walking you through a short example that automatically creates a slideshow from a collection of images.
To keep things simple, the chosen images are already available online, accessible by URL. For each image, a new (blank) slide is added then the image is inserted. The key to this script are two lines of JavaScript (given an existing presentation and a link to each image):

var slide = presentation.appendSlide(SlidesApp.PredefinedLayout.BLANK);
var image = slide.insertImage(link);

The first line of code adds a new slide while the other inserts an image on the new slide. Both lines are repeated for each image in the collection. While this initial, rudimentary solution works, the slide presentation created doesn't exactly fit the bill. It turns out that adding a few more lines make the application much more useful. See the video for all the details.

Getting started 

To get started, check the documentation to learn more about Apps Scripts for Slides, or check out the Translate and Progress Bar sample Add-ons. If you want to dig deeper into the code sample from our video, take a look at the corresponding tutorial. And, if you love watching videos, check out our Apps Script video library or other G Suite Dev Show episodes. If you wish to build applications with Slides outside of the Apps Script environment and want to use your own development tools, you can do so with the Slides (REST) API—check out its documentation and video library.

With all these options, we look forward to seeing the applications you build with Google Slides!

Back to school with enhancements to the Classroom API



Google Classroom makes it easy for teachers and students to use the edtech tools they love, and that’s not just limited to Google tools. With the Classroom API, hundreds of developers have built integrations with Classroom that make it easier for admins and teachers to manage classes, share content and more.

One popular way that applications integrate with Classroom is by re-using Classroom rosters—teachers can import their classes with a click and students don’t have to have a new login. Today, we’re making it easier for developers to keep rosters in-sync between their apps and Classroom by launching real-time notifications of changes.

Now, an application can now receive roster changes for a domain, or for an individual course. Powered by Google Cloud Pub/Sub, a state-of-the-art messaging service for passing information between applications, developers no longer have to poll various Classroom API endpoints for changes, which gives teachers and students a more seamless experience. If a new student joins or leaves a Classroom class, that roster change can be automatically applied across applications.

How Flat Education syncs rosters in real-time 

Flat Education, a collaborative music notation app, uses the new updates to instantly update class rosters. Before, when teachers and students accessed the Flat Education application, it would poll the Classroom API for changes and then make updates, delaying data. Now, roster data can be refreshed instantly.
With today's Classroom API update, applications can sync roster data instantly. When a new student joins Google Classroom (bottom left), the student is instantly added to the corresponding music class in Flat Education (top right).

We’re also making the Classroom API more comprehensive with additional enhancements so you can:
  • Create and update announcements. Last year, we launched the ability for external applications to access and create assignments and questions. This update gives applications access to all the posts in Classroom. 
  • Create and update individualized posts. Earlier this year, we made it possible for teachers to post to individual students in Classroom and now, applications can do the same programmatically. This is especially helpful for applications that help teachers differentiate and individualize learning.
For more details on what you can build with the Classroom API, check out the documentation. You can also ask questions (or answer them!) on StackOverflow using the google-classroom tag, and report bugs or feature requests via the issue tracker.

Lastly, let us know what you're building using the #withClassroom hashtag on Twitter or Google+.

Monitoring the Apps Script issue tracker…with Apps Script



Apps Script is just as popular inside Google as it is among external users and developers. In fact, there are more than 70,000 weekly active scripts written by thousands of Googlers. One of our many uses for Apps Script at Google is to automate and monitor our internal issue tracker.

Your business depends on Apps Script...so does ours 

In spring of this year, we migrated our G Suite issue trackers to a new system based on our internal tracker. This carries a lot of benefits, including improving our ability to track how issues reported from outside of Google relate to bugs and features we’re working on internally. We also have an internal Apps Script API that talks to our issue tracker, which we can now use to work with issues reported from outside of Google.

As soon as the migration was finished, we put Apps Script to work monitoring…itself. Now we have a script in place that monitors Apps Script issues as they are reported and upvoted on the public tracker. When we see an issue that’s having widespread or sudden impact, the script generates an alert that we can then investigate. With the help of our large, active community of developers, and leveraging Apps Script, we’re now able to identify and respond to issues more quickly.

There’s no substitute for independent monitoring, and our Apps Script-based approach isn’t the first or the last line of defense. Instead, this new script helps us catch anything that our monitoring systems miss by listening to what developers are saying on the tracker.

If you see something, say something 

Please help us keep Apps Script humming! When you notice a problem, search the issue tracker for it and file an issue if it's new. Click the star to let us know you’re affected and leave a comment with instructions to reproduce, along with any other relevant details. Those instructions and other details help us respond to the issues more effectively, so please be sure to include them.

Happy scripting!

Startup with Google, a resource to help young companies succeed

Since 2011, Google has partnered with over 50 community organizations to help startup communities around the world flourish. Startups within those communities and spaces we run have created more than 40,000 jobs and raised more than $3.9 billion in funding. Today we’re introducing a new resource to help young companies continue to make their big ideas a reality—Startup with Google.

Ivonna Dumanyan and Gabrielle Levac are lifelong athletes. When they started playing Division 1 sports in college, they were often sidelined by injuries, leaving them isolated from their teams and forcing them to miss precious opportunities to compete after months of training. They realized these recurring injuries could be avoidable—and decided to do something about it. They developed a small, wearable device that could detect fatigue, then alert coaches and training staff of elevated injury risk.

Their device was a big hit, and soon their idea grew into Fathom AI, a startup that uses artificial intelligence to help collegiate athletes avoid injuries. Based in Durham, NC, the Fathom team works out of the American Underground tech hub space, a Google for Entrepreneurs partner. There, the Fathom team receives mentorship, training, and access to a community as well as Google resources and programming. 

Ivonna and Gabrielle are just two of the many startup founders who have taken advantage of Google's startup resources and communities to get the expertise and connections to help them grow, as well as tools like G Suite, Google Cloud, AdWords, Android and Google Play to help them build. Now, by bringing together all our resources for startups in one place with Startup with Google, we hope to make it even easier for startups like Fathom to thrive.

ft
Ivonna Dumanyan and Gabrielle Levac, founders of Fathom AI

At Startup with Google, you'll find insights from startup founders and Google teams on hiring, improving team collaboration, and raising a round of funding. Startup with Google also features our network of Campus coworking spaces, Google Developers Launchpad programs, and partner communities, which provide opportunities for founders to connect with the local community, mentors, and investors who can help them succeed.

Startup founders like Ivonna and Gabrielle have big things to accomplish. We can help them, and other founders—check out startup.google.com to find Google's resources for startups, all in one place.