update:2020.09.29
fix:优化蓝牙管控
add:
This commit is contained in:
2020-09-29 16:59:00 +08:00
parent 4b563bc484
commit 737a398e34
4 changed files with 48 additions and 34 deletions

View File

@@ -38,8 +38,8 @@ android {
productFlavors { productFlavors {
official { official {
flavorDimensions "default" flavorDimensions "default"
versionCode 1024 versionCode 1025
versionName "2.0.2.4"// 正式jiaoguanyi.com 双数正式 单数测试 versionName "2.0.2.5"// 正式jiaoguanyi.com 双数正式 单数测试
/*********************************极光推送************************************/ /*********************************极光推送************************************/
manifestPlaceholders = [ manifestPlaceholders = [
JPUSH_PKGNAME: "com.jiaoguanyi.appstore", JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
@@ -55,8 +55,8 @@ android {
beta { beta {
flavorDimensions "default" flavorDimensions "default"
versionCode 107 versionCode 108
versionName "3.1.2"//测试jiaoguanyi.cn versionName "3.1.3"//测试jiaoguanyi.cn
/*********************************极光推送************************************/ /*********************************极光推送************************************/
manifestPlaceholders = [ manifestPlaceholders = [
JPUSH_PKGNAME: "com.jiaoguanyi.appstore", JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
@@ -88,8 +88,8 @@ android {
} }
newl { newl {
flavorDimensions "default" flavorDimensions "default"
versionCode 158 versionCode 159
versionName "1.1.3" versionName "1.1.4"
/*********************************极光推送************************************/ /*********************************极光推送************************************/
manifestPlaceholders = [ manifestPlaceholders = [
JPUSH_PKGNAME: "com.jiaoguanyi.appstore", JPUSH_PKGNAME: "com.jiaoguanyi.appstore",

View File

@@ -1694,22 +1694,28 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
int setting_bht = changeNum(data.optInt("setting_bht"));//总开关 int setting_bht = changeNum(data.optInt("setting_bht"));//总开关
int setting_bhtvideo = changeNum(data.optInt("setting_bhtvideo"));//蓝牙音频开关 int setting_bhtvideo = changeNum(data.optInt("setting_bhtvideo"));//蓝牙音频开关
int setting_bluetooth = changeNum(data.optInt("setting_bluetooth"));//蓝牙传输开关 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); Log.e("SystemSetting", "qch_bht_forbid_on:" + qch_bht_forbid_on);
if (qch_bht_forbid_on) { if (qch_bht_forbid_on) {//成功
if (null == mBluetoothAdapter) { 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) { if (setting_bhtvideo == 0) {
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); 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) { } else if (setting_bhtvideo == 1) {
Settings.System.putString(getContentResolver(), "qch_bhtvideo_forbid_on", "Empty"); Settings.System.putString(getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
} }
Settings.System.putInt(getContentResolver(), "qch_bt_forbid_on", setting_bluetooth); Settings.System.putInt(getContentResolver(), "qch_bt_forbid_on", setting_bluetooth);
} else { } else {
mBluetoothAdapter.disable(); mBluetoothAdapter.disable();//设置关闭时关闭蓝牙
} }
} }

View File

@@ -294,6 +294,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
} }
} }
private BluetoothAdapter mBluetoothAdapter; private BluetoothAdapter mBluetoothAdapter;
private void SettingSysData(String extras) { private void SettingSysData(String extras) {
@@ -365,30 +366,31 @@ public class MyJPushReceiver extends BroadcastReceiver {
int setting_bht = changeNum(data.optInt("setting_bht"));//总开关 int setting_bht = changeNum(data.optInt("setting_bht"));//总开关
int setting_bhtvideo = changeNum(data.optInt("setting_bhtvideo"));//蓝牙音频开关 int setting_bhtvideo = changeNum(data.optInt("setting_bhtvideo"));//蓝牙音频开关
int setting_bluetooth = changeNum(data.optInt("setting_bluetooth"));//蓝牙传输开关 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); Log.e("SystemSetting", "qch_bht_forbid_on:" + qch_bht_forbid_on);
if (qch_bht_forbid_on) { if (qch_bht_forbid_on) {//成功
if (null == mBluetoothAdapter) { 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) { if (setting_bhtvideo == 0) {
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); 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) { } else if (setting_bhtvideo == 1) {
Settings.System.putString(this.mContext.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty"); Settings.System.putString(this.mContext.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
} }
Settings.System.putInt(this.mContext.getContentResolver(), "qch_bt_forbid_on", setting_bluetooth); Settings.System.putInt(this.mContext.getContentResolver(), "qch_bt_forbid_on", setting_bluetooth);
}else { } else {
mBluetoothAdapter.disable(); 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")); int setting_navigation = changeNum(data.optInt("setting_navigation"));

View File

@@ -976,22 +976,28 @@ public class InitJpushServer extends Service {
int setting_bht = changeNum(data.optInt("setting_bht"));//总开关 int setting_bht = changeNum(data.optInt("setting_bht"));//总开关
int setting_bhtvideo = changeNum(data.optInt("setting_bhtvideo"));//蓝牙音频开关 int setting_bhtvideo = changeNum(data.optInt("setting_bhtvideo"));//蓝牙音频开关
int setting_bluetooth = changeNum(data.optInt("setting_bluetooth"));//蓝牙传输开关 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); Log.e("SystemSetting", "qch_bht_forbid_on:" + qch_bht_forbid_on);
if (qch_bht_forbid_on) { if (qch_bht_forbid_on) {//成功
if (null == mBluetoothAdapter) { 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) { if (setting_bhtvideo == 0) {
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); 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) { } else if (setting_bhtvideo == 1) {
Settings.System.putString(InitJpushServer.this.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty"); Settings.System.putString(InitJpushServer.this.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
} }
Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_bt_forbid_on", setting_bluetooth); Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_bt_forbid_on", setting_bluetooth);
} else { } else {
mBluetoothAdapter.disable(); mBluetoothAdapter.disable();//设置关闭时关闭蓝牙
} }
} }