Connecting iPhone 3G / WiFi

I like to make an iPhone app where it uses Wi-Fi to collect some data and use 3G to send this data to the Internet. The wifi connection will be adhoc and will not offer any internet connections. So, in this case, wifi will be just a data collection interface.

Is it possible?

More technically: - iPhone connects to the adhoc network and selects an automatic IP address, such as 169.254.xx - Selects data from 169.254.1.1 (known ip-sensor) - sends data via web services to www.xyz.com/dataEntry

In addition, I do this small test: - Make a P2P access point on my Win7 - connect my iPhone to a P2P access point - try to browse the website on the Internet, and it fails. For example, I can not open google.com.

What about Android, although less important, I would suggest this Android app too ..

thanks F.

+6
source share
3 answers

For iphone, most people will start using / use the Apple Reachability sample . Using this code, it’s pretty easy to determine if your current Internet connection is a Wi-Fi connection. If it is not Wi-Fi, you can assume that it is a 3G connection.

For Android, you use the ConnectivityManager getActiveNetworkInfo () API to get current network information.

+3
source

iPhone will support its 3G connection when connected to an ad-hoc WiFi network. This is how tether.com works. Even in some cases, maintain a 3G network on the network when there is an open TCP / IP connection, even if WiFi is turned on and connected to the Internet.

Android phones will not connect to ad networks at all. API 14 (ICS) offers the ability to connect a phone to a phone with WiFiDirect, but only between Android phones. You can, of course, connect the phone and allow special connections.

+1
source

Short answer: yes, it works! Basically, your primary iPhone will have an SSID that will allow other devices to connect to it. These devices will independently assign an IP address on the same subnet as the primary. If they do not have a default gateway, they will not be connected to the Internet.

0
source

Source: https://habr.com/ru/post/891691/


All Articles