簡體   English   中英

Xamarin Android服務崩潰

[英]Xamarin Android Service Crash

有人知道這個崩潰轉儲意味着什么嗎?

當應用程序從手機的重新啟動的BroadcastReceiver啟動時,我收到了它。 如果它是從應用程序本身啟動的,則它不會崩潰(應用程序活動)

java.lang.RuntimeException: 
  at android.app.ActivityThread.handleReceiver (ActivityThread.java:3399)
  at android.app.ActivityThread.-wrap18 (Unknown Source)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1780)
  at android.os.Handler.dispatchMessage (Handler.java:105)
  at android.os.Looper.loop (Looper.java:164)
  at android.app.ActivityThread.main (ActivityThread.java:6944)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)
Caused by: java.lang.IllegalStateException: 
  at android.app.ContextImpl.startServiceCommon (ContextImpl.java:1538)
  at android.app.ContextImpl.startService (ContextImpl.java:1484)
  at android.content.ContextWrapper.startService (ContextWrapper.java:663)
  at md5922925ce4b86bef9f24d805446f8ebdd.BootReceiver.n_onReceive (Native Method)
  at md5922925ce4b86bef9f24d805446f8ebdd.BootReceiver.onReceive (BootReceiver.java:29)
  at android.app.ActivityThread.handleReceiver (ActivityThread.java:3392)

顯然,對於Android Oreo而言 ,如果您嘗試在特定時刻使用startService (啟動似乎是其中之一),則會彈出此錯誤,並且要解決此問題,我不得不改用StartForegroundService 不知道這是否是最好的方法,但是由於我的服務被假定為前台服務,因此它不會妨礙我。

我在這里找到的信息

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM