问题
How to detect Android application launcher/boot?
And give some idea briefly.
I want to detect launcher application. which application is launcher i want to push my password screen after that it will go to application.. it's same app locker
回答1:
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Vibrator;
import android.widget.Toast;
public class MyBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, "Don't panik but your time is up!!!!.",
Toast.LENGTH_LONG).show();
// Vibrate the mobile phone
Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
vibrator.vibrate(2000);
}
}
and also pass intent filter in android manifest file
来源:https://stackoverflow.com/questions/14725665/how-to-detect-android-application-boot-launcher