增加一键断网
This commit is contained in:
@@ -12,9 +12,7 @@ import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.media.AudioManager;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
@@ -24,8 +22,6 @@ import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.android.internal.view.RotationPolicy;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.download.DownloadEntity;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
@@ -487,7 +483,8 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
private static final String ACTION_APP_CONTROL = "81";
|
||||
/*更新白名单*/
|
||||
private static final String UPDATE_WHITE_LIST = "83";
|
||||
|
||||
/*一键断网*/
|
||||
private static final String ACTION_DISABLE_NETWORK = "85";
|
||||
|
||||
private void processCustomMessage(Context context, XGPushTextMessage message) {
|
||||
if (context == null || message == null) {
|
||||
@@ -797,6 +794,10 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
case UPDATE_WHITE_LIST:
|
||||
NetInterfaceManager.getInstance().getAllappPackage();
|
||||
break;
|
||||
case ACTION_DISABLE_NETWORK:
|
||||
ToastUtil.debugShow("收到推送消息: 一键断网");
|
||||
oneKeyNetwork(context, extras);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
@@ -1561,4 +1562,14 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
String packeges = jsonObject.get("typewriting_app").getAsString();
|
||||
JGYUtils.getInstance().setDefaultInputMethod(packeges);
|
||||
}
|
||||
|
||||
private void oneKeyNetwork(Context context, String extras) {
|
||||
JsonObject jsonObject = GsonUtils.getJsonObject(extras);
|
||||
int is_network = jsonObject.get("is_network").getAsInt();
|
||||
if (is_network==1){
|
||||
JGYUtils.getInstance().oneKeyDisconnection();
|
||||
}else {
|
||||
JGYUtils.getInstance().restorrNetwork();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user