Ejemplo n.º 1
0
 /** * 设置浮窗权限 */
 public void setDrawOverlays() {
   if (VersionUtil.isM()) {
     MainActivity mainActivity = (MainActivity) mMainMediator;
     Intent intent =
         new Intent(
             Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
             Uri.parse("package:" + mainActivity.getPackageName()));
     mainActivity.startActivityForResult(intent, Constants.OVERLAY_PERMISSION_REQ_CODE);
   }
 }
Ejemplo n.º 2
0
 /** * 检测是否支持windows显示 */
 public boolean canDrawOverlays() {
   if (VersionUtil.isM()) {
     MainActivity mainActivity = (MainActivity) mMainMediator;
     if (!Settings.canDrawOverlays(mainActivity)) {
       mMainMediator.showDrawOverlaysDialog();
       return false;
     }
   }
   return true;
 }