I need to play Application Not Response (ANR) dialogs from Activity and from BroadCastReceiver. I tried to create a simple click on a button:
public void makeANRClick(View view){ while (true); }
With this code, I reproduced ANR on an emulator using android 2.3.7. The same code does not work on a real device with the latest versions of Android (4+).
Another attempt was as follows:
public void onMakeANRClick(View view){ try { Thread.sleep(15000); } catch (InterruptedException e) { e.printStackTrace(); } }
That doesn't help either. Any suggestions?
android android-anr-dialog
Alexander Myznikov
source share