title: Application Not Responding, Android
body: <p>I have an Android app written with Xamarin. The app starts foreground service that retrieves data from some api. Service can work a few hours but every time crashes. In logcat I found the following lines:</p>
  
  <pre><code>06-14 22:23:19.715 21636 14406 I chatty  : uid=10469(apisearch.app) com.google.android.gms:snet expire 4 lines
  06-14 22:29:23.484  1370  1486 W BroadcastQueue: Receiver during timeout of BroadcastRecord{a9b6e57 u-1 android.intent.action.SCREEN_ON} : BroadcastFilter{2c89fd4 u0 ReceiverList{88a5127 21636 apisearch.app/10469/u0 remote:ab777e6}}
  06-14 22:29:23.997 21636 21643 I chatty  : uid=10469(apisearch.app) com.google.android.gms:snet expire 6 lines
  06-14 22:29:29.544  1370  1486 E ActivityManager: ANR in apisearch.app
  06-14 22:29:29.544  1370  1486 E ActivityManager:   5.1% 21636/apisearch.app: 1.6% user + 3.4% kernel / faults: 2368 minor 47 major
  06-14 22:29:39.681  1370  1486 W BroadcastQueue: Receiver during timeout of BroadcastRecord{a9b6e57 u-1 android.intent.action.SCREEN_ON} : BroadcastFilter{15c8096 u0 ReceiverList{6613b1 21636 apisearch.app/10469/u0 remote:1b9e658}}
  06-14 22:29:39.757  1370  1486 I ActivityManager: Skipping duplicate ANR: ProcessRecord{216d57d 21636:apisearch.app/u0a469} Broadcast of Intent { act=android.intent.action.SCREEN_ON flg=0x50200010 }
  06-14 22:29:45.734   767  2549 W SurfaceFlinger: Attempting to destroy on removed layer: 156adb9 Application Not Responding: apisearch.app#0
  06-14 22:29:59.217  1370  1486 W BroadcastQueue: Receiver during timeout of BroadcastRecord{c88555d u-1 android.intent.action.SCREEN_OFF} : BroadcastFilter{c3a341a u0 ReceiverList{c12c5 21636 apisearch.app/10469/u0 remote:cd2e53c}}
  06-14 22:30:04.496  1370  1486 E ActivityManager: ANR in apisearch.app
  06-14 22:30:04.496  1370  1486 E ActivityManager:   3.8% 21636/apisearch.app: 1.9% user + 1.9% kernel / faults: 1972 minor
  06-14 22:30:04.506  1370  1487 W ActivityManager:   Force finishing activity apisearch.app/md567688bd8e9e66faa4b09faba0f3906cb.CommentsActivity
  06-14 22:30:04.522  1370  1487 I ActivityManager: Killing 21636:apisearch.app/u0a469 (adj 200): user request after error
  06-14 22:30:05.169  1370  3238 I AutoStartManagerService: MIUILOG- Reject RestartService packageName :apisearch.app uid : 10469
  06-14 22:30:05.169  1370  1836 I ProcessManager: remove no clear notification:StatusBarNotification(pkg=apisearch.app user=UserHandle{0} id=10000 tag=null key=0|apisearch.app|10000|null|10469: Notification(channel=search service channel pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x62 color=0x00000000 vis=PRIVATE))
  06-14 22:30:05.208  2093  2093 I Launcher.ApplicationsMessage: update apisearch.app/ to null
  06-14 22:30:05.215  1370  3290 I WindowManager: WIN DEATH: Window{e97fff3 u0 apisearch.app/md567688bd8e9e66faa4b09faba0f3906cb.CommentsActivity}
  06-14 22:30:05.215  1370  3241 I AutoStartManagerService: MIUILOG- Reject RestartService packageName :apisearch.app uid : 10469
  06-14 22:30:05.225  1370  3251 I WindowManager: WIN DEATH: Window{b5e3c91 u0 apisearch.app/md567688bd8e9e66faa4b09faba0f3906cb.MainActivity}
  06-14 22:30:05.258  1370  1486 W BroadcastQueue: Skipping deliver [foreground] BroadcastRecord{c88555d u-1 android.intent.action.SCREEN_OFF} to ReceiverList{4f2a81d 21636 apisearch.app/10469/u0 remote:37b98f4}: process gone or crashing
  06-14 22:30:05.296  1370  3241 W BroadcastQueue: Skipping deliver [foreground] BroadcastRecord{c88555d u-1 android.intent.action.SCREEN_OFF} to ReceiverList{6613b1 21636 apisearch.app/10469/u0 remote:1b9e658}: process gone or crashing
  </code></pre>
  
  <p>As far as I understand Android forcibly stops my application because it is not responding. I can not understand why? Maybe anyone has some ideas? Thank you in advance</p>