0

As per my requirement . I want to enable and disable GPRS Programmatically.I Googled for a day , did not able to find any suitable solution for it. Is it possible to Enable and Disable GPRS through our code...if yes the give me some valuable link or ideas to do this.As apndroid Application use the same thing to achieve the requirement.

2 Answers2

1

Maybe this could help you:

How to disable Mobile Data on Android

Furthermore u can check the current connectionType (GPRS, 2G, LTE etc) with

TelephonyManager telMgr = (TelephonyManager) _context.getSystemService(Context.TELEPHONY_SERVICE);
telMgr.getNetworkType()

The TypeConstants are defined in the TelephonyManager Class

http://developer.android.com/reference/android/telephony/TelephonyManager.html

GL

Community
  • 1
  • 1
Thkru
  • 4,218
  • 2
  • 18
  • 37
  • Hi Thomas K. I have already looked in to the API but there is no such method to Enable or disable GPRS/Internet Connection. –  Apr 24 '12 at 13:34
  • The solution of the link I posted contains a working code that uses reflection. Afaik this is a good workaround for enabling/disabling connections. Did u try it? – Thkru Apr 24 '12 at 13:48
0

The code written in this OpenSource project might be usefule to you to switch GPRS.

Check Here

I haven't tried so far..so can't write more.

MKJParekh
  • 34,073
  • 11
  • 87
  • 98