version:
update:2020.09.29 fix:优化蓝牙管控 add:
This commit is contained in:
@@ -1694,22 +1694,28 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
|
||||
int setting_bht = changeNum(data.optInt("setting_bht"));//总开关
|
||||
int setting_bhtvideo = changeNum(data.optInt("setting_bhtvideo"));//蓝牙音频开关
|
||||
int setting_bluetooth = changeNum(data.optInt("setting_bluetooth"));//蓝牙传输开关
|
||||
String setting_context = data.optString("setting_context");//
|
||||
boolean qch_bht_forbid_on = Settings.System.putInt(getContentResolver(), "qch_bht_forbid_on", setting_bht);
|
||||
|
||||
boolean qch_bht_forbid_on = Settings.System.putInt(getContentResolver(), "qch_bht_forbid_on", setting_bht);//写入系统数据库
|
||||
Log.e("SystemSetting", "qch_bht_forbid_on:" + qch_bht_forbid_on);
|
||||
if (qch_bht_forbid_on) {
|
||||
if (qch_bht_forbid_on) {//成功
|
||||
if (null == mBluetoothAdapter) {
|
||||
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
}
|
||||
if (setting_bht == 0) {
|
||||
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();//获取默认蓝牙适配器
|
||||
}
|
||||
if (setting_bht == 0) {//蓝牙总开关开启
|
||||
String setting_context = data.optString("setting_context");//
|
||||
if (setting_bhtvideo == 0) {
|
||||
Settings.System.putString(getContentResolver(), "qch_bhtvideo_forbid_on", setting_context);
|
||||
if (null != setting_context && !setting_context.equals("") && !setting_context.equals(" ")&& !setting_context.equals("null")) {
|
||||
Log.e("SystemSetting", "setting_context:" + setting_context);
|
||||
Settings.System.putString(getContentResolver(), "qch_bhtvideo_forbid_on", setting_context);
|
||||
} else {
|
||||
Settings.System.putString(getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
|
||||
}
|
||||
} else if (setting_bhtvideo == 1) {
|
||||
Settings.System.putString(getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
|
||||
}
|
||||
Settings.System.putInt(getContentResolver(), "qch_bt_forbid_on", setting_bluetooth);
|
||||
} else {
|
||||
mBluetoothAdapter.disable();
|
||||
mBluetoothAdapter.disable();//设置关闭时关闭蓝牙
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -294,6 +294,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private BluetoothAdapter mBluetoothAdapter;
|
||||
|
||||
private void SettingSysData(String extras) {
|
||||
@@ -365,30 +366,31 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
int setting_bht = changeNum(data.optInt("setting_bht"));//总开关
|
||||
int setting_bhtvideo = changeNum(data.optInt("setting_bhtvideo"));//蓝牙音频开关
|
||||
int setting_bluetooth = changeNum(data.optInt("setting_bluetooth"));//蓝牙传输开关
|
||||
String setting_context = data.optString("setting_context");//
|
||||
boolean qch_bht_forbid_on = Settings.System.putInt(this.mContext.getContentResolver(), "qch_bht_forbid_on", setting_bht);
|
||||
|
||||
boolean qch_bht_forbid_on = Settings.System.putInt(this.mContext.getContentResolver(), "qch_bht_forbid_on", setting_bht);//写入系统数据库
|
||||
Log.e("SystemSetting", "qch_bht_forbid_on:" + qch_bht_forbid_on);
|
||||
if (qch_bht_forbid_on) {
|
||||
if (qch_bht_forbid_on) {//成功
|
||||
if (null == mBluetoothAdapter) {
|
||||
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();//获取默认蓝牙适配器
|
||||
}
|
||||
if (setting_bht == 0) {
|
||||
if (setting_bht == 0) {//蓝牙总开关开启
|
||||
String setting_context = data.optString("setting_context");//
|
||||
if (setting_bhtvideo == 0) {
|
||||
Settings.System.putString(this.mContext.getContentResolver(), "qch_bhtvideo_forbid_on", setting_context);
|
||||
if (null != setting_context && !setting_context.equals("") && !setting_context.equals(" ")&& !setting_context.equals("null")) {
|
||||
Log.e("SystemSetting", "setting_context:" + setting_context);
|
||||
Settings.System.putString(this.mContext.getContentResolver(), "qch_bhtvideo_forbid_on", setting_context);
|
||||
} else {
|
||||
Settings.System.putString(this.mContext.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
|
||||
}
|
||||
} else if (setting_bhtvideo == 1) {
|
||||
Settings.System.putString(this.mContext.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
|
||||
}
|
||||
Settings.System.putInt(this.mContext.getContentResolver(), "qch_bt_forbid_on", setting_bluetooth);
|
||||
}else {
|
||||
mBluetoothAdapter.disable();
|
||||
} else {
|
||||
mBluetoothAdapter.disable();//设置关闭时关闭蓝牙
|
||||
}
|
||||
|
||||
}
|
||||
boolean qch_bt_forbid_on = Settings.System.putInt(mContext.getContentResolver(), "qch_bt_forbid_on", setting_bluetooth);
|
||||
|
||||
Log.e("SystemSetting", "qch_bt_forbid_on---------" + setting_bluetooth);
|
||||
Log.e("SystemSetting", "qch_bt_forbid_on---------" + qch_bt_forbid_on);
|
||||
Log.e("SystemSetting", "qch_bt_forbid_on---------" + Settings.System.getInt(mContext.getContentResolver(), "qch_bt_forbid_on", 0));
|
||||
|
||||
//系统导航条显示开关
|
||||
int setting_navigation = changeNum(data.optInt("setting_navigation"));
|
||||
|
||||
@@ -976,22 +976,28 @@ public class InitJpushServer extends Service {
|
||||
int setting_bht = changeNum(data.optInt("setting_bht"));//总开关
|
||||
int setting_bhtvideo = changeNum(data.optInt("setting_bhtvideo"));//蓝牙音频开关
|
||||
int setting_bluetooth = changeNum(data.optInt("setting_bluetooth"));//蓝牙传输开关
|
||||
String setting_context = data.optString("setting_context");//
|
||||
boolean qch_bht_forbid_on = Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_bht_forbid_on", setting_bht);
|
||||
|
||||
boolean qch_bht_forbid_on = Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_bht_forbid_on", setting_bht);//写入系统数据库
|
||||
Log.e("SystemSetting", "qch_bht_forbid_on:" + qch_bht_forbid_on);
|
||||
if (qch_bht_forbid_on) {
|
||||
if (qch_bht_forbid_on) {//成功
|
||||
if (null == mBluetoothAdapter) {
|
||||
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();//获取默认蓝牙适配器
|
||||
}
|
||||
if (setting_bht == 0) {
|
||||
if (setting_bht == 0) {//蓝牙总开关开启
|
||||
String setting_context = data.optString("setting_context");//
|
||||
if (setting_bhtvideo == 0) {
|
||||
Settings.System.putString(InitJpushServer.this.getContentResolver(), "qch_bhtvideo_forbid_on", setting_context);
|
||||
if (null != setting_context && !setting_context.equals("") && !setting_context.equals(" ")&& !setting_context.equals("null")) {
|
||||
Log.e("SystemSetting", "setting_context:" + setting_context);
|
||||
Settings.System.putString(InitJpushServer.this.getContentResolver(), "qch_bhtvideo_forbid_on", setting_context);
|
||||
} else {
|
||||
Settings.System.putString(InitJpushServer.this.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
|
||||
}
|
||||
} else if (setting_bhtvideo == 1) {
|
||||
Settings.System.putString(InitJpushServer.this.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
|
||||
}
|
||||
Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_bt_forbid_on", setting_bluetooth);
|
||||
} else {
|
||||
mBluetoothAdapter.disable();
|
||||
mBluetoothAdapter.disable();//设置关闭时关闭蓝牙
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user