Giter Site home page Giter Site logo

Comments (7)

wunter8 avatar wunter8 commented on June 9, 2024 1

The ntfy Android app typically keeps a persistent connection open to the ntfy server using a background process/service. If that persistent connection fails (and the app was installed from the Play Store and not from F-Droid), ntfy will fallback to receiving notifications via FCM, which does work in the background, like you said.

All of the Android code is open-source, so you can look at it directly to see how things work. https://github.com/binwiederhier/ntfy-android It is in Kotlin, though, not Flutter/Dart.

UnifiedPush is cool because it lets your app receive notifications through ntfy's persistent connection. So you don't need to worry about setting up any sort of persistent network connection with graceful FCM back up. As long as ntfy is installed on the same device as your app, your app can benefit from ntfy's persistent connection. In your app, I believe all you need to do is set up a BroadcastReceiver that listens for UnifiedPush messages.

This describes UnifiedPush more and includes a Flutter example: https://unifiedpush.org/developers/flutter/

from ntfy.

wunter8 avatar wunter8 commented on June 9, 2024 1

I don't know for sure. I haven't used FCM very much. But I'm pretty sure you can use whatever you want. Since you're building the app, you get to decide how notifications and subscriptions work. I believe ntfy is set up to subscribe to a FCM topic that's the same as the ntfy topic, though

from ntfy.

wunter8 avatar wunter8 commented on June 9, 2024

When you close the app, it's closing the connection to the ntfy server. You'll probably want to look into and implement UnifiedPush. Or you'll need to implement something else to keep a connection to the server open in the background

from ntfy.

iamrishan avatar iamrishan commented on June 9, 2024

Yeah! I know Firebase has a background function to workwith background notification using FCM.
But how does the ntfy.sh android app can do this. if they can do it there will be a way,,,
if the app is closed still the notification is coming in this app when a new message is send to that topic

from ntfy.

iamrishan avatar iamrishan commented on June 9, 2024

Thanks for the insight. I will check on the resources

from ntfy.

iamrishan avatar iamrishan commented on June 9, 2024

@wunter8 hey I tried to implement it with FCM. I stuck where I need to subscribe to a topic in FCM to receive notifications in the background .
I tried the same topic as my nfty topic but I think that's not it.
do you tend to know what will be the server topic for my specific nfty topic (eg. mytopic in ntfy.sh)?

image

from ntfy.

iamrishan avatar iamrishan commented on June 9, 2024

thanks

from ntfy.

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.