Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Miscellaneous
»
Other
»
Android LAMW Share File
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
A "leisure" question on W...
by
gidesa
[
Today
at 03:17:10 pm]
Curling Pythagoras Tree: ...
by
AlexTP
[
Today
at 03:07:53 pm]
Project fails on run but ...
by
Martin_fr
[
Today
at 02:52:09 pm]
[SOLVED] Combined pointer...
by
CM630
[
Today
at 02:48:41 pm]
Complex package installat...
by
JonBondy
[
Today
at 02:46:19 pm]
Controlling the behavior ...
by
rvk
[
Today
at 02:35:41 pm]
Using KeyPress event, how...
by
Zvoni
[
Today
at 02:24:42 pm]
a Unit problem?
by
Thaddy
[
Today
at 01:56:12 pm]
Understanding and adjusti...
by
ArchChem
[
Today
at 12:58:12 pm]
Any upgrades to fpWeb pag...
by
marcov
[
Today
at 12:50:25 pm]
Help needed with Cairo / ...
by
Roland57
[
Today
at 12:25:16 pm]
JEDI error but unit compi...
by
Roland57
[
Today
at 11:50:11 am]
Configure JCF messages
by
DomingoGP
[
Today
at 11:26:55 am]
IDE instability on Raspbe...
by
rvk
[
Today
at 10:37:14 am]
Boleeman's projects are p...
by
AlexTP
[
Today
at 10:18:04 am]
Your best UI design - con...
by
circular
[
Today
at 09:36:11 am]
ZeosDBO and querys using ...
by
Zvoni
[
Today
at 09:27:17 am]
STARS with line border st...
by
Boleeman
[
Today
at 09:13:29 am]
Zeos components. Had to c...
by
dbannon
[
Today
at 07:26:11 am]
A button require administ...
by
Fibonacci
[
Today
at 05:57:21 am]
How to detect one externa...
by
d2010
[
Today
at 12:24:32 am]
Center Lost Window featur...
by
Tony Stone
[
Today
at 12:06:16 am]
need advice about the fol...
by
jamie
[March 27, 2024, 09:56:39 pm]
[SOLVED] Completion box s...
by
Martin_fr
[March 27, 2024, 08:44:09 pm]
Dialog ShowModal and an i...
by
d7_2_laz
[March 27, 2024, 08:25:18 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Android LAMW Share File (Read 3428 times)
Odanka
New Member
Posts: 40
Android LAMW Share File
«
on:
December 19, 2018, 05:00:06 am »
LAMW share file by jShareFile or jIntentManger, everything is fine and work properly in android < 5.0 (lolypop) but problem occur on android > 7 (nougat).
Anyone Please..
Thank you.
Logged
jmpessoa
Hero Member
Posts: 2297
Re: Android LAMW Share File
«
Reply #1 on:
December 19, 2018, 06:48:28 am »
Hi Odanka!
The "AppCameraDemo" show how to handle "run time permission" [read/write and others] ...
PS. Please, write in "Android" forum entry...
«
Last Edit: December 19, 2018, 06:52:14 am by jmpessoa
»
Logged
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard
Odanka
New Member
Posts: 40
Re: Android LAMW Share File
«
Reply #2 on:
December 19, 2018, 07:20:43 am »
JNI prompt taken from CameraDemo (Runtime Permission)
Code: Pascal
[Select]
[+]
[-]
// Permission
if
IsRuntimePermissionNeed
(
)
then
// that is, target API >= 23
begin
ShowMessage
(
'warning: Requesting Runtime Permission.... please, wait..'
)
;
SetLength
(
manifestPermissions
,
2
)
;
manifestPermissions
[
0
]
:
=
'android.permission.CAMERA'
;
//from AndroodManifest.xml
manifestPermissions
[
1
]
:
=
'android.permission.WRITE_EXTERNAL_STORAGE'
;
//from AndroodManifest.xml
RequestRuntimePermission
(
manifestPermissions
,
1001
)
;
SetLength
(
manifestPermissions
,
0
)
;
end
;
OnPermissionResult:
Code: Pascal
[Select]
[+]
[-]
case
requestCode
of
1001
:
begin
if
grantResult
=
PERMISSION_GRANTED
then
ShowMessage
(
'Success! ['
+
manifestPermission
+
'] Permission grant!!! '
)
else
//PERMISSION_DENIED
ShowMessage
(
'Sorry... ['
+
manifestPermission
+
'] Permission not grant... '
)
;
end
;
end
;
Sharing Action :
Code: Pascal
[Select]
[+]
[-]
jIntentManagers
.
SetAction
(
'android.intent.action.SEND'
)
;
jIntentManagers
.
SetMimeType
(
'image/png'
)
;
jIntentManagers
.
PutExtraFile
(
GetEnvironmentDirectoryPath
(
dirDownloads
)
,
'estimasi.png'
)
;
if
jIntentManagers
.
IsCallable
(
jIntentManagers
.
GetIntent
(
)
)
then
jIntentManagers
.
StartActivity
(
)
else
ShowMessage
(
'No Activity found to handle Intent'
)
;
Please help me, do not work on android 7+ (nougat).
Logged
Odanka
New Member
Posts: 40
Re: Android LAMW Share File
«
Reply #3 on:
December 19, 2018, 07:24:53 am »
Once Again, I'm sorry for miss place.
Logged
jmpessoa
Hero Member
Posts: 2297
Re: Android LAMW Share File
«
Reply #4 on:
December 19, 2018, 07:33:52 am »
Yes, but you need to adapt the example code.....
[you dont need camera permission! Only read/write]
Logged
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard
Odanka
New Member
Posts: 40
Re: Android LAMW Share File
«
Reply #5 on:
December 19, 2018, 07:50:50 am »
I'm still learning. Did you mean code to adapt as bellow?
Code: Pascal
[Select]
[+]
[-]
procedure
TAndroidModule1
.
AndroidModule1ActivityResult
(
Sender
:
TObject
;
requestCode
:
integer
;
resultCode
:
TAndroidResult
;
intentData
:
jObject
)
;
begin
if
resultCode
=
RESULT_CANCELED
then
begin
ShowMessage
(
'Photo Canceled!'
)
end
else
if
resultCode
=
RESULT_OK
then
//ok...
begin
if
requestCode
=
jCamera1
.
RequestCode
then
begin
jBitmap1
.
LoadFromFile
(
jCamera1
.
FullPathToBitmapFile
)
;
jImageView1
.
SetImageBitmap
(
jBitmap1
.
GetImage
,
jImageView1
.
Width
,
jImageView1
.
Height
)
;
FPhotoExist
:
=
True
;
jView1
.
Refresh
;
//dispatch OnDraw!
end
;
end
else
ShowMessage
(
'Photo Fail!'
)
;
end
;
Logged
jmpessoa
Hero Member
Posts: 2297
Re: Android LAMW Share File
«
Reply #6 on:
December 19, 2018, 08:18:49 am »
Wait. I'll update the demo "AppShareFileDemo1" today....
Logged
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard
Odanka
New Member
Posts: 40
Re: Android LAMW Share File
«
Reply #7 on:
December 19, 2018, 08:22:24 am »
I'm waiting, and Thank you very-very much.
Logged
jmpessoa
Hero Member
Posts: 2297
Re: Android LAMW Share File
«
Reply #8 on:
December 20, 2018, 05:50:58 am »
Done !!!
Added "run time permission" to "AppShareFileDemo1"
need by Android 6.0+ [target Api 23+]
Thank you!
«
Last Edit: December 20, 2018, 05:55:09 am by jmpessoa
»
Logged
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard
Odanka
New Member
Posts: 40
Re: Android LAMW Share File
«
Reply #9 on:
December 20, 2018, 08:22:50 am »
Done!!! and work properly.
Very-very Thank you JMPESSOA.
«
Last Edit: December 20, 2018, 08:30:49 am by Odanka
»
Logged
Odanka
New Member
Posts: 40
Re: Android LAMW Share File
«
Reply #10 on:
December 20, 2018, 08:26:04 am »
And I'm finding the answers my self of why 5001 in RequestRunTimePermission.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Miscellaneous
»
Other
»
Android LAMW Share File
TinyPortal
© 2005-2018