Background Notification

Hi guys, i am new in framework7. I need to implement notification on my app.

Let say, i have message broker server. I use activemq. Then i try use Mqtt to connect to the message broker server. And i add my message payload into notification param. And then i use app.notification.create(param) to initiate notification also use notification.open() to open that notif. I have no problem from this.

The problem and What i want is, i need my notification could show in android notification on the backgroud if my app closed or running on the baground. How can i archive this?

Thankyou

You are looking at push notifications at that point. Assuming you are using Cordova to build as an app? If so, you will want to hook into something like a parse server or some other type of push service to facilitate that connection. Looking online it looks like you could also use 'AeroGears ’ with activeMQ to facilitate that.

From a parse perspective because thats what I use, you would have listeners in-app for parse, when a push notification is sent out, a user taps on the notification, it opens the app and can then pull data or alerts at that point. You can also pass data via your payload as well but it does have a limit so you will want to watch out for that.

Parse has a fairly simply API that you could trigger when you send a message to activeMQ but you need some type of service running in the app (outside of framework7) to communicate with the messaging service

If you are using Asia Device model such as Asus , Huawei ,Oppo notification It may not display when app closed unless you enable Auto start/Auto run in power management.

I have this issue and still looking for the best solution for user to get notification when the app closed.

My Solution.

  • check if device is Android and tell user to check power management and enable auto start.

Thank you Michl,

Yes, i am build app using cordova. Absolutely yes, we should use push notification. i assuming with activemq connected to the app, we just simple push payload and that trigger the notification without using push notif. So, from you explaination, there is no way to archive this except using push notification.

I’ll trying to implement push notification then.

Thank you

Hii ChooChu,

Yes i am in Asia continent, oppo, asus, xiaomi, etc are most popular brand in here.

I’ll consider your sugestion

Thank you

If you found any solution please let me know.
Now I just use auto start permission plugin to move user to auto start setting

This plugin you need to comment line 69-73 and put this

addAutoStartup(callbackContext);

So , it will not popup to ask yes/no but you can custom it by using your f7 dialog to move user to power management of each android device.