Push Notification When App is closed/Quit including - push-notification

Can anyone please so let me know precisely that how can I accomplish the task in which I need to show Push Notification to user when App is Quit/closed?
Currently, I am able to get the push notification done when App is running in background or opened. But App couldn't receive Notification when it is quit/closed by the user.
Right now, it's a really critical task on my shoulders. It's pretty clear do tell me in case if you guys need me to brief in details.

I am having a very hard time to believe that your scenario is Really the following:
When the app is either: open and in the foreground, or open and in the background, you are able to receive a notification to the device, and have its contents displayed in the app, but
When the app is quit (as in not running), the notification does not arrive to the device at all.
I have tested several devices and several push-enabled applications (event source, tag-based). The notification does arrive to the device, after the user subscribed to either a tag or by logging-in (in the case of event source-based), after which sending a notification always arrived to the device.
I don't understand this sentence:
my app logouts with the user
You need to be CLEAR in your explanation. Is there a logout button that the user clicks? If yes, are you also for some reason perform an unsubscribe API invocation? If no, edit the question and provide DETAILED, step-by-step reproduction instructions, AS WELL as provide your application, or any code that you use so that it could be inspected for possible issues.

Related

Forcibly bring up a page with continuouse ringing to notify the user (even if the device is locked) in a Flutter app on both Android and iOS platforms

I'm currently developing an app for restaurants that receives orders from a firebase push notification.
I need a way to notify the users of the app by forcibly opening a page with a high volume of ringing (something like an alarm page, where you have a dismiss and a snooze button, or a phone ringing page with accept or decline call button) when an order arrives, so that they can dismiss and go to their current orders page.
My main issue is that I can't seem to be finding a way that opens this piece of UI forcibly on both Android and iOS platforms (since the app is being used on both), and even when the device is locked (though not mandatory, but could be super helpful).
If the issue is insoluble in one dart code, can someone please provide me with a way to implement on both of the platforms? Any workarounds are welcomed too.

Kill app in ios actually does not kill from OS

I m using Device.BeginInvokeOnMainThread(() => { Thread.CurrentThread.Abort(); });
System.Diagnostics.Process.GetCurrentProcess().Kill(); this in xamarin.forms to kill app in ios through dependency service.
But actually it is not killing the app when i press the home button it is still showing.
Can anyone help me out of this?
This is not possible. From the Apple technical Q&A (https://developer.apple.com/library/archive/qa/qa1561/_index.html):
A: There is no API provided for gracefully terminating an iOS
application.
In iOS, the user presses the Home button to close applications. Should
your application have conditions in which it cannot provide its
intended function, the recommended approach is to display an alert for
the user that indicates the nature of the problem and possible actions
the user could take — turning on WiFi, enabling Location Services,
etc. Allow the user to terminate the application at their own
discretion.
Although the documentation is pretty old, this still stands. Even if you do find some way to implement it, it will never be allowed to the App Store.

How not to send FCM to users who don't want to receive push?

With GCM, when user expresses their preference whether they are willing to get notifications, we could mark their preference as active or inactive
How can I achieve similar effect with FCM?
When user says they don't want to receive pushes, we'd have to unsubscribe the user from all the topics we have?
Are there better approaches?
Depending on the scenario, unsubscribing from the topics is the way to go.
However, if your goal is to simply prevent the user from seeing any push notifications appearing on their screen, a workaround I could think of is have a setting (e.g. enable/disable notifications) that identifies if you should/shouldn't display a notification every time the user receives one.
For example, user installs the app. Initially, the setting defaults to enabled. Push notifications are displayed normally. If user disables it, when the device receives the message, you do not create a notification display.
For this to work, I'm thinking the checking should be done inside the method where you create the notification (e.g. sendNotification).
So the scenario now is that the device is still technically receiving the notification, it's just that you're not showing/displaying it to the user.
Note: I haven't tried to go with this scenario myself, so I'm not sure if this is breaking any best practices. I would still go with the unsubscribing if it were me though. It's easier.

Sending a RESTful url (endpoint) from Band

I just have a general question. Can you send a url from a button on the band. I have a home automation system that you can trigger events by sending a RESTful url (endpoint) to. Basically I can put the url in any web browser and trigger the event. It would be great if this could be done through the Band. I don't really need a response from the Url, just to send it.
Does that make sense?
Thanks,
Scott
No, the Band communicates only via Bluetooth to (applications on) its paired device. On Windows (Phone), the application must be running, with a connection to the Band, and subscribed to the Tile button pressed event in order to receive such notifications. This generally rules out scenarios that require ad-hoc input from the Band unless you're willing to use voice commands via Cortana.
But i think its possible by creating custom tile and handling custom tile events. Haven't tried it in my project but can see from sdk documentation.
For android you can implement broadcast receiver and listen to tile events. Check: sdk doc
Chap 9, page 51
In short, yes it is possible.
However, the problem would be that the button would be single use to only send that ONE URL command and it actually wouldn't be done via the Band.
You can create custom layouts for your applications with the Microsoft Band SDK which will allow you to create a button. You'll then need to register to the click event from the Band which then would get fired on the device the app is running on. From there, you'd be able to send the URL but it would be sent from the Windows Phone or Windows PC rather than the Band so you'd need to be connected. The documentation covers how you can do this here: http://developer.microsoftband.com/Content/docs/Microsoft%20Band%20SDK.pdf
A downside to doing this with WinRT is that as soon as the app is closed and the connection to the Band is lost, your button click won't have any action. The best way to get around this is to create the connection to the Band in a background task but unfortunately, you can't keep hold of the connection to the Band for an infinite amount of time and you'd have to live with the possibilities that you may have times where it doesn't work. I have a GitHub sample which shows you how to connect to the Band in a background task for an indefinite amount of time.
The Microsoft Band has really been developed for the Health aspect and collecting data rather than interactions with other apps which it does in some way support.

How can I increment a Windows Phone tile notifications counter with Push Notification (not knowing the actual counter value)?

I am sending a XML with the "Count" parameter for tile update, and the tile is updating with that value, no problem here.
But I don't know how many pending notifications the user actually has, to increment. I see WhatsApp increments the counter immediately after I got a message. The only way to do this is to store the "unread" count in the server? I wouldn't like to do this because the user can: receive the notifications, disconnect, open the app (that will reset the counter), close, and connect to internet. When it happens, the "unread" count will be incorrect after a new notification.
(I'm using a standard tile for WP 7 compatibility)
Maybe this is a hint from the design gurus -- you might not need to show the user exactly how many unread notifications s/he has. Instead, you could make the push notification simply set a visual flag that there are some unread notifications. When the user opens the app, it displays all the queued notifications and resets the visual flag. Like a knock at the door: once you go to the door, you're going to let in however many dwarves you find waiting there.
Alternatively, you could use raw push notifications sent directly to the app, and let the app locally update the count on the tile.

Resources