2

I am creating a mobile application on Android that requires devices to communicate with each other over very large distances. When a phone is connected on the internet via WiFi I have the convenience of an IP-Address. But if its connected via 3G I have nothing but the phone number, I can communicate via SMS but I want to use something better like the 3G connection.

So the question goes as how would an android device connect directly to another device through the 3G network if WiFi is not available?

Note: I have thought of a server that acts as a proxy that maps phone numbers to IP address, but if I can establish a direct channel just using the phone number as the ID over 3G.

Thanks in advance to anyone who can provide any information.

george_h
  • 1,562
  • 2
  • 19
  • 37

3 Answers3

1

Here : http://developer.android.com/reference/android/net/ConnectivityManager.html

and : Google Android - how to figure out if 3g and 2g is turned on

and : How to use 3G Connection in Android Application instead of Wi-fi?

and : ConnectivityManager getActiveNetworkInfo() is always null even with data traffic active

and : http://www.chrisdadswell.co.uk/android-coding-example-checking-for-the-presence-of-an-internet-connection-on-an-android-device/

and : http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.2_r1.1/android/net/ConnectivityManager.java#376

Community
  • 1
  • 1
Software_Designer
  • 8,490
  • 3
  • 24
  • 28
  • This is good for detecting the network but not what I wanted. After more searches I found 2 links that help me. http://stackoverflow.com/questions/6748435/android-client-pc-server-socket-dont-work-over-3g and http://stackoverflow.com/questions/917385/nat-traversal-with-java – george_h Jun 16 '12 at 10:28
1

Googling about how 3G networks work I found that there is NATing (NAT Traversal) involved with outbound and inbound connections. This is not required when connecting via WiFi. So then doing some search on android+NAT+3G+sockets resulted in my answer to this question.

Android Client, Pc Server Socket d'ont work over 3g

https://stackoverflow.com/questions/917385/nat-traversal-with-java

Community
  • 1
  • 1
george_h
  • 1,562
  • 2
  • 19
  • 37
0

I have used Google Play Games Services to achieve that, iOS / Android crossplatform also.

You can use real-time or turn-based API depending on your needs. https://developers.google.com/games/services/common/concepts/realtimeMultiplayer

mdmx
  • 1
  • 1