App Delegate Behaviour when app is in different States - xamarin

I have some logic within my app delegate on iOS for handling incrementing a push notification badge - but have had intermittent behaviour with this for some users.
The app is registered for background remote notifications.
Notifications are received fine when app is in foreground, background or phone is restarted.
A few different scenarios occur:
Foreground - notification & badge.
Background - notification & badge.
App Killed - notification & badge sometimes
Device Restart - notification & no badge.
My question is - does App Delegate code run when an iOS app is killed by the user (for a period of time -i.e until another app takes up that space in RAM) and does App Delegate code not run at all if the device is restarted?

Related

The triggered notifications are not receiving in to the android devices

The triggered notifications are not receiving in to the android devices, and these scenario's are failing to receive the notification.
1) When the Android/iOS mobile app doesn't has the internet but notifications are triggered from the FCM Console or FCM Api(We developed the api to trigger notifications). Few minutes later Android/iOS mobile app get internet access, immediately Android/iOS mobile app should get all triggered notifications. But Android mobile app doesn't receive the any notifications, iOS mobile app able to receive the all notifications.
2) We have Scheduler to schedule the notifications by Daily basis, the android mobile app is not receiving the scheduled notifications from the FCM Server, but iOS mobile app received all scheduled notifications from the FCM Server.
Kindly requesting you please help me to resolve these scenario.
Let me know if you require more information on my side.
Push notifications are managed by firebase service for Android. Google software decides how to queue and when to push notifications to the device. If you are pushing iOS notifications through firebase, Apple service decides when to push notifications to the device. That means that these services doesn't have to follow the same pattern. The real question is if all notifications are received finally by android device or not. If all there is no error in your code. What you can do is to set higher priority for android notifications. Google service takes in count traffic, battery state and several other factors when sending notifications to device. If Android device does not receive any notifications during lets say 1 hr, you should revisit your code.

Parse Push Notification on Amazon Fire TV only received upon app restart

About a week ago, I began noticing my Android app stopped receiving Parse push notifications, but received just one notification (even if there were more than one) upon app restart.
Since then, I've updated to SDK 1.10.3 (from 1.10.1) and I'm still using PPNS 1.10.1 since 1.10.3 doesn't have a PPNS jar and the Amazon Fire OS doesn't support GCM. However, I'm still experiencing the same issue.
Here is the related logs upon app starting up:
V/PPNSService: Received request to start service if required
D/com.parse.push: successfully subscribed to the broadcast channel.
V/com.parse.PushConnection: PushConnection transitioning from com.parse.PushConnection$WaitStartState#4112f5f8 to com.parse.PushConnection$ConnectState#41150560
V/com.parse.PushConnection: PushConnection transitioning from com.parse.PushConnection$ConnectState#41150560 to com.parse.PushConnection$ConnectedState#419cca40
E/message: {"action":"com.familiair.display.UPDATE_STATUS","old_channel_id":43,"push_hash":"d41d8cd98f00b204e9800998ecf8427e","type":"channel","new_channel_id":44}
The last log line is my app printing out the message of the push notification, so the device is definitely receiving push notifications, just only the first one on app start. I have been manually sending push notifications from the Push dashboard. The fact that I'm still receiving one push notification upon app start means that there's nothing wrong with the push message and that it's targeting the correct device.
The push dashboard says it successfully delivered the push notification. Before this week, all push notifications were being received on my Amazon Fire TV devices.
Any help would be appreciated.

How can I run my application or some specific methods in background in windows phone

