internet-connection

How can i check mobile data or wifi is on or off. ios swift

回眸只為那壹抹淺笑 提交于 2019-12-03 03:47:11
in my app i am checking that if mobile data is off its showing the popup like check your data connection. for that i write this code import Foundation import SystemConfiguration public class Reachability { class func isConnectedToNetwork() -> Bool { var zeroAddress = sockaddr_in(sin_len: 0, sin_family: 0, sin_port: 0, sin_addr: in_addr(s_addr: 0), sin_zero: (0, 0, 0, 0, 0, 0, 0, 0)) zeroAddress.sin_len = UInt8(sizeofValue(zeroAddress)) zeroAddress.sin_family = sa_family_t(AF_INET) let defaultRouteReachability = withUnsafePointer(&zeroAddress) { SCNetworkReachabilityCreateWithAddress

Simulating a bad internet connection

倾然丶 夕夏残阳落幕 提交于 2019-12-02 15:30:49
I'm developing an embedded device which has access to the internet through LAN. I'm in the testing phase now, and I would like to test how the device performs when the connection to the internet is poor. Currently, the device is connected to a router through a hub, which I use to monitor the packets with Wireshark. What's the best way to throttle down the internet speed of the device to mimic a scenario that may happen? Can I do it through a PC? Do I need access to the router? If so, is it possible to limit the speed of each IP in the router interface? Actually, a friend suggested that I will

Volley - NetworkImageView sometimes doesn't show the error image?

妖精的绣舞 提交于 2019-12-01 21:09:21
So I've decided to try out the new Volley library as shown on Google IO 2013 . I've tried it out while using the easy solution of NetworkImageView to show multiple images on a GridView . It works nice and shows images, but if I let it download the images and then I turn off the WiFi during the download, it doesn't show an error as if everything still loads. Not only that, but if I restore the connection, it doesn't resume the loading. Why does it occur, and how can I fix it? Maybe it's actually a bug? Here's my sample code, if anyone wishes to try it out ( BitmapCacheLru code here ): public

Determine if internet connection is available

馋奶兔 提交于 2019-12-01 11:06:37
how do you folks check if the device is connected to the internet in a sencha touch app? There's an attribute called navigator.onLine (general browser support, not specific for Sencha) If I'm in a PhoneGap application (which you often are if you're using Sencha Touch), I'd rather use their network.isReachable function, since I've by experience found it more reliable. There's also something called 'Offline events', John Resig describes them on his blog: http://ejohn.org/blog/offline-events/ . If there is no network connection during an ajax request sencha touch will return a response with a 0

No internet access in Android emulator

半世苍凉 提交于 2019-12-01 10:19:12
问题 I am not able to access internet in my emulator. It doesn't even connect to google on emulator browser. I have already checked Settings. Data Enabled checkbox is checked. I referred to a few SO questions before posting the question. As this answer suggests, I don't have wifi enabled. So that doesn't seem to be a problem. As another answer in the same question suggests, I tried giving it in Run configurations, but still nothing is changed. If someone can give any idea, that will help me a lot.

iOS Reachability test

泄露秘密 提交于 2019-12-01 08:35:50
For our app, we use the following code to check for internet connection whenever the app user is trying to post a message. When we test the feature, it works fine when turning on the airplane mode. Then when we turn off the airplane mode, the call to connected still returns NO. What could be the reason for that? Do we need extra "setup" in the order in order to get it right? such as listen to network state change notifications? + (BOOL)connected { Reachability *hostReach = [Reachability reachabilityForInternetConnection]; NetworkStatus netStatus = [hostReach currentReachabilityStatus]; return

Implement Broadcast receiver inside a Service

那年仲夏 提交于 2019-11-30 20:27:21
I want to check Internet connection throughout the run time of my Android application. I tried using services but seems like it is not the best option. Is there any possible way for me to implement a broadcast receiver with in a service? Or do I have to give up the service and use broadcast receivers alone? I now show how to create SMS receiver in a service: public class MyService extends Service { @Override public void onCreate() { BwlLog.begin(TAG); super.onCreate(); SMSreceiver mSmsReceiver = new SMSreceiver(); IntentFilter filter = new IntentFilter(); filter.setPriority(IntentFilter.SYSTEM

Without internet connection, how xmlns attribute can work and understand by browser?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 14:20:55
A simple XHTML document, with the minimum of required tags: and xmlns attribute has a http link. If I am working on localhost and if I don't have an Internet connection, can't I work on XHTML? <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Title of the document</title> </head> <body> The content of the document...... </body> </html> The XML namespace is just there to identify elements based on a namespace, which happens to be in a URI format. See the XML Namespaces spec . In this case, http://www.w3.org/1999/xhtml is the namespace for XHTML; an XML processor will be able to use this

Implement Broadcast receiver inside a Service

拥有回忆 提交于 2019-11-30 04:55:26
问题 I want to check Internet connection throughout the run time of my Android application. I tried using services but seems like it is not the best option. Is there any possible way for me to implement a broadcast receiver with in a service? Or do I have to give up the service and use broadcast receivers alone? 回答1: I now show how to create SMS receiver in a service: public class MyService extends Service { @Override public void onCreate() { BwlLog.begin(TAG); super.onCreate(); SMSreceiver

Determine whether iPhone is really connected to the internet or just behind a restricted hotspot

本秂侑毒 提交于 2019-11-30 04:53:35
问题 I'm having quite a lot of trouble on identifying rigorously the kind of network access an iPhone has. I have seen many questions like this one on StackOverflow but none of them helped me. For example I have already seen this: How to check for an active Internet connection on iOS or OSX? But I want to know precisely when the 3 following cases occur: Wifi and 3G are disabled Wifi or 3G are enabled but there is no internet connection. It could be due to 3G not really working, even though it is