2007窗口类型的java Android权限被拒绝
我正在我的项目中使用这个库:https://github.com/recruit-lifestyle/FloatingView
我得到了这个错误: Click here for picture of error
这个图书馆不卖棉花糖和牛轧糖
代码:
final LayoutInflater inflater = LayoutInflater.from(bCon);
final ImageView iconView = (ImageView) inflater.inflate(R.layout.widget_chathead, null, false);
final DisplayMetrics metrics = new DisplayMetrics();
final WindowManager windowManager = (WindowManager)bCon.getSystemService(Context.WINDOW_SERVICE);
windowManager.getDefaultDisplay().getMetrics(metrics);
mFloatingViewManager = new FloatingViewManager(bCon, this);
mFloatingViewManager.setFixedTrashIconImage(R.drawable.ic_trash_fixed);
mFloatingViewManager.setActionTrashIconImage(R.drawable.ic_trash_action);
final FloatingViewManager.Options options = new FloatingViewManager.Options();
options.overMargin = (int) (16 * metrics.density);
mFloatingViewManager.addViewToWindow(iconView, options);
# 1 楼答案
此库使用
SYSTEM_ALERT_WINDOW
权限从android M开始,每个请求
SYSTEM_ALERT_WINDOW
权限并通过Play Store安装(需要6.0.5或更高版本)的应用程序将自动获得该应用程序的权限如果不是从play store安装应用程序,则不会自动授予该权限。您必须在运行时手动请求此权限,就像其他危险的权限是从Android M及更高版本处理的一样