Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Operating Systems
»
Android
»
LAMW how to request special overlay permission [SOLVED]
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Status of FPC 3.4.0 or FP...
by
DavidL
[
Today
at 03:37:38 am]
[ANN] fpGUI Toolkit v2.0....
by
Graeme
[
Today
at 02:57:36 am]
My AGGPas examples
by
Graeme
[
Today
at 02:52:48 am]
We are starting to use La...
by
dbannon
[
Today
at 02:15:01 am]
Reporting a Bug? in Strin...
by
Bart
[
Today
at 01:48:34 am]
QuestionDlg does strange ...
by
Martin_fr
[
Today
at 01:16:29 am]
SoundTracker Player Libra...
by
hukka
[
Today
at 01:01:39 am]
it2play - IT/S3M module r...
by
hukka
[
Today
at 12:47:05 am]
Reflection and Review in ...
by
jwdietrich
[February 14, 2026, 09:53:31 pm]
How to determine the unkn...
by
Roland57
[February 14, 2026, 09:42:26 pm]
fpGUI Toolkit v2.0.1 has ...
by
cdbc
[February 14, 2026, 09:32:46 pm]
LazReport
by
dseligo
[February 14, 2026, 08:51:08 pm]
Howto : Double buffer wit...
by
biologic
[February 14, 2026, 06:42:42 pm]
how to enable multihelper...
by
PascalDragon
[February 14, 2026, 06:30:05 pm]
Free Pascal for a small e...
by
devEric69
[February 14, 2026, 06:19:36 pm]
Fast Canvas Library V1.05...
by
backprop
[February 14, 2026, 05:46:10 pm]
Are the source files for ...
by
Derz
[February 14, 2026, 05:12:27 pm]
[ANN] PasBuild 1.3.0 rele...
by
Graeme
[February 14, 2026, 05:02:32 pm]
Frustrating Error When us...
by
jamie
[February 14, 2026, 04:22:29 pm]
; after then
by
Curt Carpenter
[February 14, 2026, 04:09:29 pm]
Help needed compiling
by
jamie
[February 14, 2026, 03:58:08 pm]
Does not go out of functi...
by
Martin_fr
[February 14, 2026, 03:43:52 pm]
How to start LAMW emulato...
by
RaketeMike
[February 14, 2026, 12:44:46 pm]
ThorVG - test (lightweigh...
by
Antek
[February 14, 2026, 12:35:09 pm]
Questions from a Windows ...
by
hedgehog
[February 14, 2026, 12:20:15 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: LAMW how to request special overlay permission [SOLVED] (Read 3361 times)
Segator
Full Member
Posts: 168
LAMW how to request special overlay permission [SOLVED]
«
on:
August 17, 2020, 11:05:55 pm »
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]
[+]
[-]
<uses
-
permission android
:
name
=
"android
.
permission
.
SYSTEM_ALERT_WINDOW
"
/
>
and in the source code:
Code: Pascal
[Select]
[+]
[-]
if
IsRuntimePermissionsNeed
(
)
then
begin
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]
[+]
[-]
jwindowManager1
.
addview
(
jpanel1
.
view
)
;
jwindowmanager1
.
SetViewRoudCorner
(
)
;
self
.
minimize
(
)
;
the app crach
«
Last Edit: August 21, 2020, 06:24:33 pm by Segator
»
Logged
i am Reinier, Nenirey and Segator
https://github.com/Nenirey
Segator
Full Member
Posts: 168
Re: LAMW how to request special overlay permission
«
Reply #1 on:
August 18, 2020, 07:32:09 pm »
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.
Logged
i am Reinier, Nenirey and Segator
https://github.com/Nenirey
jmpessoa
Hero Member
Posts: 2330
Re: LAMW how to request special overlay permission
«
Reply #2 on:
August 18, 2020, 07:38:56 pm »
Quote
I have to set the overlay permision manually.
How?
Logged
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard
Segator
Full Member
Posts: 168
Re: LAMW how to request special overlay permission
«
Reply #3 on:
August 18, 2020, 07:43:06 pm »
Quote from: jmpessoa on August 18, 2020, 07:38:56 pm
Quote
I have to set the overlay permision manually.
How?
in the phone general settings permision, because this
Code: Pascal
[Select]
[+]
[-]
if
IsRuntimePermissionsNeed
(
)
then
begin
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.
Logged
i am Reinier, Nenirey and Segator
https://github.com/Nenirey
Segator
Full Member
Posts: 168
Re: LAMW how to request special overlay permission
«
Reply #4 on:
August 18, 2020, 07:54:08 pm »
I found this
Code: Pascal
[Select]
[+]
[-]
@
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]
[+]
[-]
jIntentManager1
.
SetAction
(
'Settings.ACTION_MANAGE_OVERLAY_PERMISSION'
)
;
jIntentManager1
.
SetDataUriAsString
(
'package: '
+
gapp
.
PackageName
)
;
jIntentManager1
.
StartActivityForResult
(
1001
)
;
but nothing is happend.
Logged
i am Reinier, Nenirey and Segator
https://github.com/Nenirey
Segator
Full Member
Posts: 168
Re: LAMW how to request special overlay permission
«
Reply #5 on:
August 19, 2020, 04:09:59 pm »
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.
Logged
i am Reinier, Nenirey and Segator
https://github.com/Nenirey
Segator
Full Member
Posts: 168
Re: LAMW how to request special overlay permission
«
Reply #6 on:
August 19, 2020, 06:32:04 pm »
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
Logged
i am Reinier, Nenirey and Segator
https://github.com/Nenirey
Segator
Full Member
Posts: 168
Re: LAMW how to request special overlay permission
«
Reply #7 on:
August 21, 2020, 06:24:15 pm »
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]
[+]
[-]
jIntentManager1
.
SetAction
(
iaManageOverlayPermission
)
;
jIntentManager1
.
SetDataUriAsString
(
'package:'
+
gapp
.
PackageName
)
;
jIntentManager1
.
StartActivityForResult
(
1006
)
;
but for now i can't know if the permission is granted or not.
Logged
i am Reinier, Nenirey and Segator
https://github.com/Nenirey
jmpessoa
Hero Member
Posts: 2330
Re: LAMW how to request special overlay permission [SOLVED]
«
Reply #8 on:
August 21, 2020, 07:47:32 pm »
You can try handle event the "OnActivityResult" from jForm...
Logged
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard
Segator
Full Member
Posts: 168
Re: LAMW how to request special overlay permission [SOLVED]
«
Reply #9 on:
August 21, 2020, 08:20:45 pm »
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]
[+]
[-]
if
resultCode
=
RESULT_OK
then
ShowMessage
(
'done'
)
;
the toast never prompt
«
Last Edit: August 21, 2020, 08:26:25 pm by Segator
»
Logged
i am Reinier, Nenirey and Segator
https://github.com/Nenirey
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Operating Systems
»
Android
»
LAMW how to request special overlay permission [SOLVED]
TinyPortal
© 2005-2018