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
IRC channel
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
android
by
Thaddy
[
Today
at 06:10:08 am]
Initiaiizing records by c...
by
Thaddy
[
Today
at 05:41:49 am]
Hypocycloid Program (incl...
by
speter
[
Today
at 05:33:19 am]
Fairtris 2: The Ultimate ...
by
kevin498
[
Today
at 05:09:44 am]
Here's some Pong game. Su...
by
Seenkao
[
Today
at 04:28:13 am]
Designer
by
SandyG
[
Today
at 03:20:24 am]
A question on Modula2 vs ...
by
speter
[
Today
at 03:09:19 am]
Best way to exchange data...
by
cdbc
[
Today
at 03:00:24 am]
lamw
by
desconocido
[
Today
at 12:58:09 am]
scanline example
by
speter
[
Today
at 12:12:12 am]
Pack
by
domasz
[March 18, 2024, 10:24:35 pm]
IsManagedType problem, do...
by
PascalDragon
[March 18, 2024, 10:05:44 pm]
Conflict when static link...
by
tetrastes
[March 18, 2024, 10:05:28 pm]
Indeed TCustomApplication...
by
PascalDragon
[March 18, 2024, 10:00:49 pm]
"fpc.cfg is missing" (not...
by
AxBen
[March 18, 2024, 09:50:52 pm]
Interesting discovery wit...
by
wp
[March 18, 2024, 09:11:23 pm]
Use Lazarus 3.2 with FPC ...
by
AxBen
[March 18, 2024, 08:56:42 pm]
More Normal Mode for Laza...
by
RayoGlauco
[March 18, 2024, 08:55:53 pm]
How to make a watermarked...
by
loaded
[March 18, 2024, 08:37:24 pm]
Introducing a "using" key...
by
VisualLab
[March 18, 2024, 08:26:22 pm]
Code completion items
by
Martin_fr
[March 18, 2024, 08:26:17 pm]
Poll: Watches and Display...
by
Martin_fr
[March 18, 2024, 07:36:59 pm]
[Solved] Help with sql
by
Zvoni
[March 18, 2024, 05:46:32 pm]
TBGRABitmap.TextSize retu...
by
circular
[March 18, 2024, 04:40:11 pm]
Еличка - a simple calcula...
by
gidesa
[March 18, 2024, 04:16:43 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: LAMW how to request special overlay permission [SOLVED] (Read 2116 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: 2296
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: 2296
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