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
FpDebug questions
by
440bx
[
Today
at 03:43:41 am]
Lazarus for Windows on aa...
by
Wallaby
[April 23, 2024, 11:46:56 pm]
Parameter passing odditie...
by
KodeZwerg
[April 23, 2024, 11:04:39 pm]
Can function be used for ...
by
jamie
[April 23, 2024, 10:53:10 pm]
(Solved) TIndexedAVLTree ...
by
lainz
[April 23, 2024, 10:49:03 pm]
Demo Scene Picture sinwav...
by
KodeZwerg
[April 23, 2024, 10:26:21 pm]
fkInternalCalc
by
zraja
[April 23, 2024, 09:31:07 pm]
A fairly simple sound sol...
by
KodeZwerg
[April 23, 2024, 09:23:37 pm]
add new targets to make
by
marcov
[April 23, 2024, 08:38:42 pm]
how to tweek fpmake to co...
by
marcov
[April 23, 2024, 08:29:16 pm]
Quirky windows
by
ASerge
[April 23, 2024, 07:07:16 pm]
[Request] Demo Scene Sub ...
by
Gigatron
[April 23, 2024, 06:29:39 pm]
Unlocking Files
by
KodeZwerg
[April 23, 2024, 06:03:08 pm]
[SOLVED] trunk bug for mi...
by
Key-Real
[April 23, 2024, 05:56:32 pm]
Demo Scene Bitmap Font Sc...
by
Gigatron
[April 23, 2024, 05:56:27 pm]
Compile/Convert Delphi pr...
by
Martin_fr
[April 23, 2024, 05:43:11 pm]
Generics - correct syntax
by
Thaddy
[April 23, 2024, 05:40:59 pm]
InstallAware Using Lazaru...
by
msintle
[April 23, 2024, 05:26:36 pm]
Xcode Command Line Tools ...
by
Joseph
[April 23, 2024, 05:16:39 pm]
Offical launch of the 1 B...
by
Hartmut
[April 23, 2024, 04:49:29 pm]
what to do if my target M...
by
nickysn
[April 23, 2024, 04:16:02 pm]
compiler error in unit
by
paule32
[April 23, 2024, 03:49:50 pm]
Multithreading - synchron...
by
mika
[April 23, 2024, 01:48:51 pm]
May be useful to somebody
by
KodeZwerg
[April 23, 2024, 12:38:22 pm]
match automatic highlight...
by
Чебурашка
[April 23, 2024, 11:35:14 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Android LAMW Share File (Read 3459 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: 2302
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: 2302
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: 2302
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: 2302
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