Comments (20)
Hey, @slawomir-marek, thanks for getting in touch.
Give me some time to investigate this behaviour, I'll keep you updated in this thread,
from appcenter-sdk-cordova.
Are you trying to send push notification while app is on the background, or in the foreground?
Is it only the first launch of the app that reproduces the problem, or every launch (without reinstalls)?
from appcenter-sdk-cordova.
We tried to send push notification when app was off or when it was in background.
We're sending notification through AppCenter API. After every attempt notifications were on the list in AppCenter but their status was showed as 0/x where x is the number of recipients. There was no error.
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.
from appcenter-sdk-cordova.
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:
- Launch app
- Minimize app (send it to background)
- Send push notification while app is in the background
To enable verbose logging, please add the following line to<AppFolder>\platforms\android\app\src\main\java\com\microsoft\azure\mobile\cordova\AppCenterShared.java
, insideconfigureAppCenter()
method beforeAppCenter.configure()
is called:
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.
from appcenter-sdk-cordova.
I'm having the same issue, and it seems related to AppCenter not initializing Firebase properly. I noticed this when looking at Logcat:
FirebaseInitProvider: FirebaseApp initialization unsuccessful
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.
from appcenter-sdk-cordova.
@larcho can you share repro steps so that I can confirm the problem? Thanks in advance
from appcenter-sdk-cordova.
Sure, this is a snippet of my config.xml:
<engine name="ios" spec="^5.0.1" />
<engine name="android" spec="^8.0.0" />
<engine name="browser" spec="^6.0.0" />
<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" />
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".
This is when I noticed that I wasn't receiving push notifications anymore.
I then proceeded with opening the generated Android Studio project and set AppCenter's verbose log to inspect for issues. That's when I noticed that Firebase wasn't being initialized correctly.
I have a feeling it has to do with the additional AppCenter .gradle file not being correctly executed.
from appcenter-sdk-cordova.
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):
- Init app like this:
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
- Following this instruction downloaded and copied
google-services.json
to root project folder (NOT platform-specific) and added
<resource-file src="google-services.json" target="app/google-services.json" />
to config.xml
's android
platform section
3) Following instructions from appcenter.ms portal added APP_SECRET
param to config.xml
's android
platform section.
4) Added plugins you mentioned in this post. At this point, this is what my config.xml
looked like:
<?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="[email protected]" 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>
- Removed
platforms
andplugins
folders from project - Run
cordova prepare
- Run
cordova run android
to test on physical device - Waited for app to launch, then minimized it with
home
button - Tested push from portal, verified push received.
from appcenter-sdk-cordova.
Hi
Sorry for delay. I followed your instruction:
- Enabled verbose logging
AppCenter.setLogLevel(2);
- Enabled loging into file
adb logcat | grep -i 'AppCenter' > logs.txt
- Installed and launched app
- Sent app to background
- Created push notification
As I expected I didn't received push notification. After second restart I started receiving notifications.
I added file with logs.
from appcenter-sdk-cordova.
Hey, @slawomir-marek
I think the issue is caused by the initial app start ran with debugger attached - for pushes to work normally, Firebase would require one launch without debugger. Might aswell be related to instant run
being turned on - if ran through Android Studio.
Can you confirm or dismiss those points?
from appcenter-sdk-cordova.
@Jamminroot this bug was found in production application - so without any attached debuggers. And I didn't run app through Android Studio.
from appcenter-sdk-cordova.
One thing from the logs you shared:
07-23 15:09:04.057 23125 23225 D AppCenterPush: Using old Firebase methods.
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 platforms/android
folder and run ./gradlew :app:dependencies
(maybe redirect output to a file) and upload the results?
Can you try on 0.3.6
plugin as well?
from appcenter-sdk-cordova.
Hi @slawomir-marek,
we haven't heard from you in a while so I'm closing this issue.
Feel free to reopen this issue if it isn't resolved or you have additional questions.
from appcenter-sdk-cordova.
@slawomir-marek,
I am having the exact same problem in a Xamarin.Forms app. We also experience that the android device has to restart in order for it to receive notifications.
Out of curiosity, did you manage to solve this issue in your app?
from appcenter-sdk-cordova.
@shnaz Could you open a new issue here and include all the information in the template? Otherwise, it's difficult for us to test your exact scenario.
from appcenter-sdk-cordova.
@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
from appcenter-sdk-cordova.
Same problem here. After send push in AppCenter, the result column in push notifications page, shows for a moment "QUEUED" and after one minute shows "0 / 0 sent".... I'm using Xamarin.Forms
from appcenter-sdk-cordova.
Hi @marciordonez ! Thank you for contacting us!
Could you open a new issue here and include all the information in the template? Otherwise, it's difficult for us to test your exact scenario.
from appcenter-sdk-cordova.
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.
from appcenter-sdk-cordova.
Hi @slawomir-marek ! Have you had a chance to take a look at this answer?
from appcenter-sdk-cordova.
Related Issues (20)
- framework not found Pods_AppName HOT 5
- ld: library not found for -lPods when running in XCode using Ionic HOT 3
- PhoneGapBuild build error HOT 14
- Error with phonegap build while compiling for ios HOT 10
- Auth SDK support for AAD B2C? HOT 1
- pod install limbo HOT 11
- Webhook Test - Title Change HOT 5
- Ionic 4: NullInjectorError: No provider for AppCenterPush! HOT 2
- Test hook web hoook HOT 2
- Npm outdated HOT 4
- build failed - Cannot add extension with name 'googleServices', as there is an extension already registered with that name. (cordova-plugin-firebasex compatibility) HOT 3
- Appcentre Data for Cordova
- Cordova build failed - cordova-plugin-appcenter-push HOT 2
- Framework tag with type=podspec is depreciated on iOS HOT 4
- Issue installing app center plugins HOT 4
- Using App Center with Capacitor HOT 1
- Build in Azure DevOps failed, even after sudo gem install cocoapods && pod setup HOT 6
- In-App Updates HOT 3
- Explanation on APP_SECRET HOT 2
- Appcenter Android HttpException 503 | ReasonCode: TooManyMessagesInFlight HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from appcenter-sdk-cordova.