Reputation: 167
My question is, what is the API for the sleep mode of a phone, if the phone is not used for a couple of minutes it goes into sleep mode right? Well what is the programming section on Android development is that?
Upvotes: 1
Views: 844
Reputation: 5282
Take a look on PowerManager and its inner class PowerManager.WakeLock. For example, to prevent some code from sleeping wrap it with
PowerManager pm = (PowerManager) SJPhone.getContext().getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wl = pm.newWakeLock(flags,WAKE_LOCK_STR);
wl.acquire();
// you code goes here
wl.release();
wl = null;
Upvotes: 2