i want to set receiver when ever any application get launched in android,after that i have to do some task.is there any way to do?
@Override
public void onReceive(Context context, Intent intent) {
try {
} catch (Exception e) {
}
}
I have to set this receiver,when ever any application launched....
As far as I understand, you want to receive a broadcast whenever any application is launched. Unfortunately, there's no intent that is fired by the system for this, so it's not possible to receive a broadcast when any other application is launched. Though, you can determine the currently running application using ActivityManager and ComponentInfo (Google it, though this method will only work for pre-L devices, as Android L has removed this in view of increasing security). Hope this helps.