Pritam
Pritam

Reputation: 2507

How to resolve mobile data connection(2G/3G/EDGE/GPRS) lost in android after coming out from wifi programatically?

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 ?

Upvotes: 1

Views: 5598

Answers (2)

Tom Barrister
Tom Barrister

Reputation: 11

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.

Upvotes: 1

Pritam
Pritam

Reputation: 2507

There's no solution for this programatically. You need to toggle the network option which normally cannot be done without user intervention.

Upvotes: 0

Related Questions