Android 9 (Pie) Only: Context.startForegroundService() did not then call Service.startForeground() - Works fine on Oreo

后端 未结 3 1401
陌清茗
陌清茗 2021-02-04 03:04

We adjusted our ongoing notification for Oreo and it worked great. Now, on Pie only (not happening on Oreo devices), we\'re getting the titled error. Has something changed in

3条回答
  •  既然无缘
    2021-02-04 03:49

    Has something changed in foreground services in Pie that I'm missing?

    YES Have a look here migration notes of Android 9 / Pie

    Change

    Foreground service permission

    Summary

    Apps wanting to use foreground services must now request the FOREGROUND_SERVICE permission first. This is a normal permission, so the system automatically grants it to the requesting app. Starting a foreground service without the permission throws a SecurityException.

    UPDATE

    related issue in Google Issue Tracker Context.startForegroundService() did not then call Service.startForeground

提交回复
热议问题