How to check if the phone is on WiFi or the Data Connection (3g) ? [Android]

Hello,

I’ve looked over the internet and the only solution which I found is this one:
http://stackoverflow.com/questions/34138707/check-for-internet-connectivity

So, it basically suggests to try to connect to the web site to see if the Internet connection is available or no. But I also want to know what kind of Internet connection is currently turned on, on some particular phone at the time when the game is being played.

I want it because I want to show the video ads, but if the player connected via 3G mobile data plan, at some cases(different data plans) it may cost them a lot, so instead of the video ads I would just show the Interstial (image) ads…

Could someone point me to the right direction? Or any Unity dev?

Thanks a lot.

I’m not a mobile dev at all, but a little poking around yielded

http://stackoverflow.com/questions/13007707/detect-if-connection-is-wifi-3g-or-edge-in-android

it’s not unity specific, but I’m assuming you can use the same android libs and functions?

I can call Java functions but I have to write a wrapper for this purpose… which I don’t have experience of writing lol… I wanted to use pure Unity’s API for this purpose but its also an idea… I might look into it.

ah, missed it was java, but a bit more poking around yielded

which I think looks quite promising for your purposes