我如何获得Android的锁屏包名 [英] How do I get android lockscreen package name

查看:777
本文介绍了我如何获得Android的锁屏包名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法来获取Android锁屏包名?

Is there a way to get the android lockscreen package name?

我要显示使用 AlertDialog.Builder 锁定画面警报。所以,我需要知道什么时候锁定画面是活动的,就是它的包名。

I want to show alert on the lockscreen using AlertDialog.Builder. So I need to know when the lockscreen is active and what it's package name.

推荐答案

找到一个本地的解决方案。当您建立警报对话框并显示它之前,应用此:

Found a native solution. After you build the Alert dialog and before showing it, apply this:

AlertDialog alertDialog = new AlertDialog.Builder(context).create();
        alertDialog.getWindow().setType(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
        alertDialog.show();

这将显示在锁屏界面顶部的对话框。

This will show the dialog on top of the lock screen.

这篇关于我如何获得Android的锁屏包名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