is it possible to check if phone is in national roaming mode?

808 views
Skip to first unread message

ps....@gmail.com

unread,
Oct 22, 2014, 4:21:10 PM10/22/14
to automa...@googlegroups.com
I'd like to switch the mobile data transmission off when I am abroad but keep it on when I am in my country and I am using national roaming (because I don't pay for data transmitted in such case). If it is not possible now, maybe it is a good idea to introduce new block or expand existing one in future release of Automate.

Automate developer

unread,
Oct 22, 2014, 5:22:11 PM10/22/14
to automa...@googlegroups.com, ps....@gmail.com
Automate have an "Roaming" block. Android only provides a "roaming" status (yes/no), there's no distinction between national and international roaming.

ps....@gmail.com

unread,
Oct 23, 2014, 4:06:41 AM10/23/14
to automa...@googlegroups.com
I thought it is possible. In my Kit Kat I have options to enable national or international roaming in call settings and in mobile data settings also.
Maybe it is not done directly but maybe it is done by comparing MCC (Mobile Country Code) of the sim card operator and the logged in network MCC during roaming state.
Anyway, thanks for quick answer.

Automate developer

unread,
Oct 23, 2014, 2:30:32 PM10/23/14
to automa...@googlegroups.com, ps....@gmail.com
I could add field for "numeric operator identifier" to the roaming block, and also check if that changes:
http://developer.android.com/reference/android/telephony/ServiceState.html

Or, add an "mobile operator" block.

ps....@gmail.com

unread,
Oct 23, 2014, 3:36:20 PM10/23/14
to automa...@googlegroups.com
Great idea of the new block that could read telephony data.
We can then build the decision algorhithms ourselves.

Take a look also at:
http://developer.android.com/reference/android/telephony/TelephonyManager.html

It seems, that you can easily get NCC getNetworkCountryIso(), getNetworkOperator(), getSimCountryIso() and then we could later comapre it to NCC used during roaming. Building our own logic in Automate. Is it the same as our providers NCC or not. This seems to be the best solution! Adnd you don't need to change any of existing blocks!
I know that this requres some knowledge of GSM technology or telephony but roaming is the thing we spend so much money at that automating some tasks could be of great benefit to the users.
The block could also checks the data transmission types there LTE, HSDPA, etc... mentioned in one of earlier posts, and/or gets more interesting information/states about telephony. All is in the TelephonyManager class! Power tool indeed!

dill.m...@gmail.com

unread,
Nov 20, 2015, 1:30:44 PM11/20/15
to Automate, ps....@gmail.com
Are there any news about the "mobile operator" block? I plan to use the MNC and MCC in a flow.

Another thing would fit in here also. The near cell tower is nice, but I plan to query the information from the connected cell tower.

Can you say, when this new block will be available?

Henrik Lindqvist

unread,
Nov 20, 2015, 3:16:32 PM11/20/15
to Automate, ps....@gmail.com, dill.m...@gmail.com
The Mobile operator block has been present for months, see the Telephone category.

I don't think there's any API to only get the cells the phone are currently connected to.

dill.m...@gmail.com

unread,
Nov 20, 2015, 5:02:53 PM11/20/15
to Automate, ps....@gmail.com, dill.m...@gmail.com
Oh, I didn't see it. Now I found it. About the cell ID. Sorry I can not help much with android stuff, but maybe this can help:
http://stackoverflow.com/questions/4152373/how-to-know-location-area-code-and-cell-id-in-android-phone
or
http://grokbase.com/t/gg/tasker/151nst55me/about-java-cell-ids-lac-mcc-mnc-gsm-cdma-lte-wcdma-and-all-that-funny-stuff-how-to-brew-your-own
or
http://www.programcreek.com/java-api-examples/index.php?api=android.telephony.cdma.CdmaCellLocation
or
http://developer.android.com/reference/android/telephony/cdma/CdmaCellLocation.html
or
http://developer.android.com/reference/android/telephony/gsm/GsmCellLocation.html

Maybe the "Mobile operator" block can be extended to return the information like the "Cell tower near" block, just for the own block. Connectiontype (LTE, CDMA, GSM, ...) and the correspondent information SID:NID:BID, LAC:RNC:CID, TAC:CI:PCI

This would be nice. Thank you.

Henrik Lindqvist

unread,
Nov 20, 2015, 6:08:46 PM11/20/15
to Automate, ps....@gmail.com, dill.m...@gmail.com
Yes i've seen the function:
http://developer.android.com/reference/android/telephony/TelephonyManager.html#getCellLocation%28%29

But it doesn't seem to be very reliable:
"If there is only one radio in the device and that radio has an LTE connection, this method will return null. "

Could you give me a use-case for the need of exact cell the device is connected to?

I'am no expert on mobile networks, but i think a phone regularly switch between different cells depending on load, signal strengh, etc..

dill.m...@gmail.com

unread,
Nov 21, 2015, 6:05:36 AM11/21/15
to Automate, ps....@gmail.com
I try following things with this information. In Germany we have the national roaming between O2 and E+. I want to check, if this switching is working and try if I can influence this. I have much better signals with one of these.

The other thing is to improve the WiFi switch on/off and setting of sound profiles for locations.

On my phone I don't have google location service running. Only real GPS. So the location information could be very old. What I do at the moment, is a cell tower and check via www.openbmap.org the location of this tower under some conditions. I need the location only one time not continually.

At the moment I use the near cell tower, but I was thinking the real information could be better.

Henrik Lindqvist

unread,
Nov 21, 2015, 3:00:55 PM11/21/15
to Automate, ps....@gmail.com, dill.m...@gmail.com
I think the Mobile operator block should work on the "current registered operator", not for the SIM operator:
http://developer.android.com/reference/android/telephony/TelephonyManager.html#getNetworkOperator%28%29

Don't expect a single block to perform both Wi-Fi scanning, sound profiles and geofencing. You'll have to use the specific blocks provided to accomplish the task.

If you don't want to use the Google Play Services for the location stuff, disable it it in Automate settings.

The Google Play Service and the standard Android geofencing when using the "network" provider does exactly that, it uses nearby cell towers, Wi-Fi networks, etc. to acquire a location.
It's probably more accurate and battery efficient use it, than to implement it yourself in a Flow.
Reply all
Reply to author
Forward
0 new messages