I want to prevent Android Mobile from going into sleep mode when my threads are sending HTTP request. as what happened while threads are doing HTTP calls mobiles goes to sle
for JAVA:getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); for KOTLIN:window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
Use this code, it will keep your device wake up and you didn't need any permission.