Start app - change Apn -stop wlan ...

360 views
Skip to first unread message

Manz...@pt.lu

unread,
Feb 23, 2016, 4:17:02 PM2/23/16
to Automate
Hallo,

I want to create an flow, whenI start an specific app the wlan is tured off and the apn is switched to an specific apn. and when I stop the app the app is resetted to the other apn.

Is that possible with automate?

Henrik "The Developer" Lindqvist

unread,
Feb 23, 2016, 8:53:18 PM2/23/16
to Automate, Manz...@pt.lu
There's no block to check the current APN.
Use the Mobile operator block to check the the current operator.

Manz...@pt.lu

unread,
Feb 24, 2016, 12:55:50 AM2/24/16
to Automate, Manz...@pt.lu
The Mobile operator check won't help because it is an different APN with the same operator.

But what I found under App start --> Action ="android.settings.APN_SETTINGS". Could I use this? When yes how?

Henrik "The Developer" Lindqvist

unread,
Feb 24, 2016, 12:56:27 PM2/24/16
to Automate, Manz...@pt.lu
Sure, if you only wish to open the APN settings screen.

What do you want to achieve with determining a change of current APN?

Manz...@pt.lu

unread,
Feb 24, 2016, 2:01:50 PM2/24/16
to Automate
Yes i my account i have 2 apn and i want to change the apn when i use a specific app

Henrik "The Developer" Lindqvist

unread,
Feb 24, 2016, 2:50:48 PM2/24/16
to Automate, Manz...@pt.lu
Changing the APN settings require the android.permission.WRITE_APN_SETTINGS permission, which can obtained on a rooted device.
If you have a rooted device you can modify the APNs using the Shell command superuser block by executing the "content" command:

usage: adb shell content [subcommand] [options]

usage: adb shell content insert --uri <URI> [--user <USER_ID>] --bind <BINDING> [--bind <BINDING>...]
  <URI> a content provider URI.
  <BINDING> binds a typed value to a column and is formatted:
  <COLUMN_NAME>:<TYPE>:<COLUMN_VALUE> where:
  <TYPE> specifies data type such as:
  b - boolean, s - string, i - integer, l - long, f - float, d - double
  Note: Omit the value for passing an empty string, e.g column:s:
  Example:
  # Add "new_setting" secure setting with value "new_value".
  adb shell content insert --uri content://settings/secure --bind name:s:new_setting --bind value:s:new_value

usage: adb shell content update --uri <URI> [--user <USER_ID>] [--where <WHERE>]
  <WHERE> is a SQL style where clause in quotes (You have to escape single quotes - see example below).
  Example:
  # Change "new_setting" secure setting to "newer_value".
  adb shell content update --uri content://settings/secure --bind value:s:newer_value --where "name='new_setting'"

usage: adb shell content delete --uri <URI> [--user <USER_ID>] --bind <BINDING> [--bind <BINDING>...] [--where <WHERE>]
  Example:
  # Remove "new_setting" secure setting.
  adb shell content delete --uri content://settings/secure --where "name='new_setting'"

usage: adb shell content query --uri <URI> [--user <USER_ID>] [--projection <PROJECTION>] [--where <WHERE>] [--sort <SORT_ORDER>]
  <PROJECTION> is a list of colon separated column names and is formatted:
  <COLUMN_NAME>[:<COLUMN_NAME>...]
  <SORT_ORDER> is the order in which rows in the result should be sorted.
  Example:
  # Select "name" and "value" columns from secure settings where "name" is equal to "new_setting" and sort the result by name in ascending order.
  adb shell content query --uri content://settings/secure --projection name:value --where "name='new_setting'" --sort "name ASC"

usage: adb shell content call --uri <URI> --method <METHOD> [--arg <ARG>]
       [--extra <BINDING> ...]
  <METHOD> is the name of a provider-defined method
  <ARG> is an optional string argument
  <BINDING> is like --bind above, typed data of the form <KEY>:{b,s,i,l,f,d}:<VAL>
Reply all
Reply to author
Forward
0 new messages