How to detect Android Application Boot/Launcher [closed]

六月ゝ 毕业季﹏ 提交于 2019-12-13 11:06:55

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!