1 <h1>Enable Play Services in Your ARC App
</h1>
4 This article talks about how to enable Google Play Services in
5 <a href=
"getstarted_arc">your ARC app
</a>.
8 <h2 id=
"getstarted">Getting started
</h2>
11 <a href=
"https://developer.android.com/google/play-services/plus.html">
13 <a href=
"https://developer.android.com/google/gcm/index.html">
14 Google Cloud Messaging (GCM)
</a>,
15 <a href=
"http://developer.android.com/guide/topics/providers/contacts-provider.html">
16 contacts provider
</a>, or any of Google's OAuth
2 APIs, you need to set up
17 a project on the Google Developers Console.
20 Go to the
<a href=
"https://console.developers.google.com">Google Developers
24 Create a project. If you already have a project for your app, it is
25 recommended to reuse it.
28 Make sure the information in
<strong>APIs
& auth
</strong> >
29 <strong>Consent screen
</strong> is correct.
32 Make sure
<strong>Product name
</strong> is set correctly. This is what
33 users will see when granting your app permissions.
36 Make sure
<strong>Email address
</strong> is set correctly. This is where
37 users will send feedback. Note that it is a dropdown menu that contains
38 the email addresses of project owners. If the appropriate email address
39 is not in the list, you can add the account as an owner in the
40 <strong>Permissions
</strong> section from the left navigation pane.
41 Click
<strong>Add Member
</strong>, then make sure
<strong>Is
42 owner
</strong> is selected.
44 <li>Fill out the rest of the fields as necessary for your app.
</li>
48 Navigate to
<strong>APIs
& auth
</strong> >
49 <strong>Credentials
</strong>
51 <li>Select
<strong>Create new Client ID
</strong>.
</li>
53 Create a Client ID for an
<strong>Installed application
</strong> of type
54 <strong>Chrome application
</strong>.
<em>Note: Do not use
"Android" as
55 the application type.
</em>
58 Paste in the ID assigned to your app from the Chrome Web Store. See
<a
59 href=
"/webstore/publish#appId">Getting the app ID
</a> for more
65 Copy the client ID assigned for your app and save it for
<a
66 href=
"#metadata">later
</a>. It will look like:
<br>
67 <em>0123456789-randomstring.apps.googleusercontent.com
</em>
70 Go to
<strong>APIs
& auth
</strong> > <strong>APIs
</strong>, turn on
71 the APIs you need. For example:
74 Turn on
<strong>Google Cloud Messaging for Chrome
</strong> if your app
78 Turn on
<strong>Contacts API
</strong> if your app reads users' Google
79 contacts from the contact provider.
86 <h2 id=
"metadata">Setting Client ID and Metadata
</h2>
88 To allow your app to use the APIs you have enabled, paste the oauth client ID
89 obtained above in the
<strong>OAuth Client ID
</strong> field in
<a
90 href=
"http://goo.gl/gAn0Xh">ARC Welder
</a>.
93 You also need to enable services explicitly using ARC-specific metadata. For
94 example, to use GCM and Google+ sign-on, your
<strong>Additional
95 Metadata
</strong> will look something like this:
99 "usePlayServices": [
"gcm",
"plus"]
103 Available services are: ads, gcm, location, maps, plus.
105 <h3 id=
"localtesting">Advanced: Local testing
</h3>
107 When testing using these APIs, it is important that your app ID locally matches
108 the app ID from the Chrome Web Store. To do this, get the
<strong>Public
109 key
</strong> from the
<strong>More info
</strong> link in the
<a
110 href=
"https://chrome.google.com/webstore/developer/dashboard">Chrome Web Store
111 Developer Dashboard
</a>. The public key will look like this:
115 -----BEGIN PUBLIC KEY-----
116 MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwTjmSbBD9uFJEUR7jMYAL1sPX
117 qCNe7ljIb6dheKIYjkNtLt1YuiAw4Pul/PO+aYtm8tsbFnsNZ73AxhMX9aPxuzwl
118 Aak/iN6atxv7h8mwOg6HiHdxTDnOPrCv7fEud5aUFaq7sqDhiqwMpJoIOa1w7c29
119 9z3oXIrG1FGEkid1IQIDAQAB
120 -----END PUBLIC KEY-----
124 To use this public key for local testing, set
<strong>Additional Metadata
</strong>
128 <em>(merge this JSON with existing metadata from above)
</em>:
132 "crx_key":
"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwTjmSbBD9uFJEUR7jMYAL1sPX
133 qCNe7ljIb6dheKIYjkNtLt1YuiAw4Pul/PO+aYtm8tsbFnsNZ73AxhMX9aPxuzwl
134 Aak/iN6atxv7h8mwOg6HiHdxTDnOPrCv7fEud5aUFaq7sqDhiqwMpJoIOa1w7c29
135 9z3oXIrG1FGEkid1IQIDAQAB"
139 <em>Note: Remove line breaks and whitespace in the public key, this must be
144 If you have set the public key correctly, the next time you launch your app, it
145 will be loaded with the same ID as your Chrome Web Store app. See
146 chrome://extensions with
<strong>Developer mode
</strong> selected to confirm.
148 <h2 id=
"version">Choose the right Google Play Services version
</h2>
150 The version of Google Play Services included in ARC will not always be the very
151 latest version of Play Services that is available from Google Play and the
152 Android SDK. If the Play Services library your app uses is newer than the Play
153 Services in ARC, you will see a message from the ARC app to update Google Play
157 In this case, you will need to downgrade your SDK in order to target Play
158 Services in ARC. The Android SDK Manager always downloads the latest version of
159 Play Services, so we suggest backing up previous SDKs before updating, so that
160 you will be able to continue building APKs which work with ARC.