Android DualSim, formas / tarea / api para desactivar el segundo sim todos los días a la misma hora

Im que usa mi teléfono para las líneas personales / del trabajo usando el dualsim (ahora Xiaomi Mi5) con el androide 7. Im que busca una manera de utilizar mi línea del trabajo (2do sim) se enciende encendido en 6am y se baja en 22.00 del lunes a Viernes.

Después de buscar algunas aplicaciones, api en android para hacerlo yo mismo, podría encontrar la manera de lograrlo.

Gracias

Solución de software

Hay una aplicación llamada Dual SIM Control que puede gestionar los datos y es compatible con Tasker sin embargo cuesta 1,20 Euros. Puedes probar la funcionalidad en una versión gratuita . Afirma que funciona sin root, pero no sé cómo funciona.

Solución con Root

Investigué un poco y encontré lo siguiente para dar vuelta de los datos de una tarjeta del sim en un teléfono dual del sim con una versión del SDK más arriba entonces 22:

Autor: https://stackoverflow.com/users/463053/chuongpham

public static void setMobileNetworkfromLollipop(Context context) throws Exception { String transactionCode = getTransactionCode(context); String command = null; SubscriptionManager mSubscriptionManager = (SubscriptionManager) context.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE); // Loop through the subscription list ie SIM list. for (int i = 0; i < mSubscriptionManager.getActiveSubscriptionInfoCountMax(); i++) { if (transactionCode != null && transactionCode.length() > 0) { // Get the active subscription ID for a given SIM card. int subscriptionId = mSubscriptionManager.getActiveSubscriptionInfoList().get(i).getSubscriptionId(); // Execute the command via `su` to turn off // mobile network for a subscription service. command = "service call phone " + transactionCode + " i32 " + subscriptionId + " i32 " + Settings.Global.getInt(context.getContentResolver(), "mobile_data", 0); executeCommandViaSu(context, "-c", command); } } } 

y

 private static void executeCommandViaSu(Context context, String option, String command) { boolean success = false; String su = "su"; for (int i=0; i < 3; i++) { // Default "su" command executed successfully, then quit. if (success) { break; } // Else, execute other "su" commands. if (i == 1) { su = "/system/xbin/su"; } else if (i == 2) { su = "/system/bin/su"; } try { // Execute command as "su". Runtime.getRuntime().exec(new String[]{su, option, command}); } catch (IOException e) { success = false; // Oops! Cannot execute `su` for some reason. // Log error here. } finally { success = true; } } } 
FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.