I want to run my application in background when i click on windows button.
Basically I have some methods of XMPP and when I goes to background it changes its status and presence from online to offline. I want this to be run in background.
Just because of the status is offline I am not able to receive any toast notification from XMPP.
If any one has idea about XMPP then please help to resolve this as well.
Any help will be much appreciated.
Thanks,
Nishant
You cannot make your app run in the background. I think that other IM apps use a push mechanism. So you need a server, when you app is exited, you tell the server to make the user seem still online and when a message arrives for the user, you send a push notification to the device. Whne the user taps the push notifictaion popup, your app will be started.
On Windows Phone "normal" apps cannot run continuous in background. XMPP normally requires a persistent long living TCP/IP connection during your complete session.
There are different ways to solve this problem:
1. create a app which can run in background, e.g a location tracking app or voice app
Log off when your app goes in background, you will not receive any message until your login in foreground.
Log off when your app is in background and also use a background service which log on in the interval of eg. 30 minutes and checks for new messages. But that's far away from being realtime and the idea of XMPP ;-)
Use a combination of XMPP and Push messages. XMPP while you are in foreground and Push when you are in background.
create a proxy between your app and the XMPP server and use Push. This means your app does not create the XMPP connection iself. Your app tells only your "proxy server" to login user X now. Your "proxy server" creates the XMPP connection and it can stay there 24/7 connected, doesn't matter whether your app is in background or not. Your app can communicate with your "XMPP proxy" over push or any other protocol choose.
Which solution your choose depends on your unique requirements. For chat apps like WhatsApp a background service is normally not appropriate because your messages are delayed for up to 30 minutes and your are not available while the background service does not run. While for other business apps this may be fine.

How is whatsapp fetching message in background in windows phone?

After the latest update of Whatsapp on Widows Phone Store, I have noticed that now, once they show the toast of message on my device, then they mark the message as delivered (notify the sender that the message has reached my device).
After I let the toast notification go away, I switched off all my data connection and opened Whatsapp and found that that particular message in my app. This is happening consistently on both wp7 and wp8 device. This was happening even when I had disabled background agent! Beside background agent of an app does not run all the time.
So my questions is, on windows phone platform, where the app is not allowed to run in background all the time, how is Whatsapp application getting those messages? Is it using any particular api/hack to get(in app) those messages when it's not on foreground.
The question you have asked has two parts: one for wp7 and the other for wp8. I will anser each one by one.
Windows phone 7
Based on my research, I have found that whatsapp is still using audio streaming api on wp7 devices to stream messages in the background i.e. when the app is not running. Whatsapp was criticized of using this API as constantly using this causes battery drainage as well as hampers the music experience of the user.
Windows Phone 8
Once whatsapp moved to wp8 they stopped using the Audio API and moved to VOIP API. Note that whatsapp doesn't use VOIP for any purpose but their manifest shows usage of VOIP api, and after reading many articles I have come to the conclusion that they are using this API to activate background agent and pool messages in the background.
While sending raw push of type 4, the background agent for VOIP is activated in which you can practically do anything from reading the payload to establishing a new socket connection subjected to restriction on usage of certain APIs
I have also found out that even if a user disables bg agents for an app some essential bg agent still continue to run for eg bg agents in audio stream API and VOIP API.
I hope this answers your question.
Go through this link
Push notification for Windows Phone
What will help you to understand is
The server maintains a maximum of 30 notifications (regardless of type) for each URI. Once the limit of 30 is reached, all new messages sent to the server are discarded until the device reconnects and the queue can be flushed.
In windows phone there is something called raw notifications, these are different from push notifications, push notifications display a notification, but raw notifications triggers a background task that can run under certain api restrictions for about 15 seconds. (I think, I'm not sure about the time duration), I think what whatsapp does is that it downloads the message and saves it in a local database which is maintained in the device. When whatsapp is opened it will read the local database and also sync with the server.
Please correct me if I am wrong.

Does Apple keep sending notifications after they have been disabled?

It is widely known that you can disable the reception of Apple notifications from the applications that allow it. But does anyone know if the disabling is made locally (ignoring the notifications Apple sends to the app), or does Apple stop sending you notifications from it's servers?
I've finally discovered in depth how Apple Push Notifications work: if you disable the notifications on one app, Apple does not know of this behavior instantly, so it keeps sending notifications to the device whenever they are created. These notifications will try to reach your app, but instead they will be sent back to Apple with an error code. That feedback will be sent to your servers (the ones that order Apple to distribute your app notifications). You will have to check that information regularly so that if one device has returned a certain amount of "errors", it means that the user has disabled the notifications (or has even uninstalled the app)
Further information: Local and Push Notification Programming Guide

Resources