3

I just added OneSignal to my Cordova project. This appears to use Google Play services i.e. (I get a message "No valid Google Play services APK found"). I was wondering the best approach for adding it.

  • I have Google Play services v8.4.89 installed on my phone.
  • I have Google Play services installed via the SDK manager:

enter image description here

This creates a google_play_services folder (without a lot in it):

enter image description here

UPDATE As per this Google has broken down Google Play Services into multiple libraries (.aar) located at:

android-sdk\extras\google\m2repository\com\google\android\gms

enter image description here

  • build.gradle dependencies:

enter image description here

I'm a little unsure of what to do next. I thought I could have potentially used this.

I might add I am using IntelliJ and have tried to import the JAR manually as per this.

Thanks,

Community
  • 1
  • 1
Hurricane
  • 1,454
  • 1
  • 13
  • 31

2 Answers2

1

The OneSignal error "No valid Google Play services APK found" means that the "Google Play services" app is missing from the device or is most likely just out of date. It should check the version under Settings>Apps. It should update automatically in the background after you open the Google Play store on the device and sign in. See the following link for more details. https://documentation.onesignal.com/docs/all-users-are-shown-as-not-subscribed

Gdeglin
  • 12,432
  • 5
  • 49
  • 65
jkasten
  • 3,899
  • 3
  • 32
  • 51
  • Thanks jkasten I had already looked at that I have version 8.4.89 of Google Play services on my device. – Hurricane Jul 08 '16 at 09:49
  • You must have version 9.2 on your device in this case then. Since you have `play-services:+` in your gradle this will use the latest version on your system. I see Rev. 31 in your screenshot which is 9.2. The device version must be the same or higher then the library version for calls to Google Play services to work. – jkasten Jul 08 '16 at 20:18
  • Thanks jkasten, that has sorted it. I had assumed 8.4.89 was the latest version since I was not being prompted to update it. The key point from the link you have provided (which you mentioned) is: _"The version on the device must be the same version or newer than the version you build your app with."_ – Hurricane Jul 08 '16 at 21:52
0

You need to add it to your project library..

File >> Import, select Android > Existing Android Code into Workspace, browse to the library project (your android sdk env) to import it. extras/google/google_play_services/

After this.. you need to open the properties for your project.. Right click on your project and click properties select android and under the library section add the google lib.

Palm
  • 38
  • 4
  • there should be a guide for this.. let me check. ah yes follow this guide :) (http://hmkcode.com/adding-google-play-services-library-to-your-android-app/) – Palm Jul 07 '16 at 14:25
  • Thanks Palm, as per [this](http://stackoverflow.com/questions/37310684/missing-sdk-extras-google-google-play-services-libproject-folder-after-upda) it seems that the google play services are now located at \extras\google\m2repository\com\google\android\gms. I should also mention I'm using Intellij. – Hurricane Jul 08 '16 at 09:54