I am working in XMPP Application. When I terminate and kill My Application than,
1)User is Not Connected In XMPP Server. User is Offline. But I want User is Connected and Online. Like Whats App(Appliction).
2)I can't get Any Messages From XMPP Server Side at that time,
- (void)xmppStream:(XMPPStream *)sender didReceiveMessage:(XMPPMessage *)message
This method is not call. So, How Can I get Messages ?
And i also implement Pushnotification but in this way same issue Like,When app is Kill and Terminate than,This method is not call,
- (void)application:(UIApplication )application didReceiveRemoteNotification:(NSDictionary )userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler
So, Please Guide me In Proper Way and Suggest me How to work as like same Whats App(Application).
Also, We can't set VOIP Flag In .plist file Because this way is not Proper and reject by the apple.
My Goal is Only Notification Work As like Whats App.
1)User is Not Connected In XMPP Server. User is Offline. But I want User is Connected and Online. Like Whats App(Appliction).
Once you closed or minimized WhatsApp the user gets offline (tested on iPhone4s), and messages received in this state are as push notifications.
2)I can't get Any Messages From XMPP Server Side at that time,
This method get called only when application is active. So you can not get messages here after you killed your application.
- (void)application:(UIApplication )application didReceiveRemoteNotification:(NSDictionary )userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler
This method will get called in following scenarios
And of course you can not use VOIP.
WhatsApp shows custom notification when user is active in WhatsApp. You need to send push notification for every message of your conversation. In this case
When user taps on notification, system will launch application, and you have to check for app launching conditions (from which source app launched) and according to conditions join server/chat (or groups if you are using group chat).
Once you joined server with your name/nickname, you will get recent chats. You can also get history, you need to specify while joining chat server / group.
Make sure you are disconnecting from server and also from group when your app is getting minimized or killed. Use following methods to disconnect and/or related changes
1. - (void)applicationDidEnterBackground:(UIApplication *)application
2. - (void)applicationWillTerminate:(UIApplication *)application
Hope this will help you, I have implemented same to achieve expected results as WhatsApp.
When your app kill, that time XMPP Deactivate all service.So, you can send webservice to server which can tell - you are offline.
Then after sever can send you Push notification all chat content.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With