Giter Site home page Giter Site logo

Comments (8)

davidbritch avatar davidbritch commented on May 17, 2024 2

@K232 Before an Android app can receive push notifications, it must register with Firebase Cloud Messaging, which generates a registration token and returns it to the app. This is accomplished by:

  • Declaring a receiver in the Android manifest.
  • Implementing the Firebase Instance ID service (which is what the FirebaseRegistrationService class does).

When the app receives a registration token from Firebase, the FirebaseRegistrationService.OnTokenRefresh method is invoked, which in turn invokes SendRegistrationTokenToAzureNotificationHub, which in turn invokes AzureNotificationHubService.RegisterAsync.

The fact that AzureNotificationHubService.RegisterAsync is never called for you implies that the app isn't getting a token from Firebase, which implies either incorrect Firebase setup or the app not communicating with Firebase.

For more information about how to do this, see Sending Push Notifications from Azure Mobile Apps.

from azure-docs.

conceptdev avatar conceptdev commented on May 17, 2024 1

Thanks @K232, note that your emulator must be configured with Google Play Services (ie "a virtual device that has Google APIs set as the target"). The Play app should be present on the emulator - we'll make this more obvious in the doc.

We've identified this as a common cause of push notifications not working on emulators, since Google Play Services/Google APIs aren't automatically present in every emulator configuration (especially when it works fine on real hardware). You can read more about emulator configuration on the Xamarin site:

https://developer.xamarin.com/guides/android/getting_started/installation/android-emulator/google-emulator-manager/#Installing_System_Images

from azure-docs.

davidbritch avatar davidbritch commented on May 17, 2024 1

@K232 Also, I've fixed the deprecated SetSound API. However, I've no problems with Resource.Drawable.ic_stat_ic_notification. If it wasn't in the project, the app wouldn't build.

from azure-docs.

conceptdev avatar conceptdev commented on May 17, 2024 1

The doc and sample have been updated with the feedback from this conversation #please-close

from azure-docs.

K232 avatar K232 commented on May 17, 2024

Hmm, seems to be a problem of my emulator because on Hardware it works :-)

But nothing is displayed. Application output says:
[FirebaseNotificationService] Notification message body: Notification Hub test notification
[sfx] Unknown style!!! : com.android.internal.util.NotificationColorUtil@b5a3a2e

Downloaded demo app also has warnings on new Notification.Builder because SetSound is deprecated and Resource.Drawable.ic_stat_ic_notification is not found.

Any updates available?

from azure-docs.

amanarneja avatar amanarneja commented on May 17, 2024

Thanx for the feedback!
I have assigned this to the author to take a look if there are any issues with the steps in the document. Stay tuned :)

from azure-docs.

conceptdev avatar conceptdev commented on May 17, 2024

@K232 can you provide the link you used to download the demo app? Thanks!

from azure-docs.

K232 avatar K232 commented on May 17, 2024

Hi @conceptdev , it's from https://developer.xamarin.com/samples/xamarin-forms/WebServices/TodoAzurePush/ .

from azure-docs.

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.