Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Data roaming on/off

Tags:

android

How could I programmatically set data roaming on/off in my android application ?

like image 897
rantravee Avatar asked May 05 '10 12:05

rantravee


3 Answers

Apologies in advance for reopening a dead post but I have managed to achieve it by calling this executable:

su -c settings put global data_roaming0 1

Also to get the roaming setting for first SIM card:

su -c settings get global data_roaming0

like image 176
Batman Avatar answered Sep 18 '22 00:09

Batman


If your app is signatureOrSystem/Privileged app (app resides in /system/priv-app) and your have valid android.permission.WRITE_SECURE_SETTINGS permission in system/etc/permissions. Then you can do it as below.

Enable :

Settings.Global.putInt(context.getContentResolver(), Settings.Global.DATA_ROAMING, 1)

Disable :

Settings.Global.putInt(context.getContentResolver(), Settings.Global.DATA_ROAMING, 0)
like image 21
Vinayak Bevinakatti Avatar answered Sep 19 '22 00:09

Vinayak Bevinakatti


I hope that it's not possible to turn on data roaming programmatically as this would be a serious security issue from my point of view ... Data roaming (i.e. UMTS data transfer via a foreign network) may result in a huge bill from your network provider - at least in europe.

like image 40
Christian Gawron Avatar answered Sep 17 '22 00:09

Christian Gawron