I have VOIP app having the background modes enabled. I am using PJSIP to connect to SIP server.Application is able to get message in foreground, but facing issue in receiving messages, while it is in background.I have tried the solution mentioned here
But I am not sure how can I send keep alive manually at the beginning of background ,as mentioned there.
Any help is appreciated on this issue. Is there any iOS working sample which implements message sending and receiving in background and foreground .
Related
I've been running through this for along time and i'm still stuck.
I'm working on a chat app using Flutter/Dart that it's based on Websocket .
I would like to keep the state of a connected user alive even if he terminates the app.
At this moment :
Foreground : Fully working
Paused : Fully Working
Background : Fully Working
Terminated : Not Working
I'm using Websocket_manager as a package to help
Thank you for your time.
I think this is not possible, you can try something like Firebase cloud messaging (link here), or something similar.
I'm working with FCM for the notifications and sometimes when the app is terminated and phone is locked.
it doesn't receive notifications.
I don't know what i should use right now :/
I am working on same solution, trying to keep app in the background - similar to what is Viber, WhatsApp, Signal etc doing. If I get it working, will share complete project. I have setup FCM google messaging and next bit is to have websocket. It does happen that notification from FCM does not go through.
If someone can explain how Viber, Signal and other can keep apps running and with 99 or 100% delivery rate.
UPDATE:
I have not try this yet but looks promising https://github.com/ppicas/flutter-android-background
And HowTo:
https://medium.com/stuart-engineering/keep-flutter-running-background-on-android-6ffc85be0234
When observing WhatsApp, and similar chat apps, I can see the following behaviour:
Turn off internet connection (both cellular and WIFI).
Make sure chat app is not active (in background).
Send multiple messages to my device (via other devices).
Turn on internet.
In a matter of seconds, all messages are shown as notifications.
I can reproduce this scenario every time I try.
Now I am working on my own iPhone app and I can't seem to figure out how to implement this behaviour. As far as I understand this could have been implemented in several ways:
Using the QoS feature of APNS:
I read that the QoS stores a message if it wasn't delivered to the device, and sends it again when the device reconnects. This solution, however, is not making sense because of two reasons:
QoS is said to save only one undelivered message at a time. But it my case, I get more than one message.
The messages are shown instantly, the moment as I turn the internet connection, and QoS documentation says it may take some time to get the undelivered message.
Using a background service or listen to connectivity changes:
Regarding the background service, I know the closest thing to a running background service is Background Fetch but again it dose not seem to fit here because it is periodical.
And I also wasn't able to find any callback I can hookup to, to know when connectivity had changed while I am in background, and perform some actions.
Do you have any idea how could one implement this feature for an iPhone app? (QoS? Other background APIs?)
Now I am developing a voip app.
Is it okay to use background task to keep my app alive? so app can received incoming state to pop up a notification from the background.
I try CFStreamCreatePairWithSocket, but still can't get info from nsstream event callback.
If I use background task, App can get incoming state as it does in the front.
Thanks a lot.
Please always make sure to provide all required information to get quick help. e.g. Provide some code snippet if possible, provide information regarding which version of OS you are using etc.
Check following answer: It may help you. How to Maintain VOIP socket connection in background?
Im developing a navigation app that using NSStream to manage a TCP connection with my server. Every time the app gets new coordinates it sends it to the server.
The problem is when my app goes to background and then suspended the stream get closed and i cant keep sending the updates to the server.
Can someone help me here? i'm pretty lost..
Try ASIHTTPRequest, It support background task.
http://iosdevelopertips.com/open-source/ios-open-source-asihttprequest.html
I constructed provider code with using C# and it was able to send notification messages to iphone devices successfully. But since yesterday, it hasn't worked. Also it seems to connect APNS successfully and send notification message. Unfortunately, no notification message is received by iphone device. I controlled internet connection and device token of iphone device. What else can I do? Thanks in advance...
I dont have enough rep to comment on the question so typing out answer - Please add more details and I will edit my answer.
Is this in a developer / testing environment and are you using an ad hoc profile to install the application on the iphone devices?
Did you check if the device token has changed and that you are using the new/ correct token in the C# code?
Do provide more details of your problem.
Crazywood, I don't have a solid answer for you but I can tell you I'm in the same boat as you.
There are times when all my notifications go through and times when none of them seem to.
One guess is that not all notifications are sent. According to the docs, in production remote notifications are not guaranteed to be received by the client. My guess is that this is also the case for the sandbox.
-------- EDIT ------
I went through the trouble shooting list (http://developer.apple.com/library/ios/#technotes/tn2010/tn2265.html) and came across this:
The device may have lost its persistent connection to the push service and can't reconnect. Try quitting the app and relaunching it to see if registration completes the next time. (On iOS 4 and later on devices that support multitasking, you will need to force quit the app from the recents list.) If the registration does not complete, iOS has been unable to re-establish the persistent connection. You can troubleshoot this as described in the previous two sections.
I restarted the app and it made no difference. Then I rebooted my phone. That seemed to do the trick.