是否有任何方法可以授予应用程序在另一个应用程序之上启动 Activity 的权限?例如,当您正在使用其他应用程序时有人通过您的手机调用您,则调用 Activity 优先。
最佳答案
要授予权限,请添加
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
到您的 list 文件。
要在其他应用程序之上显示 View ,请使用窗口管理器
WindowManager windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
WindowManager.LayoutParams paramsForButton = new WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
windowManager.addView(yourViewWindowManager.LayoutParams, paramsForButton);
关于android - 屏幕上的应用程序优先级,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35203892/