Giter Site home page Giter Site logo

Comments (20)

Jamminroot avatar Jamminroot commented on May 18, 2024

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.

Jamminroot avatar Jamminroot commented on May 18, 2024

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.

slawomir-marek avatar slawomir-marek commented on May 18, 2024

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.

Jamminroot avatar Jamminroot commented on May 18, 2024

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:

  1. Launch app
  2. Minimize app (send it to background)
  3. 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, inside configureAppCenter() method before AppCenter.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.

larcho avatar larcho commented on May 18, 2024

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.

Jamminroot avatar Jamminroot commented on May 18, 2024

@larcho can you share repro steps so that I can confirm the problem? Thanks in advance

from appcenter-sdk-cordova.

larcho avatar larcho commented on May 18, 2024

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.

Jamminroot avatar Jamminroot commented on May 18, 2024

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):

  1. 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
  1. 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>
  1. Removed platforms and plugins folders from project
  2. Run cordova prepare
  3. Run cordova run android to test on physical device
  4. Waited for app to launch, then minimized it with home button
  5. Tested push from portal, verified push received.

from appcenter-sdk-cordova.

slawomir-marek avatar slawomir-marek commented on May 18, 2024

Hi

Sorry for delay. I followed your instruction:

  1. Enabled verbose logging
    AppCenter.setLogLevel(2);
  2. Enabled loging into file
    adb logcat | grep -i 'AppCenter' > logs.txt
  3. Installed and launched app
  4. Sent app to background
  5. Created push notification

As I expected I didn't received push notification. After second restart I started receiving notifications.

I added file with logs.

AppCenterLogs.txt

from appcenter-sdk-cordova.

Jamminroot avatar Jamminroot commented on May 18, 2024

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.

slawomir-marek avatar slawomir-marek commented on May 18, 2024

@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.

guperrot avatar guperrot commented on May 18, 2024

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.

MatkovIvan avatar MatkovIvan commented on May 18, 2024

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.

shnaz avatar shnaz commented on May 18, 2024

@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.

russelarms avatar russelarms commented on May 18, 2024

@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.

shnaz avatar shnaz commented on May 18, 2024

@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.

marciordonez avatar marciordonez commented on May 18, 2024

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

image

from appcenter-sdk-cordova.

AnastasiaKubova avatar AnastasiaKubova commented on May 18, 2024

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.

slawomir-marek avatar slawomir-marek commented on May 18, 2024

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.

AnastasiaKubova avatar AnastasiaKubova commented on May 18, 2024

Hi @slawomir-marek ! Have you had a chance to take a look at this answer?

from appcenter-sdk-cordova.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.