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
Database standards OR Am ...
by
paweld
[
Today
at 07:21:12 am]
Big Numbers Math
by
iLya2IK
[
Today
at 07:13:20 am]
Lazarus for Windows on aa...
by
dbannon
[
Today
at 07:02:55 am]
BUG REPORT: Unable to gen...
by
dbannon
[
Today
at 06:29:49 am]
Offical launch of the 1 B...
by
Gustavo 'Gus' Carreno
[
Today
at 12:50:46 am]
what to do if my target M...
by
Laksen
[
Today
at 12:49:12 am]
For-in loop over constant...
by
ASerge
[
Today
at 12:36:09 am]
Converting a string/index...
by
TRon
[April 18, 2024, 11:56:37 pm]
exclude ALL packages from...
by
PascalDragon
[April 18, 2024, 11:33:29 pm]
Demoscene The Champs Crac...
by
KodeZwerg
[April 18, 2024, 11:29:50 pm]
Poll: Watches and Display...
by
440bx
[April 18, 2024, 10:55:14 pm]
How to: create DLL file f...
by
paule32
[April 18, 2024, 10:23:59 pm]
Have anyone develop UEFI ...
by
PascalDragon
[April 18, 2024, 10:14:15 pm]
The weird Rewrite bug
by
PascalDragon
[April 18, 2024, 09:58:53 pm]
Assign (textfile) not com...
by
PascalDragon
[April 18, 2024, 09:51:50 pm]
Question for people who h...
by
PascalDragon
[April 18, 2024, 09:44:32 pm]
Linux Workspaces -- StayO...
by
AmatCoder
[April 18, 2024, 08:34:20 pm]
I just released a commerc...
by
Seenkao
[April 18, 2024, 07:57:21 pm]
Access violation when re-...
by
TRon
[April 18, 2024, 07:37:31 pm]
[SOLVED] assembler name i...
by
TRon
[April 18, 2024, 07:26:33 pm]
A fairly simple sound sol...
by
KodeZwerg
[April 18, 2024, 07:01:52 pm]
Step-into the field sette...
by
Martin_fr
[April 18, 2024, 06:54:19 pm]
[Fun Fact] PNG and Micros...
by
Ten_Mile_Hike
[April 18, 2024, 06:24:19 pm]
HTTP/2+HTTP/1.1+WebSocket...
by
iLya2IK
[April 18, 2024, 06:14:30 pm]
Improvement of TFPTimerTh...
by
AlexTP
[April 18, 2024, 05:56:38 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Android LAMW Share File (Read 3451 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: 2301
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: 2301
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: 2301
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: 2301
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