Commit 1ed83019 by pye52

Merge branch 'new_master' into new_for_phone

parents d07c1b13 f7a10807
......@@ -6,6 +6,7 @@
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
......@@ -22,6 +23,7 @@
android:name=".RootApp"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity"
android:launchMode="singleInstance"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
......@@ -39,6 +41,16 @@
<data android:scheme="canteen"/>
</intent-filter>
</activity>
<receiver
android:name=".broadcast.BootBroadcast"
android:enabled="true"
android:exported="true"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
<intent-filter android:priority="1000">
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
</application>
</manifest>
\ No newline at end of file
package com.bgycc.smartcanteen.broadcast;
import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.bgycc.smartcanteen.MainActivity;
public class BootBroadcast extends BroadcastReceiver {
@SuppressLint("UnsafeProtectedBroadcastReceiver")
@Override
public void onReceive(Context context, Intent intent) {
Intent scIntent = new Intent(context, MainActivity.class);
scIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(scIntent);
}
}
......@@ -5,6 +5,7 @@ import com.bgycc.smartcanteen.api.SCRetrofit;
import com.bgycc.smartcanteen.entity.Command;
import com.bgycc.smartcanteen.entity.CommandResponse;
import com.bgycc.smartcanteen.entity.CommandUpdate;
import com.bgycc.smartcanteen.utils.DangerousUtils;
import com.blankj.utilcode.util.AppUtils;
import com.blankj.utilcode.util.FileIOUtils;
import com.blankj.utilcode.util.FileUtils;
......@@ -68,7 +69,7 @@ public class UpdateCommandHandler extends CommandHandler {
(info.getPackageName().equals(BuildConfig.APPLICATION_ID) && info.getVersionCode() < BuildConfig.VERSION_CODE)) {
return failed("不允许安装低版本");
} else {
AppUtils.installApp(updateApk);
DangerousUtils.installAppSilent(updateApk);
return success("安装更新包");
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment