I found a lot of posts where people say you can't manage 3G/2G connection switch, but we all have widgets and such and I wanted to know if there is A way (even a console command) that would let my app automatically enable 2G connection, or a shortcut or just anything, because I'd need to disable 3G connection and let the user reactivate it. Is it possible in any way? I don't mind if a rooted phone is required :)
I know there isn't such an API, but there shall be a way in which widgets can work, and I'd love to know it :)
Related
I have an issue with an application I'm developing for Android 2.3.3.
It's connected to a Wi-Fi access point, and at the same time it is supposed to download some data, but this has to be done using 3G.
I tried searching for this, and found some relevant stuff but could not make it work. I checked out the setNetworkPreference method of the ConnectivityManager, and, even when set to use 3G, it does not download the data and ends up downloading it via Wi-Fi.
Any other ideas how I can do this without disconnecting from the Wi-Fi access point?
I literally just came across this on another forum. It looks like the solution to your question.
ICS tends to automatically add proxys to APN info which sometimes makes apps not work on 3G.
Thread says the following...
"This helped a couple of people on a Dutch forum, don't know if it's provider or country-related and if there even are users here that have these issues, but still wanted to let you know:
I have just fixed why some apps work only with WiFi but not on 3G. ICS apparently automatically added Proxy-settings to your APN, in my case Vodafone (NL). This is not necesarry to even make use of mobile internet, and it also prevents some apps from accessing the internet. I removed the Proxy-settings et voila, it works perfectly again!
Fix: Settings -> Press 'Mobile Network' (not Off-On!) -> Names accespoints -> Click your provider -> Remove 'Proxy' and 'Port'"
Hope it helps.
I'm designing an app which uses wifi for certain purposes. I want to prevent the user from turning the wifi radio off from the wifi settings of the device while my application is running and the device connected to my wifi network. Is there a chance this can be done? I read in WifiManager.WifiLock and they say this: "Note that WifiLocks cannot override the user-level "Wi-Fi Enabled" setting, nor Airplane Mode. They simply keep the radio from turning off when Wi-Fi is already on but the device is idle." Can it be done somehow??
You cannot prevent the user from turning off the wifi from your code. Even if you find out an evil way to do it , you should not try to do it. If I find out any app in my phone does evil things like these, I will just remove the app. I am sure most people are just like me.
If you really want to do it for some reason , perhaps you could tell us what the scenario is and we might be able to help you with a different solution you havent thought about
is there a way I can force Internet access for installed apps
to only go through wifi, ie prevent any data transfer via the radio/3G
interface?
I'm looking for a solution that wouldn't require a jailbroken phone,
so I guess fooling around with iptables might be out of the question.
Please let me know, thanks.
I suppose you could use the solution for this question:
Android: Stop/Start service depending on WiFi state?
You'll need to modify it a bit, but that'll let you know when WiFi is activated and deactivated. I'm not sure what the purpose of your application is, but I certainly wouldn't recommend doing it.
I am struggling with an issue relating to the licensing service and network connection.
The bottom line is I want the LVL to work if the user is in the middle of nowhere with no signal, but I don't want them to be able to 'cheat' and turn off the data connection.
I already have detected and intercepted airplane mode, but some phones or apps let you turn data connection on or off. (some don't)
My Epic 4g allows this, and I think the hidden API letting us control this is not working past 2.0 release. (iTelephony)
However is it possible to simply detect if the connection was disabled and not change that fact but simply react to it?
I can already detect whether or not there is a data connection or not- what I want is to tell the difference between a disabled antenna and simply not having signal. The market licensing check will fail and I want to give 'em a pass if they legitimately have no signal, but not if they forced it off.
Well, I don't need to check whether net has been disabled outside of airplane mode,
I found a different solution here:
http://code.google.com/p/androidbest/
What this code does is force the user to authenticate at least once. Then if it fails to connect to the LVL server, it uses a cached authentication. I had to change it a bit, notably it was launching the next activity twice, and now it solves my issue adequately.
I need a fix for this strange problem appearing in android. Sometimes I notice that even I have full cellular network, data network is lost.(Not able to connect to internet although have all set properly). This possibly occurs after I leave wifi. A quick fix to make it working is toggle 2G/3G option in settings --> Mobile Networks, which probably clears the network stack and makes it all working.
But for my application, which requires always to be connected to internet, I need a fix programatically. I cannot toggle that from code ? Or can I ?
I read and tried a fix by rewriting APN settings, but that do not solve the issue entirely, as we move out from wifi connectivity.
Do anyone have any fix for this from code ?
Because of the way Android networking and security work, there's no way to toggle 2G/3G-4G without going into settings. Some "rooted" phones were once able to do this, but that was disabled in 2.1 and higher.
There's no solution for this programatically. You need to toggle the network option which normally cannot be done without user intervention.