LAMW how to request special overlay permission [SOLVED] lazarus / 43-Android ---------------------------------------------------------------------- Segator · 2020-08-17 21:05 Hi people, i try the AppWindowManagerDemo1 before and work fine but with my new phono and android 10 no work fine, a make some search and this required an overlay permission but i change it on the manifest adding this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i and in the source code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if IsRuntimePermissionsNeed() thenbegin  SetLength(manifestpermissions,1);  manifestPermission:='android.permission.SYSTEM_ALERT_WINDOW';  self.RequestRuntimePermission(manifestPermissions, 2001);  SetLength(manifestpermissions,0);end;  not permission is requested and if i add the permission manually and try to do: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i jwindowMana ger1.addview(jpanel1.view);jwindowmanager1.SetViewRoudCorner();self.mi nimize();the app crach ---------------------------------------------------------------------- Segator · 2020-08-18 17:32 I fix the manifest xml file, now the project work in Andorid 7.0 (emultator) but still having 2 problems: 1: AppWindowManagerDemo1 not run in Android 10 (Samsung A10s) 2: I have to set the overlay permision manually. ---------------------------------------------------------------------- jmpessoa · 2020-08-18 17:38 QuoteI have to set the overlay permision manually. How? ---------------------------------------------------------------------- Segator · 2020-08-18 17:43 Quote from: jmpessoa on August 18, 2020, 07:38:56 pmQuoteI have to set the overlay permision manually. How? in the phone general settings permision, because this Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if IsRuntimePermissionsNeed() thenbegin  SetLength(manifestpermissions,1);  manifestPermission:='android.permission.SYSTEM_ALERT_WINDOW';  self.RequestRuntimePermission(manifestPermissions, 2001);  SetLength(manifestpermissions,0);end; not work for me and even with the manualy permission granted work only in Android 7, crach in Android 10. ---------------------------------------------------------------------- Segator · 2020-08-18 17:54 I found this Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i @RequiresApi(api = Build.VERSION_CODES.M)  public void checkDrawOverlayPermission() {   Log.v("App", "Package Name: " + getApplicationContext().getPackageName());    // check if we already  have permission to draw over other apps   if (!Settings.canDrawOverlays(context)) {    Log.v("App", "Requesting Permission" + Settings.canDrawOverlays(context));    // if not construct intent to request permission    Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,     Uri.parse("package:" + getApplicationContext().getPackageName()));  / request permission via start activity for result    startActivityForResult(intent, REQUEST_CODE);   } else {    Log.v("App", "We already have permission for it.");    disablePullNotificationTouch();   }  }and i try to do this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     jIntent Manager1.SetAction('Settings.ACTION_MANAGE_OVERLAY_PERMISSION');    jIntentManager1.SetDataUriAsString('package: '+gapp.PackageName);    jIntentManager1.StartActivityForResult(1001);but nothing is happend. ---------------------------------------------------------------------- Segator · 2020-08-19 14:09 I note other problem running the demo for jWindowManager componet, when htey show like a floating window never lost the focus and the back button not work in other apps then. ---------------------------------------------------------------------- Segator · 2020-08-19 16:32 i found this https://blog.floatingapps.net/2019/11/cant-grant- permissions-to-fa-because-of-draw-over-other-apps/ basically in android 10 you can't request other permission after the overlay permission grant, you must request this permission before others, about the always focused window i try to make a wrapper to the SetViewFocusable procedure in jWindowManager.java and if a call this the application crach ---------------------------------------------------------------------- Segator · 2020-08-21 16:24 Finally i solved this particular request permission, i send a pull request to github, when this change you can do something like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i jIntentMana ger1.SetAction(iaManageOverlayPermission);jIntentManager1.SetDataUriAs String('package:'+gapp.PackageName);jIntentManager1.StartActivityForRe sult(1006);  but for now i can't know if the permission is granted or not. ---------------------------------------------------------------------- jmpessoa · 2020-08-21 17:47 You can try handle event  the "OnActivityResult"   from jForm... ---------------------------------------------------------------------- Segator · 2020-08-21 18:20 i try it but the variable resultCode only manage RESULT_CANCELED and RESULT_OK with no change effect in action manage overlay permission window, even with the overlay button active is not a result_ok. edited: this not work: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if resultCode = RESULT_OK thenShowMessage('done');the toast never prompt