前台服务报错如下
Caused by: java.lang.SecurityException: Permission Denial:startForeground from pid=32168, uid=10088 requires android.permission.FOREGROUND_SERVICE
在AndroidMainfest.xml里加一段代码就好
<manifest xmlns:android="/apk/res/android"package="com.example.servicetest">
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<application