-
Notifications
You must be signed in to change notification settings - Fork 747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
关于Android9.0下载完成后无法自动安装问题 #121
Comments
04-23 11:55:00.472 27013 27013 W System.err: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? 我这边测试也发现这个问题,在红米安卓9.0的机器上也是不会自动安装,比较尴尬的是这部分代码即使加上去之后,也是在升级完成的Apk中生效,前一个版本的Apk无法自动安装,需要手动去找安装包,然后升级。 另外在调试过程中发现个问题,就是我这边APP的SDK版本还是25, 但是update-app模块的SDK指定的是26,在运行时DownloadService中通知适配这块,对于channel的使用需要增加版本判断处理: 否则会报如下异常: |
补充说明一下,我这边出现问题的版本是3.3.1,使用最新代码编译出的aar文件来运行不会有这个问题,因为在安卓9.0上代码逻辑走的是:public static boolean installApp(Activity activity, File appFile) |
一楼正解,赞 |
测试 三星 S8+ 华为nove3 Android 9.0机型无法 自动安装
原因是在installApp 走了异常,亲测可用 请 作者尽快修复问题
解决办法 AppUpdateUtils 增加 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
`
public static boolean installApp(Context context, File appFile) {
try {
Intent intent = getInstallAppIntent(context, appFile);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (context.getPackageManager().queryIntentActivities(intent, 0).size() > 0) {
context.startActivity(intent);
The text was updated successfully, but these errors were encountered: