Android targetsdkversion 25 --> 26升级带来的问题

1.升级到26之后,系统禁止应用从后台启动服务,会报如下错误

java.lang.RuntimeException:Unable to start receiver xxx.CheckAlarmReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=xxx.schedule.RollUploadService }: app is in background uid UidRecord{324e131 u0a189 RCVR bg:+9m48s782ms idle change:uncached procs:3 seq(0,0,0)}

Google提供的方案是:startForegroundService()。并且在系统创建Service后,需要在一定时间内调用startForeground()让Service为用户可见通知


2.在app升级的时候,调用系统安装程序安装指定位置的apk时,需要添加permission android.permission.REQUEST_INSTALL_PACKAGES权限

你可能感兴趣的:(Android targetsdkversion 25 --> 26升级带来的问题)