android - Using StrictMode in app production phase -


i know strictmode designed used in application development phase, according app needs, it's not acceptable anr while it's quite acceptable crash, , strictmode provides way prevent anr dialogs:

strictmode.setvmpolicy(new strictmode.vmpolicy.builder().detectall()             .penaltylog().penaltydeath().build()); 

what if used inside app production phase? , happen when app getting anr while strictmode used? freeze, crash, or wait until getting responded again?

strictmode disabled default, , users needs enter "developer's mode" in android enable it.
makes solution of using strictmode irrelevant.

anr's occur in rare occasions out of control, due conditions such low memory or other app choking cpu.
however, can minimize likelihood of getting anr's moving every single operation access storage or network asynchronous task.
in software add line of code dangerous places:

assert !util.ismainthread():"woh! doing on main thread??"

and have method in util class:

public static boolean ismainthread() {     return looper.mylooper().equals(looper.getmainlooper()); } 

... , useful tip enable assertion command line:
adb shell setprop debug.assert 1 or 0 disable.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -