Type of network interface (mobile or wifi)

2,249 views
Skip to first unread message

JurasicSTR

unread,
May 22, 2012, 6:43:41 AM5/22/12
to andro...@googlegroups.com
Hi all!
Is there a way to detect type (cellular or wifi) of network interface on C, without using of jni.
In java it could be done by using "ConnectivityManager".

In android I found that network interfaces could have different names on different devices. On some devices wifi has "wlan0", but on other "eth0", moreover, on chines devices it could have any name.
For cellular network interfaces name starts with "rmnet".

So detection of type based on network interface name is not a solution.

Thanks in advance!
  


Tor Lillqvist

unread,
May 22, 2012, 6:47:58 AM5/22/12
to andro...@googlegroups.com

Is there a way to detect type (cellular or wifi) of network interface on C, without using of jni.

No reason to be scared of JNI for something like this. (If you are scared of Java, perhaps you are developing apps for the wrong platform.)

--tml
 

JurasicSTR

unread,
May 22, 2012, 6:53:07 AM5/22/12
to andro...@googlegroups.com
I`m not scared, I just want to make clean solution! I think there is definitively exist way to do that on C and not to make complicated implementations!

David Turner

unread,
May 22, 2012, 7:47:41 AM5/22/12
to andro...@googlegroups.com
On Tue, May 22, 2012 at 12:53 PM, JurasicSTR <juras...@gmail.com> wrote:
I`m not scared, I just want to make clean solution! I think there is definitively exist way to do that on C and not to make complicated implementations!

No there isn't. Anything you would cook in C would be very device-dependent. The only stable APIs you can rely for this are provided by the framework implementation running inside the VM, so JNI is the way to go to get something that works everywhere. 

On Tuesday, May 22, 2012 1:47:58 PM UTC+3, Tor Lillqvist wrote:

Is there a way to detect type (cellular or wifi) of network interface on C, without using of jni.

No reason to be scared of JNI for something like this. (If you are scared of Java, perhaps you are developing apps for the wrong platform.)

--tml
 

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/android-ndk/-/7tSioQY5dx8J.

To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.

Reply all
Reply to author
Forward
0 new messages