-
Notifications
You must be signed in to change notification settings - Fork 27
Push notification didn't show on device with Android #95
Comments
Hey, @slawomir-marek, thanks for getting in touch. |
Are you trying to send push notification while app is on the background, or in the foreground? |
We tried to send push notification when app was off or when it was in background. I was in contact with AppCenter support and they wrote me, that it could be related with delay in propagation of deviceID throug AppCenter servers. But after that I found that this bug occurs only with latest version of plugin (0.3.5) and only on Android devices. Described problem has always occurred after app installation. Then user had to turn off/on app few times. After that action he was able to receive push notifications. If he tried to reinstall app the same problem has occurred once again. We also tried to wait some time after installation and first launch to check if is it related with delay in propagation of device ID. In our case we still hasn't been able to receive push notification. |
We've checked your scenario on newly created app, and couldn't reproduce your problem - push notification appeared correctly while app is either in the background or closed. Can you enable verbose logging for device with a problem, and provide logcat output after running through the following scenario:
AppCenter.setLogLevel(2); That would help us understand what is missing and figure out how can we help you resolve SDK problem. Thanks in advance. |
I'm having the same issue, and it seems related to AppCenter not initializing Firebase properly. I noticed this when looking at Logcat:
After adding Firebase to the projects .gradle file it worked (adding the dependencies and applying the plugin at the end of the gradle file). Seems odd though, considering documentation states that AppCenter includes Firebase in the plugin. |
@larcho can you share repro steps so that I can confirm the problem? Thanks in advance |
Sure, this is a snippet of my config.xml:
I then proceed with "cordova prepare" (I before delete the folders platforms and plugin to assure a clean prepare) and tested the APK first with "cordova build android". I have a feeling it has to do with the additional AppCenter .gradle file not being correctly executed. |
We still can't reproduce the problem. @larcho, can you kindly run through the list below, and correct me on what I have probably missed? Thanks in advance. Here is what I did (pelase ignore unnecessary steps, since I wanted to be 100% sure I tried to reproduce problem):
cordova create ctapp com.demo.ctapp ctapp
cd ctapp
cordova platform add android
cordova platform add ios
cordova plugin add cordova-plugin-appcenter-analytics
cordova plugin add cordova-plugin-appcenter-push
<resource-file src="google-services.json" target="app/google-services.json" /> to <?xml version='1.0' encoding='utf-8'?>
<widget id="com.demo.ctapp" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>ctapp</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<plugin name="cordova-plugin-appcenter-analytics" spec="~0.3.4" />
<plugin name="cordova-plugin-appcenter-crashes" spec="~0.3.4" />
<plugin name="cordova-plugin-appcenter-push" spec="~0.3.4" />
<plugin name="cordova-plugin-code-push" spec="~1.11.19" />
<plugin name="cordova-plugin-file" spec="~4.3.3" />
<plugin name="cordova-plugin-file-transfer" spec="~1.6.3" />
<plugin name="cordova-plugin-zip" spec="~3.1.0" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<resource-file src="google-services.json" target="app/google-services.json" />
<preference name="APP_SECRET" value="<SECRET>" />
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
</widget>
|
Hi Sorry for delay. I followed your instruction:
As I expected I didn't received push notification. After second restart I started receiving notifications. I added file with logs. |
Hey, @slawomir-marek |
@Jamminroot this bug was found in production application - so without any attached debuggers. And I didn't run app through Android Studio. |
One thing from the logs you shared:
I do not get that in a blank application with either 0.3.4, 0.3.5 or 0.3.6 appcenter plugins. The first run problem is something that we addressed recently and should have been present in 0.3.6 and probably 0.3.5 too. In your case the first run does not send the push token in that setup because of a mismatch of firebase version apparently, thus we get token only via polling and not via callbacks, which works only from second run onward. As for the second run it tried to but you got 503 errors in the logs because there was a problem in production at that time. The 503 errors should be resolved if you try now but that leaves the problem of the first run. Can you go to Can you try on |
Hi @slawomir-marek, |
@slawomir-marek, |
@russelarms Ofc. I will do that as well. But if @slawomir-marek wants to share his solution, it would benefit anyone else who stumbles upon this issue. Best regards |
Hi @marciordonez ! Thank you for contacting us! |
HI @marciordonez I didn't solve this issue. I left this problem because of other important topics in my project. Today I returned to that and I tried to install latest version of plugin (0.4.1). Nothing changed - problem still occurs. |
Hi @slawomir-marek ! Have you had a chance to take a look at this answer? |
Description
Some time ago we updated cordova-plugin-appcenter-push from version 0.3.4 to 0.3.5. After that we noticed that we've had problems with receiving push notifications on devices with Android system. On devices with iOS everything worked as expected. When we replaced plugin with previous version everything worked perfect.
Repro Steps
In our case to reproduce this bug we have to:
Details
0.3.5
Android 8, Android 9
Cordova version 8.0.0
Nokia 7Plus, Huawei P10 Lite
cordova-android-firebase-gradle-release 3.0.0 "cordova-android-firebase-gradle-release"
cordova-android-play-services-gradle-release 3.0.0 "cordova-android-play-services-gradle-release"
cordova-plugin-actionsheet 2.3.3 "ActionSheet"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-appcenter-analytics 0.3.5 "App Center Analytics for Cordova"
cordova-plugin-appcenter-push 0.3.5 "App Center Push for Cordova"
cordova-plugin-appcenter-shared 0.3.5 "App Center shared code for Cordova"
cordova-plugin-background-mode 0.7.2 "BackgroundMode"
cordova-plugin-browsertab 0.2.0 "cordova-plugin-browsertab"
cordova-plugin-camera 4.0.3 "Camera"
cordova-plugin-cocoapod-support 1.6.0 "Cordova CocoaPods Dependency Support"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-contacts 3.0.1 "Contacts"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-inappbrowser 3.0.0 "InAppBrowser"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 3.1.2 "cordova-plugin-ionic-webview"
cordova-plugin-ms-adal 0.10.1 "ADAL for Cordova"
cordova-plugin-network-information 2.0.1 "Network Information"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-sqlcipher-adapter 0.2.1 "Cordova sqlcipher adapter"
uk.co.workingedge.phonegap.plugin.launchnavigator 5.0.4 "Launch Navigator"
The text was updated successfully, but these errors were encountered: