Search code examples
javaandroidandroid-strictmode

If use strictmode in my codes, will the security of login be weaken?


Having some doubts on the importing the strict mode in my login application. If i enable this in my code,

   StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
    StrictMode.setThreadPolicy(policy);

will the security features in my login weakened? Or I should just use the async task?


Solution

  • Since android version 3.0 there has been some restrictions of using the network related code in the main ui thread as it would cause ANR. Hence by putting the Strict mode thread policy in your code you are violating this restriction and you can use network related code in the main thread, This will not anyways weak your login feature.