Recent

Author Topic: Help on lamw components  (Read 737 times)

ramsetev

  • Newbie
  • Posts: 3
Help on lamw components
« on: September 13, 2021, 05:37:59 pm »
Hi, I am new to this forum, I am pleased to find that it is possible to develop android apps using the beloved Pascal. I met him about 30 years ago with the TurboPascal, and then continued a bit in Delphi. Now I'm curious to try in Lazarus and especially with the possibility of developing android apps. Here is my question for you: I have a small problem with the jcOpenMapView component: I do not get a rendering of the map but only a gray grid. Maybe it doesn't work anymore?

jmpessoa

  • Hero Member
  • *****
  • Posts: 1917
Re: Help on lamw components
« Reply #1 on: September 13, 2021, 07:38:41 pm »

Hi,  ramsetev!

Welcome!

What about "demos":

 "AppJCenterOpenStreetMapDemo1"  and "AppJCenterOpenStreetMapDemo2"  ??

Its [yet] works?
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

loaded

  • Sr. Member
  • ****
  • Posts: 257
Re: Help on lamw components
« Reply #2 on: September 14, 2021, 07:00:05 pm »
"AppJCenterOpenStreetMapDemo1"  and "AppJCenterOpenStreetMapDemo2"  ??

Its [yet] works?


Master jmpessoa, I tested it voluntarily, they work fine :)

Installing the spelling, google translate is used :)

ramsetev

  • Newbie
  • Posts: 3
Re: Help on lamw components
« Reply #3 on: September 15, 2021, 09:14:09 am »
Yes, it works fine, I didn't ask for writing permission, my apologies and thanks for the support. Where can I find some explanation on
  the "request code" for the RequestRuntimePermission procedure? And a demo fo JLocation component? Many Thanks
« Last Edit: September 15, 2021, 09:59:48 am by ramsetev »

loaded

  • Sr. Member
  • ****
  • Posts: 257
Re: Help on lamw components
« Reply #4 on: September 15, 2021, 09:09:04 pm »
Firstly;
Regarding RequestRuntimePermission, I think the following code contains the necessary explanation. You can also examine the web page about what is happening on the Android side. ​https://developer.android.com/guide/topics/security/permissions#normal-dangerous
Code: Pascal  [Select][+][-]
  1. ...
  2.    ​//https://developer.android.com/guide/topics/security/permissions#normal-dangerous
  3.  ​if IsRuntimePermissionNeed() then   // that is, target API >= 23
  4.  ​begin
  5.     ​ShowMessage('RequestRuntimePermission....');
  6.     ​Self.RequestRuntimePermission('android.permission.ACCESS_FINE_LOCATION', 1003); //from AndroodManifest.xml
  7.  ​end;
  8. ....
  9.  
  10. procedure TAndroidModule1.AndroidModule1RequestPermissionResult(
  11.  ​Sender: TObject; requestCode: integer; manifestPermission: string;
  12.  ​grantResult: TManifestPermissionResult);
  13. begin
  14.    ​case requestCode of
  15.     ​1003:begin   //android.permission.ACCESS_FINE_LOCATION
  16.               ​if grantResult = PERMISSION_GRANTED  then
  17.               ​begin
  18.                   ​ShowMessage(manifestPermission + ' :: Success! Permission grant!!! ' )
  19.               ​end
  20.               ​else  //PERMISSION_DENIED
  21.                 ​ShowMessage(manifestPermission + '   :: Sorry... permission not grant... ' )
  22.           ​end;
  23.  ​end;
  24. end;
  25.  

Demo examples about JLocation;
You can find it as ............\lazandroidmodulewizard-master\demos\GUI\AppLocationDemo1  and AppLocationDemo2

However, you must have a Google Developer Account to Run this example. then you should get a Google API Key that includes support for Geolocation and Maps Static, and then activate billing.
If I am wrong, I will be glad if the masters correct me. Respects.
Installing the spelling, google translate is used :)

ramsetev

  • Newbie
  • Posts: 3
Re: Help on lamw components
« Reply #5 on: September 17, 2021, 04:11:30 pm »
no way to use gps or coarse location?

jmpessoa

  • Hero Member
  • *****
  • Posts: 1917
Re: Help on lamw components
« Reply #6 on: September 17, 2021, 07:27:58 pm »
Quote
no way to use gps or coarse location?

Where?
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

 

TinyPortal © 2005-2018