update:2020.5.8
fix:增加app内部网页管控 add:静默下载显示网速,单例toast
This commit is contained in:
@@ -14,10 +14,12 @@ android {
|
|||||||
applicationId "com.jiaoguanyi.appstore"
|
applicationId "com.jiaoguanyi.appstore"
|
||||||
minSdkVersion 15
|
minSdkVersion 15
|
||||||
targetSdkVersion 26
|
targetSdkVersion 26
|
||||||
// versionCode 85
|
|
||||||
// versionName "2.0.4.6"//正式jiaoguanyi.com
|
versionCode 125
|
||||||
versionCode 123
|
versionName "2.8.2"//测试jiaoguanyi.cn
|
||||||
versionName "2.0.0.1"//测试jiaoguanyi.cn
|
|
||||||
|
// versionCode 125
|
||||||
|
// versionName "2.0.0.5"// 正式jiaoguanyi.com 双数正式 单数测试
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
|
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
@@ -150,8 +152,9 @@ dependencies {
|
|||||||
implementation "com.github.yjfnypeu:UpdatePlugin:3.0.1"
|
implementation "com.github.yjfnypeu:UpdatePlugin:3.0.1"
|
||||||
|
|
||||||
implementation 'com.blankj:utilcode:1.23.7'
|
implementation 'com.blankj:utilcode:1.23.7'
|
||||||
implementation 'com.arialyy.aria:aria-core:3.5.4'
|
|
||||||
annotationProcessor 'com.arialyy.aria:aria-compiler:3.5.4'
|
implementation 'com.arialyy.aria:core:3.8.5'
|
||||||
|
annotationProcessor 'com.arialyy.aria:compiler:3.8.5'
|
||||||
|
|
||||||
implementation 'com.github.tianma8023:NetDetector:v0.2.0'
|
implementation 'com.github.tianma8023:NetDetector:v0.2.0'
|
||||||
implementation 'com.android.support:cardview-v7:26.1.0'
|
implementation 'com.android.support:cardview-v7:26.1.0'
|
||||||
|
|||||||
@@ -30,6 +30,10 @@
|
|||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||||
|
|
||||||
|
<uses-permission
|
||||||
|
android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS"
|
||||||
|
android:maxSdkVersion="22" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".MyApplication"
|
android:name=".MyApplication"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import android.util.Log;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.arialyy.aria.core.Aria;
|
import com.arialyy.aria.core.Aria;
|
||||||
|
import com.arialyy.aria.core.download.DownloadEntity;
|
||||||
import com.blankj.utilcode.util.PathUtils;
|
import com.blankj.utilcode.util.PathUtils;
|
||||||
import com.lzy.okgo.OkGo;
|
import com.lzy.okgo.OkGo;
|
||||||
import com.lzy.okgo.cache.CacheEntity;
|
import com.lzy.okgo.cache.CacheEntity;
|
||||||
@@ -126,7 +127,7 @@ public class MyApplication extends MultiDexApplication implements Thread.Uncaugh
|
|||||||
|
|
||||||
Aria.init(this);
|
Aria.init(this);
|
||||||
Aria.get(this).getDownloadConfig().setMaxTaskNum(1);
|
Aria.get(this).getDownloadConfig().setMaxTaskNum(1);
|
||||||
|
Aria.get(this).getDownloadConfig().setConvertSpeed(true);
|
||||||
|
|
||||||
NetStateChangeReceiver.registerReceiver(this);
|
NetStateChangeReceiver.registerReceiver(this);
|
||||||
|
|
||||||
@@ -523,6 +524,24 @@ public class MyApplication extends MultiDexApplication implements Thread.Uncaugh
|
|||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
boolean isForecDownload = false;
|
||||||
|
|
||||||
|
public boolean isDownloading() {
|
||||||
|
return isForecDownload;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDownloadState(boolean state) {
|
||||||
|
isForecDownload = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkIsDownloading() {
|
||||||
|
List<DownloadEntity> list = Aria.download(this).getDRunningTask();
|
||||||
|
if (list == null || list.size() == 0) {
|
||||||
|
MyApplication.getInstance().setDownloadState(false);
|
||||||
|
} else {
|
||||||
|
MyApplication.getInstance().setDownloadState(true);
|
||||||
|
}
|
||||||
|
Log.e("aria", "isDownloading=" + MyApplication.getInstance().isDownloading());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import com.lzy.okgo.callback.StringCallback;
|
|||||||
import com.lzy.okserver.download.DownloadManager;
|
import com.lzy.okserver.download.DownloadManager;
|
||||||
import com.lzy.okserver.download.DownloadService;
|
import com.lzy.okserver.download.DownloadService;
|
||||||
import com.mjsheng.myappstore.BuildConfig;
|
import com.mjsheng.myappstore.BuildConfig;
|
||||||
|
import com.mjsheng.myappstore.MyApplication;
|
||||||
import com.mjsheng.myappstore.R;
|
import com.mjsheng.myappstore.R;
|
||||||
import com.mjsheng.myappstore.bean.AppDateInfo;
|
import com.mjsheng.myappstore.bean.AppDateInfo;
|
||||||
import com.mjsheng.myappstore.bean.CommonPicBean;
|
import com.mjsheng.myappstore.bean.CommonPicBean;
|
||||||
@@ -514,9 +515,10 @@ public class MainActivity extends AppCompatActivity implements NetStateChangeObs
|
|||||||
getAppLimitApi();//写入可被安装的包名
|
getAppLimitApi();//写入可被安装的包名
|
||||||
getAppInfo();//上传APP信息
|
getAppInfo();//上传APP信息
|
||||||
getSystemSetting();//设置系统管控
|
getSystemSetting();//设置系统管控
|
||||||
|
HTTPInterface.setAppinsideWeb(MainActivity.this);//app内部网页管控
|
||||||
getNetAndLaunchSetting();//联网管控
|
getNetAndLaunchSetting();//联网管控
|
||||||
// Aria.download(this).removeAllTask(true);
|
// Aria.download(this).removeAllTask(true);
|
||||||
// getForceDownload();//强制下载apk
|
getForceDownload();//强制下载apk
|
||||||
resetDevice();//恢复出厂设置
|
resetDevice();//恢复出厂设置
|
||||||
// fromNetToUpdate();
|
// fromNetToUpdate();
|
||||||
String registrationID = JPushInterface.getRegistrationID(MainActivity.this);
|
String registrationID = JPushInterface.getRegistrationID(MainActivity.this);
|
||||||
@@ -575,7 +577,7 @@ public class MainActivity extends AppCompatActivity implements NetStateChangeObs
|
|||||||
.load(url) //读取下载地址
|
.load(url) //读取下载地址
|
||||||
.setFilePath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString(packageName) + ".apk", true)
|
.setFilePath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString(packageName) + ".apk", true)
|
||||||
.setExtendField(packageName)
|
.setExtendField(packageName)
|
||||||
.start(); //启动下载}
|
.create(); //启动下载}
|
||||||
} else {
|
} else {
|
||||||
Log.e("fht", "无需更新");
|
Log.e("fht", "无需更新");
|
||||||
}
|
}
|
||||||
@@ -978,9 +980,9 @@ public class MainActivity extends AppCompatActivity implements NetStateChangeObs
|
|||||||
if (version_code > AppUtils.getAppVersionCode()) {
|
if (version_code > AppUtils.getAppVersionCode()) {
|
||||||
Aria.download(this)
|
Aria.download(this)
|
||||||
.load(url) //读取下载地址
|
.load(url) //读取下载地址
|
||||||
.setDownloadPath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString(url) + ".apk")
|
.setFilePath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString(url) + ".apk")
|
||||||
.setExtendField(BuildConfig.APPLICATION_ID)
|
.setExtendField(BuildConfig.APPLICATION_ID)
|
||||||
.start(); //启动下载}}
|
.create(); //启动下载}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -1087,7 +1089,14 @@ public class MainActivity extends AppCompatActivity implements NetStateChangeObs
|
|||||||
public void onNext(ForceDownloadBean forceDownloadBean) {
|
public void onNext(ForceDownloadBean forceDownloadBean) {
|
||||||
switch (forceDownloadBean.getCode()) {
|
switch (forceDownloadBean.getCode()) {
|
||||||
case 200:
|
case 200:
|
||||||
|
Log.e("getForceDownload", "isDownloading=" + MyApplication.getInstance().isDownloading());
|
||||||
|
MyApplication.getInstance().checkIsDownloading();
|
||||||
|
if (!MyApplication.getInstance().isDownloading()) {
|
||||||
|
Aria.download(this).removeAllTask(true);
|
||||||
forceDownload(forceDownloadBean.getData());
|
forceDownload(forceDownloadBean.getData());
|
||||||
|
} else {
|
||||||
|
Aria.download(this).resumeAllTask();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LogUtils.e("getForceDownload is error:" + forceDownloadBean.getMsg());
|
LogUtils.e("getForceDownload is error:" + forceDownloadBean.getMsg());
|
||||||
@@ -1124,6 +1133,7 @@ public class MainActivity extends AppCompatActivity implements NetStateChangeObs
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
private void forceDownload(List<ForceDownloadData> data) {
|
private void forceDownload(List<ForceDownloadData> data) {
|
||||||
|
MyApplication.getInstance().setDownloadState(true);
|
||||||
if (data == null || data.size() <= 0) {
|
if (data == null || data.size() <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1134,10 +1144,11 @@ public class MainActivity extends AppCompatActivity implements NetStateChangeObs
|
|||||||
ForceDownloadData forceDownloadData = data.get(i);
|
ForceDownloadData forceDownloadData = data.get(i);
|
||||||
String app_package = forceDownloadData.getApp_package();
|
String app_package = forceDownloadData.getApp_package();
|
||||||
String app_url = forceDownloadData.getApp_url();
|
String app_url = forceDownloadData.getApp_url();
|
||||||
if (data.get(i).getApp_package().equals("com.mjsheng.myappstore")) {
|
Log.e("fht ", "packageName=" + app_package + ",URL= " + app_url);
|
||||||
|
|
||||||
|
if (data.get(i).getApp_package().equals("com.jiaoguanyi.store")) {
|
||||||
continue;//为自身的跳过下载
|
continue;//为自身的跳过下载
|
||||||
}
|
}
|
||||||
LogUtils.e(list);
|
|
||||||
if (list != null) {
|
if (list != null) {
|
||||||
if (!list.contains(app_package)) {
|
if (!list.contains(app_package)) {
|
||||||
SaveListUtils.addToList(app_package);
|
SaveListUtils.addToList(app_package);
|
||||||
@@ -1146,28 +1157,29 @@ public class MainActivity extends AppCompatActivity implements NetStateChangeObs
|
|||||||
SaveListUtils.addToList(app_package);
|
SaveListUtils.addToList(app_package);
|
||||||
}
|
}
|
||||||
if (!AppUtils.isAppInstalled(app_package)) {
|
if (!AppUtils.isAppInstalled(app_package)) {
|
||||||
if (!SaveListUtils.isDownLoading(app_package)) {
|
Log.e("fht ", "download URL " + app_url);
|
||||||
|
// if (!SaveListUtils.isDownLoading(app_package)) {
|
||||||
Aria.download(this)
|
Aria.download(this)
|
||||||
.load(app_url) //读取下载地址
|
.load(app_url) //读取下载地址
|
||||||
.setDownloadPath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString(app_package) + ".apk")
|
.setFilePath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString(app_package) + ".apk", true)
|
||||||
.setExtendField(app_package)
|
.setExtendField(app_package)
|
||||||
.start(); //启动下载}
|
.create(); //启动下载}
|
||||||
SaveListUtils.addDownLoadList(app_package);
|
// SaveListUtils.addDownLoadList(app_package);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getSelfDownload(List<ForceDownloadData> forceDownloadDataList) {
|
private void getSelfDownload(List<ForceDownloadData> forceDownloadDataList) {
|
||||||
for (ForceDownloadData forceDownloadData : forceDownloadDataList) {
|
for (ForceDownloadData forceDownloadData : forceDownloadDataList) {
|
||||||
if ("com.jiaoguanyi.appstore".equals(forceDownloadData.getApp_package())) {
|
if ("com.jiaoguanyi.store".equals(forceDownloadData.getApp_package())) {
|
||||||
|
if (!AppUtils.isAppInstalled("com.jiaoguanyi.store")) {
|
||||||
Aria.download(this)
|
Aria.download(this)
|
||||||
.load(forceDownloadData.getApp_url()) //读取下载地址
|
.load(forceDownloadData.getApp_url()) //读取下载地址
|
||||||
.setDownloadPath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString("com.jiaoguanyi.appstore") + ".apk")
|
.setFilePath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString("com.jiaoguanyi.store") + ".apk", true)
|
||||||
.setExtendField("com.mjsheng.myappstore")
|
.setExtendField("com.jiaoguanyi.store")
|
||||||
.start(); //启动下载}
|
.create(); //启动下载}
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Log.e("fht", "未上传应用");
|
// Log.e("fht", "未上传应用");
|
||||||
}
|
}
|
||||||
@@ -1405,7 +1417,7 @@ public class MainActivity extends AppCompatActivity implements NetStateChangeObs
|
|||||||
|
|
||||||
//状态栏显示开关
|
//状态栏显示开关
|
||||||
int setting_statusbar = changeNum(data.optInt("setting_statusbar"));
|
int setting_statusbar = changeNum(data.optInt("setting_statusbar"));
|
||||||
int oldNum = Settings.System.getInt(mContext.getContentResolver(), "qch_hide_statusBar",0);
|
int oldNum = Settings.System.getInt(mContext.getContentResolver(), "qch_hide_statusBar", 0);
|
||||||
if (oldNum != setting_statusbar) {
|
if (oldNum != setting_statusbar) {
|
||||||
boolean qch_hide_statusBar = Settings.System.putInt(mContext.getContentResolver(), "qch_hide_statusBar", setting_statusbar);
|
boolean qch_hide_statusBar = Settings.System.putInt(mContext.getContentResolver(), "qch_hide_statusBar", setting_statusbar);
|
||||||
Log.e("SystemSetting", "qch_hide_statusBar---------" + qch_hide_statusBar);
|
Log.e("SystemSetting", "qch_hide_statusBar---------" + qch_hide_statusBar);
|
||||||
|
|||||||
29
app/src/main/java/com/mjsheng/myappstore/bean/Appground.java
Normal file
29
app/src/main/java/com/mjsheng/myappstore/bean/Appground.java
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
package com.mjsheng.myappstore.bean;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class Appground implements Serializable {
|
||||||
|
private String packages;
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
public String getPackages() {
|
||||||
|
return packages;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPackages(String packages) {
|
||||||
|
this.packages = packages;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAddress() {
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddress(String address) {
|
||||||
|
this.address = address;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return packages + "," + address;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.mjsheng.myappstore.network;
|
package com.mjsheng.myappstore.network;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.icu.text.SimpleDateFormat;
|
import android.icu.text.SimpleDateFormat;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -17,6 +18,7 @@ import com.blankj.utilcode.util.LogUtils;
|
|||||||
import com.lzy.okgo.OkGo;
|
import com.lzy.okgo.OkGo;
|
||||||
import com.lzy.okgo.callback.StringCallback;
|
import com.lzy.okgo.callback.StringCallback;
|
||||||
import com.mjsheng.myappstore.MyApplication;
|
import com.mjsheng.myappstore.MyApplication;
|
||||||
|
import com.mjsheng.myappstore.bean.Appground;
|
||||||
import com.mjsheng.myappstore.bean.UserInfo;
|
import com.mjsheng.myappstore.bean.UserInfo;
|
||||||
import com.mjsheng.myappstore.jpush.TagAliasOperatorHelper;
|
import com.mjsheng.myappstore.jpush.TagAliasOperatorHelper;
|
||||||
import com.mjsheng.myappstore.utils.Configure;
|
import com.mjsheng.myappstore.utils.Configure;
|
||||||
@@ -24,8 +26,10 @@ import com.mjsheng.myappstore.utils.SPUtils;
|
|||||||
import com.mjsheng.myappstore.utils.ToastUtil;
|
import com.mjsheng.myappstore.utils.ToastUtil;
|
||||||
import com.mjsheng.myappstore.utils.Utils;
|
import com.mjsheng.myappstore.utils.Utils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import okhttp3.Call;
|
import okhttp3.Call;
|
||||||
@@ -335,5 +339,95 @@ public class HTTPInterface {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
synchronized public static void setHomepagtag(Context context) {
|
||||||
|
OkGo.post(Configure.SET_HOMEPAG_TAG)
|
||||||
|
.params("key", Configure.HTTP_KEY)
|
||||||
|
.params("sn", Utils.getSerial())
|
||||||
|
.execute(new StringCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String s, Call call, Response response) {
|
||||||
|
try {
|
||||||
|
JSONObject jsonObject = JSON.parseObject(s);
|
||||||
|
int code = jsonObject.getInteger("code");
|
||||||
|
String msg = jsonObject.getString("msg");
|
||||||
|
if (code == 200) {
|
||||||
|
String data = jsonObject.getString("data");
|
||||||
|
JSONObject jsondata = JSON.parseObject(data);
|
||||||
|
String homepag = jsondata.getString("homepage");
|
||||||
|
String labelpage = jsondata.getString("labelpage");
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
ToastUtil.show(msg);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e("fht", e.getMessage());
|
||||||
|
ToastUtil.show("数据错误");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Call call, Response response, Exception e) {
|
||||||
|
super.onError(call, response, e);
|
||||||
|
ToastUtil.show("网络连接失败");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized public static void setAppinsideWeb(final Context context) {
|
||||||
|
OkGo.post(Configure.SET_APPINSIDEWEB)
|
||||||
|
.params("key", Configure.HTTP_KEY)
|
||||||
|
.params("sn", Utils.getSerial())
|
||||||
|
.execute(new StringCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String s, Call call, Response response) {
|
||||||
|
try {
|
||||||
|
JSONObject jsonObject = JSON.parseObject(s);
|
||||||
|
int code = jsonObject.getInteger("code");
|
||||||
|
String msg = jsonObject.getString("msg");
|
||||||
|
if (code == 200) {
|
||||||
|
String data = jsonObject.getString("data");
|
||||||
|
List<Appground> appgrounds = JSON.parseArray(data, Appground.class);
|
||||||
|
if (appgrounds != null && appgrounds.size() > 0) {
|
||||||
|
String strings = "";
|
||||||
|
String packageList = "";
|
||||||
|
for (Appground appground : appgrounds) {
|
||||||
|
packageList += appground.getPackages() + ",";
|
||||||
|
strings += appground.toString() + ";";
|
||||||
|
}
|
||||||
|
//app内所有的网页禁止
|
||||||
|
packageList = packageList.substring(0, packageList.length() - 1);
|
||||||
|
//去掉多余的,
|
||||||
|
Log.e("setAppinsideWeb ", "packageList:" + packageList);
|
||||||
|
Intent qch_app_website = new Intent("qch_app_website");
|
||||||
|
qch_app_website.putExtra("package_name", packageList);
|
||||||
|
context.sendBroadcast(qch_app_website);
|
||||||
|
//app内单个网页地址禁止打开
|
||||||
|
strings = strings.substring(0, strings.length() - 1);
|
||||||
|
//去掉多余的;
|
||||||
|
Log.e("setAppinsideWeb ", "strings:" + strings);
|
||||||
|
Intent intent = new Intent("qch_app_inside_website");
|
||||||
|
intent.putExtra("websitelist", strings);
|
||||||
|
context.sendBroadcast(intent);
|
||||||
|
}
|
||||||
|
} else if (code == 400) {
|
||||||
|
//列表为空的情况
|
||||||
|
Intent intent = new Intent("qch_app_website");
|
||||||
|
intent.putExtra("package_name", "Invalid");
|
||||||
|
context.sendBroadcast(intent);
|
||||||
|
// ToastUtil.show(msg);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e("setAppinsideWeb", e.getMessage());
|
||||||
|
ToastUtil.show("数据错误");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Call call, Response response, Exception e) {
|
||||||
|
super.onError(call, response, e);
|
||||||
|
ToastUtil.show("网络连接失败");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ public class Network {
|
|||||||
|
|
||||||
// public static final String ROOT_URL = "http://www.as.xueshibao.com.cn/api/"; 弃用
|
// public static final String ROOT_URL = "http://www.as.xueshibao.com.cn/api/"; 弃用
|
||||||
// public static final String ROOT_URL = "https://www.jiaoguanyi.com/api/";//正式 弃用
|
// public static final String ROOT_URL = "https://www.jiaoguanyi.com/api/";//正式 弃用
|
||||||
public static final String ROOT_URL = "https://partner.jiaoguanyi.com/api/";//正式
|
// public static final String ROOT_URL = "https://partner.jiaoguanyi.com/api/";//正式
|
||||||
// public static final String ROOT_URL = "http://www.jiaoguanyi.cn/api/";//测试
|
public static final String ROOT_URL = "http://www.jiaoguanyi.cn/api/";//测试
|
||||||
|
|
||||||
|
|
||||||
private static UploadAppInfoApi uploadAppInfoApi;
|
private static UploadAppInfoApi uploadAppInfoApi;
|
||||||
|
|||||||
@@ -8,12 +8,11 @@ import android.content.IntentFilter;
|
|||||||
import android.os.BatteryManager;
|
import android.os.BatteryManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.provider.Browser;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import cn.jpush.android.api.JPushInterface;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.arialyy.aria.core.Aria;
|
import com.arialyy.aria.core.Aria;
|
||||||
import com.blankj.utilcode.util.AppUtils;
|
import com.blankj.utilcode.util.AppUtils;
|
||||||
@@ -23,26 +22,29 @@ import com.blankj.utilcode.util.PathUtils;
|
|||||||
import com.mjsheng.myappstore.BuildConfig;
|
import com.mjsheng.myappstore.BuildConfig;
|
||||||
import com.mjsheng.myappstore.MyApplication;
|
import com.mjsheng.myappstore.MyApplication;
|
||||||
import com.mjsheng.myappstore.comm.CommonDatas;
|
import com.mjsheng.myappstore.comm.CommonDatas;
|
||||||
|
import com.mjsheng.myappstore.network.HTTPInterface;
|
||||||
import com.mjsheng.myappstore.network.Network;
|
import com.mjsheng.myappstore.network.Network;
|
||||||
import com.mjsheng.myappstore.utils.ApkUtils;
|
import com.mjsheng.myappstore.utils.ApkUtils;
|
||||||
import com.mjsheng.myappstore.utils.MySQLData;
|
import com.mjsheng.myappstore.utils.MySQLData;
|
||||||
import com.mjsheng.myappstore.utils.SaveListUtils;
|
import com.mjsheng.myappstore.utils.SaveListUtils;
|
||||||
|
import com.mjsheng.myappstore.utils.ToastUtil;
|
||||||
import com.mjsheng.myappstore.utils.Utils;
|
import com.mjsheng.myappstore.utils.Utils;
|
||||||
|
|
||||||
import io.reactivex.Observer;
|
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
||||||
import io.reactivex.disposables.Disposable;
|
|
||||||
import io.reactivex.schedulers.Schedulers;
|
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import okhttp3.ResponseBody;
|
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.jpush.android.api.JPushInterface;
|
||||||
|
import io.reactivex.Observer;
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
|
import io.reactivex.disposables.Disposable;
|
||||||
|
import io.reactivex.schedulers.Schedulers;
|
||||||
|
import okhttp3.ResponseBody;
|
||||||
|
|
||||||
public class MyJPushReceiver extends BroadcastReceiver {
|
public class MyJPushReceiver extends BroadcastReceiver {
|
||||||
private static final String TAG = "MyJPushReceiver";
|
private static final String TAG = "MyJPushReceiver";
|
||||||
|
|
||||||
@@ -76,6 +78,10 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
|
|
||||||
private final String GET_FORCEDOWNLOADURL = "14";
|
private final String GET_FORCEDOWNLOADURL = "14";
|
||||||
|
|
||||||
|
private final String SET_HOMEPAG_TAG = "15";//主页和书签管控
|
||||||
|
|
||||||
|
private final String APP_WEBSITE = "16";//app内网页管控
|
||||||
|
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
|
||||||
@@ -304,8 +310,8 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
|
|
||||||
(Aria.download(this)
|
(Aria.download(this)
|
||||||
.load(str)
|
.load(str)
|
||||||
.setDownloadPath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString(s) + ".apk").setExtendField(s))
|
.setFilePath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString(s) + ".apk").setExtendField(s))
|
||||||
.start();
|
.create();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -544,9 +550,17 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
.load(url) //读取下载地址
|
.load(url) //读取下载地址
|
||||||
.setFilePath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString("com.jiaoguanyi.store") + ".apk", true)
|
.setFilePath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString("com.jiaoguanyi.store") + ".apk", true)
|
||||||
.setExtendField("com.jiaoguanyi.store")
|
.setExtendField("com.jiaoguanyi.store")
|
||||||
.start(); //启动下载}
|
.create(); //启动下载}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
case SET_HOMEPAG_TAG:
|
||||||
|
setHomepagtag(extras);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case APP_WEBSITE:
|
||||||
|
setAPPinsideWebsite(extras);
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -641,34 +655,9 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class BroadcastThread extends Thread {
|
|
||||||
String[] packagename;
|
|
||||||
String action;
|
|
||||||
|
|
||||||
public BroadcastThread(String a, String[] s) {
|
|
||||||
super();
|
|
||||||
this.packagename = s;
|
|
||||||
this.action = a;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
super.run();
|
|
||||||
for (String name : packagename) {
|
|
||||||
Intent disIntent = new Intent(action);
|
|
||||||
disIntent.putExtra("package_name", name);
|
|
||||||
Log.e("mymjsheng", "package_name::" + name);
|
|
||||||
mContext.sendBroadcast(disIntent);
|
|
||||||
try {
|
|
||||||
sleep(5000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void settingPowerOn(String s) {
|
private void settingPowerOn(String s) {
|
||||||
if (TextUtils.isEmpty(s)) {
|
if (TextUtils.isEmpty(s)) {
|
||||||
@@ -717,6 +706,76 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
// Log.e("mjsheng", "writeDeselectBrowserIDtoSystem is null:");
|
// Log.e("mjsheng", "writeDeselectBrowserIDtoSystem is null:");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setHomepagtag(String s) {
|
||||||
|
//设置主页和标签
|
||||||
|
HTTPInterface.setHomepagtag(mContext);
|
||||||
|
|
||||||
|
// if (TextUtils.isEmpty(s)) {
|
||||||
|
// Log.e("mjsheng", "setHomepagtag extras is null");
|
||||||
|
//
|
||||||
|
// return;
|
||||||
|
// } else {
|
||||||
|
// try {
|
||||||
|
// com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(s);
|
||||||
|
// String packageweb = jsonObject.getString("");
|
||||||
|
// ArrayList<String> strings = new ArrayList<>();
|
||||||
|
// Intent intent = new Intent("action");
|
||||||
|
// intent.putStringArrayListExtra("package", strings);
|
||||||
|
// mContext.sendBroadcast(intent);
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// ToastUtil.show("数据错误");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setAPPinsideWebsite(String s) {
|
||||||
|
//禁止app内部网页访问,包名用,隔开
|
||||||
|
HTTPInterface.setAppinsideWeb(mContext);
|
||||||
|
// if (TextUtils.isEmpty(s)) {
|
||||||
|
// Log.e("mjsheng", "setAPPinsideWebsite extras is null");
|
||||||
|
//
|
||||||
|
// return;
|
||||||
|
// } else {
|
||||||
|
// try {
|
||||||
|
// JSONObject jSONObject = new JSONObject(s);
|
||||||
|
// String str = jSONObject.optString("package");
|
||||||
|
// Intent intent = new Intent("qch_app_website");
|
||||||
|
// intent.putExtra("package_name", str);
|
||||||
|
// mContext.sendBroadcast(intent);
|
||||||
|
// } catch (JSONException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
private class BroadcastThread extends Thread {
|
||||||
|
String[] packagename;
|
||||||
|
String action;
|
||||||
|
|
||||||
|
public BroadcastThread(String a, String[] s) {
|
||||||
|
super();
|
||||||
|
this.packagename = s;
|
||||||
|
this.action = a;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
super.run();
|
||||||
|
for (String name : packagename) {
|
||||||
|
Intent disIntent = new Intent(action);
|
||||||
|
disIntent.putExtra("package_name", name);
|
||||||
|
Log.e("mymjsheng", "package_name::" + name);
|
||||||
|
mContext.sendBroadcast(disIntent);
|
||||||
|
try {
|
||||||
|
sleep(5000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//应用id管控
|
//应用id管控
|
||||||
private void writeDeselectIDtoSystem(String s1, String result) {
|
private void writeDeselectIDtoSystem(String s1, String result) {
|
||||||
if (!TextUtils.isEmpty(s1) && !TextUtils.isEmpty(result)) {
|
if (!TextUtils.isEmpty(s1) && !TextUtils.isEmpty(result)) {
|
||||||
|
|||||||
@@ -15,19 +15,23 @@ import android.content.ServiceConnection;
|
|||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
import android.text.format.Formatter;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.arialyy.annotations.Download;
|
import com.arialyy.annotations.Download;
|
||||||
import com.arialyy.aria.core.Aria;
|
import com.arialyy.aria.core.Aria;
|
||||||
import com.arialyy.aria.core.download.DownloadTask;
|
import com.arialyy.aria.core.download.DownloadEntity;
|
||||||
|
import com.arialyy.aria.core.task.DownloadTask;
|
||||||
import com.blankj.utilcode.util.LogUtils;
|
import com.blankj.utilcode.util.LogUtils;
|
||||||
import com.blankj.utilcode.util.ToastUtils;
|
import com.blankj.utilcode.util.ToastUtils;
|
||||||
import com.mjsheng.myappstore.KeepAliveConnection;
|
import com.mjsheng.myappstore.KeepAliveConnection;
|
||||||
|
import com.mjsheng.myappstore.MyApplication;
|
||||||
import com.mjsheng.myappstore.utils.ApkUtils;
|
import com.mjsheng.myappstore.utils.ApkUtils;
|
||||||
import com.mjsheng.myappstore.utils.ServiceAliveUtils;
|
import com.mjsheng.myappstore.utils.ServiceAliveUtils;
|
||||||
import com.mjsheng.myappstore.utils.ToastUtil;
|
import com.mjsheng.myappstore.utils.ToastUtil;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -86,33 +90,38 @@ public class GuardService extends Service {
|
|||||||
@Download.onTaskRunning
|
@Download.onTaskRunning
|
||||||
protected void running(DownloadTask task) {
|
protected void running(DownloadTask task) {
|
||||||
Log.e("aria", "正在下载=--------------::" + task.getState() + "-------" + task.getPercent() + "-------" + task.getExtendField());
|
Log.e("aria", "正在下载=--------------::" + task.getState() + "-------" + task.getPercent() + "-------" + task.getExtendField());
|
||||||
ToastUtils.showShort("正在下载=--------------::" + task.getExtendField() + "-------" + task.getPercent());
|
ToastUtil.show("正在下载:" + task.getExtendField() + "--" + task.getPercent() + "%" + "\t" + Formatter.formatFileSize(GuardService.this, task.getSpeed()) + "/s");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Download.onTaskComplete
|
@Download.onTaskComplete
|
||||||
void taskComplete(DownloadTask task) {
|
void taskComplete(DownloadTask task) {
|
||||||
//在这里处理任务完成的状态
|
//在这里处理任务完成的状态
|
||||||
final String filepath = task.getDownloadPath();
|
final String filepath = task.getFilePath();
|
||||||
final String packageName = task.getExtendField();
|
final String packageName = task.getExtendField();
|
||||||
Log.e("aria", "downloadPath::" + filepath);
|
Log.e("aria", "downloadPath::" + filepath);
|
||||||
Log.e("aria", "extendField::" + packageName);
|
Log.e("aria", "extendField::" + packageName);
|
||||||
String s = Settings.System.getString(getContentResolver(), "qch_app_forbid");
|
// ApkUtils.installApp(filepath);
|
||||||
String s1 = s;
|
|
||||||
if (s != null && !s.contains(packageName)) {
|
|
||||||
s1 = s + "," + packageName;
|
|
||||||
Settings.System.putString(getContentResolver(), "qch_app_forbid", s1);
|
|
||||||
}
|
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
ApkUtils.installApp(GuardService.this, filepath);
|
ApkUtils.installApp(GuardService.this, filepath);
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
|
try {
|
||||||
|
Aria.download(this).load(Aria.download(this).getFirstDownloadEntity(task.getDownloadUrl()).getId()).cancel();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e("aria", e.getMessage());
|
||||||
|
}
|
||||||
|
List<DownloadEntity> list = Aria.download(this).getDRunningTask();
|
||||||
|
if (list == null || list.size() == 0) {
|
||||||
|
MyApplication.getInstance().setDownloadState(false);
|
||||||
|
Log.e("aria", "isDownloading=" + MyApplication.getInstance().isDownloading());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Download.onTaskFail
|
@Download.onTaskFail
|
||||||
void taskFail(DownloadTask task) {
|
void taskFail(DownloadTask task) {
|
||||||
final String filepath = task.getDownloadPath();
|
final String filepath = task.getFilePath();
|
||||||
final String packageName = task.getExtendField();
|
final String packageName = task.getExtendField();
|
||||||
Log.e("aria", "下载失败:" + filepath);
|
Log.e("aria", "下载失败:" + filepath);
|
||||||
ToastUtil.show("下载失败:" + packageName);
|
ToastUtil.show("下载失败:" + packageName);
|
||||||
|
|||||||
@@ -372,7 +372,14 @@ public class InitJpushServer extends Service {
|
|||||||
public void onNext(ForceDownloadBean forceDownloadBean) {
|
public void onNext(ForceDownloadBean forceDownloadBean) {
|
||||||
switch (forceDownloadBean.getCode()) {
|
switch (forceDownloadBean.getCode()) {
|
||||||
case 200:
|
case 200:
|
||||||
|
Log.e("getForceDownload", "isDownloading=" + MyApplication.getInstance().isDownloading());
|
||||||
|
MyApplication.getInstance().checkIsDownloading();
|
||||||
|
if (!MyApplication.getInstance().isDownloading()) {
|
||||||
|
Aria.download(this).removeAllTask(true);
|
||||||
forceDownload(forceDownloadBean.getData());
|
forceDownload(forceDownloadBean.getData());
|
||||||
|
} else {
|
||||||
|
Aria.download(this).resumeAllTask();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LogUtils.e("getForceDownload is error:" + forceDownloadBean.getMsg());
|
LogUtils.e("getForceDownload is error:" + forceDownloadBean.getMsg());
|
||||||
@@ -417,9 +424,9 @@ public class InitJpushServer extends Service {
|
|||||||
if (!SaveListUtils.isDownLoading(app_package)) {
|
if (!SaveListUtils.isDownLoading(app_package)) {
|
||||||
Aria.download(this)
|
Aria.download(this)
|
||||||
.load(app_url) //读取下载地址
|
.load(app_url) //读取下载地址
|
||||||
.setDownloadPath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString(app_package) + ".apk")
|
.setFilePath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString(app_package) + ".apk")
|
||||||
.setExtendField(app_package)
|
.setExtendField(app_package)
|
||||||
.start(); //启动下载}
|
.create(); //启动下载}
|
||||||
SaveListUtils.addDownLoadList(app_package);
|
SaveListUtils.addDownLoadList(app_package);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -431,9 +438,9 @@ public class InitJpushServer extends Service {
|
|||||||
if ("com.jiaoguanyi.appstore".equals(forceDownloadData.getApp_package())) {
|
if ("com.jiaoguanyi.appstore".equals(forceDownloadData.getApp_package())) {
|
||||||
Aria.download(this)
|
Aria.download(this)
|
||||||
.load(forceDownloadData.getApp_url()) //读取下载地址
|
.load(forceDownloadData.getApp_url()) //读取下载地址
|
||||||
.setDownloadPath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString("com.jiaoguanyi.appstore") + ".apk")
|
.setFilePath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString("com.jiaoguanyi.appstore") + ".apk")
|
||||||
.setExtendField("com.mjsheng.myappstore")
|
.setExtendField("com.mjsheng.myappstore")
|
||||||
.start(); //启动下载}
|
.create(); //启动下载}
|
||||||
} else {
|
} else {
|
||||||
Log.e("fht", "未上传应用");
|
Log.e("fht", "未上传应用");
|
||||||
}
|
}
|
||||||
@@ -688,9 +695,10 @@ public class InitJpushServer extends Service {
|
|||||||
getDeselectBrowerID();
|
getDeselectBrowerID();
|
||||||
getNetAndLaunchSetting();
|
getNetAndLaunchSetting();
|
||||||
// Aria.download(this).removeAllTask(true);
|
// Aria.download(this).removeAllTask(true);
|
||||||
// getForceDownload();
|
getForceDownload();
|
||||||
getSystemSetting();//从后台获取功能状态
|
getSystemSetting();//从后台获取功能状态
|
||||||
resetDevice();
|
resetDevice();
|
||||||
|
HTTPInterface.setAppinsideWeb(InitJpushServer.this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -953,7 +961,7 @@ public class InitJpushServer extends Service {
|
|||||||
.load(url) //读取下载地址
|
.load(url) //读取下载地址
|
||||||
.setFilePath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString(packageName) + ".apk", true)
|
.setFilePath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString(packageName) + ".apk", true)
|
||||||
.setExtendField(packageName)
|
.setExtendField(packageName)
|
||||||
.start(); //启动下载}
|
.create(); //启动下载}
|
||||||
} else {
|
} else {
|
||||||
Log.e("fht", "无需更新");
|
Log.e("fht", "无需更新");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ public class MyDownloadService extends Service {
|
|||||||
// if (MyApplication.getInstance().getInstallIngPackageName().equals("") || ApkUtils.isAvailable(getApplicationContext(), MyApplication.getInstance().getInstallIngPackageName())) {
|
// if (MyApplication.getInstance().getInstallIngPackageName().equals("") || ApkUtils.isAvailable(getApplicationContext(), MyApplication.getInstance().getInstallIngPackageName())) {
|
||||||
//没有任务或者任务已经安装
|
//没有任务或者任务已经安装
|
||||||
Log.e("fht", "task package is installed , install new apk ");
|
Log.e("fht", "task package is installed , install new apk ");
|
||||||
ApkUtils.installApkInSilence(downloadInfo.getTargetPath(), info.getApp_baoming());
|
ApkUtils.installApp(MyDownloadService.this, info.getApp_file());
|
||||||
// } else {
|
// } else {
|
||||||
// //更新正在安装的信息,更新任务列表
|
// //更新正在安装的信息,更新任务列表
|
||||||
// MyApplication.getInstance().setInstallIngPackageName("");
|
// MyApplication.getInstance().setInstallIngPackageName("");
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ public class StepService extends Service {
|
|||||||
* 初始化websocket连接
|
* 初始化websocket连接
|
||||||
*/
|
*/
|
||||||
private void initSocketClient() {
|
private void initSocketClient() {
|
||||||
URI uri = URI.create("ws://47.107.133.19:2345");
|
URI uri = URI.create("ws://47.107.133.19:1234");
|
||||||
// URI uri = URI.create("ws://echo.websocket.org");
|
// URI uri = URI.create("ws://echo.websocket.org");
|
||||||
// URI uri = URI.create("ws://123.207.136.134:9010/ajaxchattest");
|
// URI uri = URI.create("ws://123.207.136.134:9010/ajaxchattest");
|
||||||
client = new JWebSocketClient(uri) {
|
client = new JWebSocketClient(uri) {
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ public class ApkUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean installApp(Context context, String apkPath) {
|
public static boolean installApp(Context context, String apkPath) {
|
||||||
ToastTool.show("正在安装应用...");
|
ToastUtil.show("正在安装应用...");
|
||||||
Process process = null;
|
Process process = null;
|
||||||
BufferedReader successResult = null;
|
BufferedReader successResult = null;
|
||||||
BufferedReader errorResult = null;
|
BufferedReader errorResult = null;
|
||||||
@@ -349,7 +349,7 @@ public class ApkUtils {
|
|||||||
|
|
||||||
|
|
||||||
public static void installApkInSilence(String installPath, String packageName) {
|
public static void installApkInSilence(String installPath, String packageName) {
|
||||||
ToastTool.show("正在安装应用...");
|
ToastUtil.show("正在安装应用...");
|
||||||
|
|
||||||
Class<?> pmService;
|
Class<?> pmService;
|
||||||
Class<?> activityTherad;
|
Class<?> activityTherad;
|
||||||
|
|||||||
@@ -191,5 +191,10 @@ public class Configure {
|
|||||||
public static final String GET_DEVICES_TAGS = HTTP_TAG_HEAD_NEW + "Sn/getSnTag";
|
public static final String GET_DEVICES_TAGS = HTTP_TAG_HEAD_NEW + "Sn/getSnTag";
|
||||||
//获取设备标签
|
//获取设备标签
|
||||||
public static final String DELETE_GEDEVICE_ALIAS = HTTP_TAG_HEAD_NEW + "Sn/deleteAliases";
|
public static final String DELETE_GEDEVICE_ALIAS = HTTP_TAG_HEAD_NEW + "Sn/deleteAliases";
|
||||||
|
//浏览器书签主页设置
|
||||||
|
public static final String SET_HOMEPAG_TAG = HTTP_TAG_HEAD_NEW + "Label";
|
||||||
|
//
|
||||||
|
public static final String SET_APPINSIDEWEB= HTTP_TAG_HEAD_NEW + "Appground";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user