Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notification when Internet became available on iOS

Is it possible to receive a notification or something inside my app when the internet BECOMES available. I'm aware of reachability and all kinds of stuff. But what i want is to start some pending NSUrlConnections when internet becomes available on the device. Is there a easy way to do this, because I don't want to use a looping thread that checks constantly for reachability. Any suggestions?

like image 516
user2387149 Avatar asked Nov 01 '13 18:11

user2387149


People also ask

How does iPhone notify when found work?

Get notified when your friend arrives at or leaves a location. Tap People at the bottom of the screen, then tap the name of the person you want to be notified about. Below Notifications, tap Add, then tap Notify Me. Choose whether you want to be notified when a friend arrives at or leaves a location.

How do I send an alert on my iPhone?

Go to Settings and tap Notifications. Select an app under Notification Style. Under Alerts, choose the alert style that you want. If you turn on Allow Notifications, choose when you want the notifications delivered—immediately or in the scheduled notification summary.

Do push notifications work without Internet?

Yes! This is possible with an on-premises deployment of Pushy Enterprise. On iOS, Apple recently released Local Push Connectivity which finally makes it possible for your iOS users to receive push notifications in a closed network, without connectivity to APNs.


1 Answers

Ok, here is very nice post about Reachability: http://www.mikeash.com/pyblog/friday-qa-2013-06-14-reachability.html (check comments below!)
Tldr: You can fire block when your connection is back, but this solution is not perfect. There is no 100% reliable way to do this (except trying in loop), but you can try to mix those approaches.

Edit: Comment to @Jonah.at.GoDaddy answer:
Reachability can give you both connection notification errors: false positive and false negative (you can check it at WWDC 2011 session, I don’t remember which one; there are two about networking). So, my point is: you should never rely only on those notification. You can trigger refresh on status change, but there should be another way of doing it (user interaction, or some kind of active waiting).

like image 137
Maciej Kozieł Avatar answered Oct 06 '22 01:10

Maciej Kozieł