Push Message not received when App was in Airplain Mode - xamarin.ios

Today I tested if a sent push message gets received when I connect back to internet but I did not receive it.
My Test Case:
Activate Airplain Mode
Send Push Message
Deactivate Airplain Mode, connected back to Internet
Expected Behaviour:
Get Push Message
Actual Behaviour:
Nothing received
I use a Push Notification Hub that is connected to my Azure Mobile Apps Backend.
Edit: Sometimes the Push Message arrives, sometimes not.

That is expected behavior. Push notifications do not get queued by the various providers in general. They expire, usually relatively quickly.

Related

Getting multiple change notification from graph api while sending URL's in Microsoft Teams channel message

I have been using graph API provided by Microsoft to subscribe to change notification for teams message.
It's all working fine for normal chat messages but when i try to send any message containing URL's it sends two/three notifications and sometime it works fine (sends only one).
I have gone through the docs and followd the protocals like sending 202 response conde to acknowledge the notification has been received as soon as i receive the notification and run other functionalities in another thread.
I couldn't find more info on for this inconsistent behaviour.
So far I tried to minimize the process after receiving notification on webhook receiver route by performing other actions like extracting channel,message id and retriving message in different thread and sent HTTPResponse of 202 as soon as i receive the notification.

How to turn off FCM's automatic notifications with code, when the App is in the background?

My app has an option to turn on/off FCM notifications.
I can not show FCM notification when the App in foreground.
But how to turn off the notification function of FCM when the App in background?
Turn off FCM functionality with code in Android Studio.
Firebase Cloud Messaging has two payload types in its messages:
Notification payloads, which is handled by the system itself if the app is not active, and can be handled by your code if the app is active.
Data payloads, which are always handled by your code. This code can then display a notification, but it can also do something else (or nothing at all) with the data.
If you send a Notification message and the app is not actively being used, that message is handled by the system and there's no way to prevent it from being displayed.
So you have two options:
Always send message with (only) a data payload, so that your own code can handle it - and display a notification if the user hasn't disabled that.
Don't send a message with a notification payload if the user has disabled receiving notifications.

Xamarin.iOS - PushNotification when the device is off

Hi I would like to know if it is possible getting the push notification the server sent while the device os turned off.
How do I configure the app and the Azure Notification Hubs to know the device did not received the notification at the moment it was sent and show them when it gets on (or online) again?
Is it possible to do?
Thank you
Azure Notification hub just tells you a notification has been delivered. There´s no way to get a "received" confirmation if that is what you are looking for. This has actually nothing to do with Azure, it´s just how Apple Push Notification Service (connected with Azure) works.
Apple Push Notification Service (APN) will retain/cache the last (and only the last) notification sent while the device is off. Once the device is online, APN will try to send the notification again. But there is a time limit after which cached notifications will be lost, and that means your notification may never arrive its destiny.
If you really need to get arrival confirmations (ie: like whatsapp confirmations) you should implement it yourself. That would be another question but here are some hints:
You include an uid in the notification payload
You save that uid in your server database, in a table that tracks the "pending notifications".
Device opens the notification and sends an arrival confirmation to the server, passing the uid as parameter => you delete the "pending notification" record on your database table.
How would you resend the pending/lost notifications?
Option 1: Implement some kind of a background job that checks (in time periods. ie: once every 5 minutes) what notifications didn´t arrive and resend them until they are correctly confirmed.
Option 2: when your mobile app starts, send a message to the server telling "hey, I´m online again". Then process and send all the pending notifications specific to that user/device, deleting them from the pending notifications table.

Queues in IOT Hub

I have the following situation in Azure IOT Hub:
Script sends message to device queue. Listening with device explorer: Succes
Script listens for message to device queue. Sending with device explorer: Succes
This problem arises:
Script listens for message to device queue. Other script sends message to device queue: Listener does not receive the message.
So, it works well using the device explorer tool. But with the scripts only, the listener does not receive.
I hope someone might be able to help me with this issue.
There might be two possible problems on your side:
a) Device Explorer shows messages only from one device. If you have two separate device clients, you have to select another one.
b) But it's possible that you send and receive on two separate scripts with one deviceId (clientId) - it might be the problem.

How to send push notification using XMPP Server?

I want to develop a chat application in iphone. I'm using ejabberd xmpp server. Now i'm able to send message to other user.
Now i want to receive the message with push notification.
I heard that we can use xmpp servers to send push notifications.
So Can anyone tell me, I want to know how
Is it possible to send push notification with ejabberd
Is it possible send push notifications from ejabberd xmpp server using node js.
Please give any suggestion to start using notifications for messages in xmpp.
If you want to send push notifications with ejabberd community edition, you need to add an ejabberd module, which sends the offline messages to a specified push notification provider. This provider send the notifications to apple APNS or googles GCM.
You could develop a module by self or maybe you will find some in inet. mod_zeropush (https://github.com/ZeroPush/mod_zeropush) would be one of them, but the zeropush service by self is canceled. Another one would be mod_onesignal (https://github.com/nobreak/mod_onesignal). OneSignal is a free to use Push Notification provider.
XMPP requires a persistent socket connection or a "persistent" BOSH connection during your whole XMPP session. Whenever your iOS app goes in background iOS kills your socket connection, and your Openfire server kills your XMPP session. This means the user goes offline. Which is also the reason why incoming messages for this user go to the offline storage.
A more straight forward approach is to do something in openfire, when openfire can't deliver a message it stores it in offline table, we can do some interception on that part and initiate the push process with the message.

Resources