我已定义目标 SDK 版本 31。我仅在 Android 12 设备上收到此错误。有很多崩溃的情况。
服务可能有点过度劳累。它正在从数据库中读取数据。在适当的条件下显示通知。我在某些地方使用Handler和Runnable 。
我该如何解决这个问题,或者至少找到一种方法来忽略它?
android.app.ForegroundServiceDidNotStartInTimeException:
at android.app.ActivityThread.throwRemoteServiceException (ActivityThread.java:2143)
at android.app.ActivityThread.access$2900 (ActivityThread.java:310)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2372)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loopOnce (Looper.java:226)
at android.os.Looper.loop (Looper.java:313)
at android.app.ActivityThread.main (ActivityThread.java:8633)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:567)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1135)
Run Code Online (Sandbox Code Playgroud) 我使用下面的代码:
let request : GADRequest = GADRequest ()
request.testDevices = ["xxxxxxx",kGADSimulatorID]
但我收到以下警告:
不推荐使用“testDevices”:使用 GADMobileAds.sharedInstance.requestConfiguration.testDeviceIdentifiers。
我是否使用语法来删除警告?