OneSignal / OneSignal-Cordova-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Ionic, PhoneGap CLI, PhoneGap Build, Cordova, or Sencha Touch app with OneSignal. Supports Android, iOS, and Amazon's Fire OS platforms. https://onesignal.com
Other
250 stars 197 forks source link

Outdated Google Play Services App #68

Closed sirramin closed 7 years ago

sirramin commented 8 years ago

In my dashboard many users aren't subscribed and have the error Outdated Google Play Services App. I used plugin latest version in my app and sdk platfom v23.

jkasten2 commented 8 years ago

@sirramin This error is most likely correct. The device must have the same version or newer of the Google Play services library you built your app with.

See the OneSignal 2. All Users are shown as not subscribed for more details on this.

Thanks.

sirramin commented 8 years ago

In my Android SDK manager the Google play services is latest version number 31 & I couldn't downgrade it. and it's wired that many of my users with android version 5 or 6 aren't subscribed. So what can I do?

sirramin commented 8 years ago

please help me on this

jkasten2 commented 8 years ago

@sirramin Since version 32 of the "Google Repository" is 9.4.0 of the Google Play services library I believe 31 is version 9.2.1. Unfortunately Google requires the version of the services app to be the same or higher than the library version. This however shouldn't be an issue if your app is being downloaded from the Google Play store as it keeps this up to date on the device automatically for the user.

If your app is distributed through other stores or channels using a new version of the library in your app may be an issue. You can do one of the following to update it.

  1. Delete all 9.X.X folders under <android-sdk-root>\extras\google\m2repository\com\google\android\gms\play-services-*.
  2. Download and/or fork this repo then change the following 3 lines to an older version of Google play services. 7.0.0 is the oldest version OneSignal will support. https://github.com/OneSignal/OneSignal-Cordova-SDK/blob/1.13.0/plugin.xml#L29-L32
jkasten2 commented 8 years ago

@sirramin Quick update, release 3.0.2 of our Android native SDK used by this plugin fixes the device needing the same or newer requirement of the Google Play services. This issue will be resolved when we update this SDK to use this version.

sirramin commented 8 years ago

@jkasten2 Thank you for you answers. I tried both your solutions but unfortunately the problem still exists. When the new plugin will be released?

p.s: solution number 1 cause this error:

  • What went wrong: A problem occurred configuring root project 'android'.

    Could not resolve all dependencies for configuration ':_debugCompile'. Could not find any version that matches com.google.android.gms:play-services-gcm:+. Searched in the following locations: https://repo1.maven.org/maven2/com/google/android/gms/play-services-gcm/maven-metadata.xml https://repo1.maven.org/maven2/com/google/android/gms/play-services-gcm/ file:/D:/Software/android-sdk-windows/extras/android/m2repository/com/google/android/gms/play-services-gcm/maven-metadata.xml file:/D:/Software/android-sdk-windows/extras/android/m2repository/com/google/android/gms/play-services-gcm/ file:/D:/Software/android-sdk-windows/extras/google/m2repository/com/google/android/gms/play-services-gcm/9.4.0/play-services-gcm-9.4.0.pom file:/D:/Software/android-sdk-windows/extras/google/m2repository/com/google/android/gms/play-services-gcm/9.4.0/play-services-gcm-9.4.0.jar

jkasten2 commented 8 years ago

@sirramin With solution 2 did you try removing the OneSignal plugin and add the one you downloaded by fully pathing it?

cordova plugin rm onesignal-cordova-plugin
cordova plugin add /full/path/to/repo/here
sirramin commented 8 years ago

@jkasten2 yes I fork this repo and I changed the plugin.xml file line 29 to 31 like As follows:

<framework src="com.google.android.gms:play-services-gcm:8.4.0" />
    <!-- play-services-analytics is only required when gms version 8.1.0 or older is used. -->
    <framework src="com.google.android.gms:play-services-analytics:8.4.0" />
    <framework src="com.google.android.gms:play-services-location:8.4.0" />

