3

I have a specific problem: I have a Android 1.6 device that uses bluetooth to connect to a smartphone (android) and use tethering to access internet... Bluetooth itself cannot be used for anything else except that connection. It also doesn't have a wifi.

Now, I'm trying to make an app for that device that will connect to a "server" app on the smartphone! What is the easiest way of doing this? I have a simular app running but I have to manualy type the IP of the "server" (if smartphone is on wifi). Can I somehow programatically get the IP of the tethering smartphone or something if it using bluetooth tethering?

Thanks!

1 Answers1

5

You could run a terminal emulator on your smartphone and try running the following commands:

  • getprop net.dns1
  • ip addr show
  • ip route show
  • netcfg

Perhaps you can run those commands from within your app? Otherwise, you would have to read through the Android API manual, which can be found here.

UPDATE: as of Android Nougat 7.x, ifconfig is present, and netcfg is gone.

This question, also seems to be related and may be of use.

Community
  • 1
  • 1
Kevin
  • 2,761
  • 1
  • 27
  • 31