then remove and install forked (modified) repo but new error apears in OneSignal dashboar for my device: Google Play services library initialization error. Check for conflicting plugins and make sure "com.google.android.gms.version" is in your AndroidManifest.xml. Am I doing anything wrong?

jkasten2 commented 8 years ago

@sirramin I reviewed your commit https://github.com/sirramin/OneSignal-Cordova-SDK/commit/4ce0f7834cca65436eecb4b4a17cd27b10576cdc and I see @aar was added. I have not tried this so it may create an issue.

Your comment above has the correct lines however. You were testing with this local copy then?

sirramin commented 8 years ago

@jkasten2 Thank you for your great support I removed the @aar from my repo and install the plugin again fix the problem. Another question using version 8.4.0 of google play services may influence on other parts and plugins in my app?

jkasten2 commented 8 years ago

@sirramin If you have another other plugins that depend on Google Play services it may. Most of the time it is a build issue not a run time issue however. You can list your plugins and we can double check them.

Thanks.

sirramin commented 8 years ago

@jkasten2 Hello again, I published my app (built with play-services-gcm 8.4) to 5 custom stores and google play but still many of my users couldn't receive notifications.

jkasten2 commented 8 years ago

@sirramin It is most likely due to users not having the required "Google Play services" app at all or an original version bundled with the device if they have never open the Google Play store and signed in.

sirramin commented 8 years ago

@jkasten2 Using version 8.4 in plugin.xml cause conflict with this plugin when building the app.

jkasten2 commented 8 years ago

@sirramin The versions are different which creates the conflict. The plugin is trying to use the latest and you have forced a lower version for OneSignal. However you can do one of the following as a work around.

  1. Fork that plugin as well and change it's gms version in plugin.xml to match OneSignal's.
  2. Or delete your <android-sdk>\extras\google\m2repository folder and download an old Google Repository like revision 16 (gms 7.0.0) as a replacement. Use the original OneSignal SDK.
nunoarruda commented 8 years ago

I'm trying to test the push notifications of my Ionic 2 app using an Android emulator and I'm having the same problem:

screen shot 2016-09-25 at 21 52 10

I have the latest version of Google Play services installed, I'm using the SDK platform/image Android 6.0 (Marshmallow) [API Level 23] and onesignal-cordova-plugin 1.13.2.

Any ideas?

sirramin commented 7 years ago

@jkasten2 I couldn't still solve the problem with your solutions As a work around can I disable the popup "To receive notifications please press ..." ? What about a translated popup message ?

jkasten2 commented 7 years ago

@sirramin @nunoarruda We have released our 2.0 SDK, this fixes all out of date issues with Google Play services.

See our new setup guide which includes new initialization code. https://documentation.onesignal.com/docs/cordova-sdk-setup

yaseralimardany commented 6 years ago

I got this error in logcat: E/OneSignal: Unknown error getting FCM Token java.lang.NoSuchMethodError: No static method isDeviceProtectedStorage(Landroid/content/Context;)Z in class Landroid/support/v4/content/ContextCompat; or its super classes (declaration of 'android.support.v4.content.ContextCompat' appears in /data/app/com.motoshubapp-2/base.apk) at com.google.firebase.FirebaseApp.zza(Unknown Source) at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) at com.onesignal.PushRegistratorFCM.initFirebaseApp(PushRegistratorFCM.java:64) at com.onesignal.PushRegistratorFCM.getToken(PushRegistratorFCM.java:50) at com.onesignal.PushRegistratorAbstractGoogle.attemptRegistration(PushRegistratorAbstractGoogle.java:97) at com.onesignal.PushRegistratorAbstractGoogle.access$100(PushRegistratorAbstractGoogle.java:37) at com.onesignal.PushRegistratorAbstractGoogle$1.run(PushRegistratorAbstractGoogle.java:84) at java.lang.Thread.run(Thread.java:818)

jkasten2 commented 6 years ago

@yaseralimardany The ContextCompat. isDeviceProtectedStorage method is missing from your app which was added in version 24.1.0 of the Android support library. Since it is missing it would seem some other plugin in your project is lower this version. Can you run cordova plugin list and reply with the results.

Since your error is different enough from others I recommend creating a new issue.