Question for jwebview
lazarus / 43-Android
----------------------------------------------------------------------
magleft · 2022-03-20 12:42
Hello.
In my App i want to display points in a map. I tried to do it through
jwebview but it requires googlemapsapi .
How could I display the points through jwebview.
Could the app search for free googlemapsapi? Could I use another way?
----------------------------------------------------------------------
Michael Collier · 2022-03-20 13:52
Hi,
I use leafletjs in my HTML/Javascript applications
See if you can can open this URL with jWebView and see a demo map with
marker
https://leafletjs.com/SlavaUkraini/examples/quick-start/example.html
You would need to use javascript in your webpage to add markers to a
map
----------------------------------------------------------------------
jmpessoa · 2022-03-20 17:04
Alternatively, you can try "jcOpenMapView" component....
and demo "AppJCenterOpenStreetMapDemo1"
----------------------------------------------------------------------
magleft · 2022-03-20 17:34
Thank you so much for your answers.
As far as Leaflet is concerned, the link normally opens through
jwebview.
The openstreetmap not work.
Messages, Hints: 2
Verbose: Selected chip architecture: armeabi-v7a
Verbose: Taking libraries from folder: c:\adt32\eclipse\workspace\AppJ
CenterOpenStreetMapDemo2\libs\armeabi-v7a
Verbose: Found library: libcontrols.so
Note: Duplicate unit "controls" in "controls", orphaned ppu "c:\adt32\
eclipse\workspace\AppJCenterOpenStreetMapDemo2\obj\controls\controls.o
"
Note: Duplicate unit "controls" in "LCLBase 2.0.0.4",
ppu="c:\laztoapk\downloads\laz4android2.0.0\lcl\units\arm-
android\controls.ppu",
source="c:\laztoapk\downloads\laz4android2.0.0\lcl\controls.pp"
Compile Project, OS: android, CPU: arm, Target: c:\adt32\eclipse\works
pace\AppJCenterOpenStreetMapDemo2\libs\armeabi-v7a\libcontrols.so:
Success
Building APK (Gradle)... : FAILURE: Build failed with an exception.,
Errors: 3
Error: C:\adt32\eclipse\workspace\AppJCenterOpenStreetMapDemo2\src\org
\lamw\appjcenteropenstreetmapdemo2\Controls.java:1671: error: cannot
find symbol
Error: C:\adt32\eclipse\workspace\AppJCenterOpenStreetMapDemo2\src\org
\lamw\appjcenteropenstreetmapdemo2\Controls.java:1693: error: cannot
find symbol
Fatal: FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug
option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it
incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10/userguide/command_line_interface.html
#sec:command_line_warnings
BUILD FAILED in 28s
16 actionable tasks: 15 executed, 1 up-to-date
AAPT2 aapt2-3.2.1-4818971-windows Daemon #0: shutdown
AAPT2 aapt2-3.2.1-4818971-windows Daemon #1: shutdown
AAPT2 aapt2-3.2.1-4818971-windows Daemon #2: shutdown
Exception, Errors: 1
Fatal: [Exception] Failed: Cannot build APK!
My problem is that I want to use the application on areas that are far
from roads. So i prefare to use a hybrid or satelite map.
----------------------------------------------------------------------
magleft · 2022-03-28 07:37
Michael Collier
could you give me an example of how I could use the leaflet through
the application?
Do I have to create the map I want out of the application and if so
how?
Thanks
----------------------------------------------------------------------
Michael Collier · 2022-03-28 11:28
Hi Magleft
To setup a map in leafletjs you would use HTML & Javascript.
You then point your jwebview component to the URL of your HTML page.
This is the source for the example page I posted earlier, if you save
it locally in an HTML file and open in Chrome browser you will see a
map. I'm guessing it will work for jwebview too, if it doesn't, then
try saving the file to a server rather than opening locally.
Code: Javascript [Select][+][-]window.onload = function(){var x1 =
document.getElementById("main_content_section"); if (x1) { var x =
document.getElementsByClassName("geshi");for (var i = 0; i
Quick Start -
Leaflet
But as jmpessoa says, there is a map demo already built that you can
use, it works for me, and may give you more control from the
application side of things (i.e. by changing longitude & latitude
programmatically).
----------------------------------------------------------------------
magleft · 2022-03-28 14:40
Thanks for the prompt reply. My problem is that every time I tried to
compile jmpessoa's AppJCenterOpenStreetMapDemo1 I could not. What am I
doing wrong; I guess it has to do with Grandle. Do I need to do some
customization? Here is the message I receive.
Messages
Verbose: Selected chip architecture: armeabi-v7a
Verbose: Taking libraries from folder: c:\adt32\eclipse\workspace\AppJ
CenterOpenStreetMapDemo1\libs\armeabi-v7a
Compile Project, OS: android, CPU: arm, Target: c:\adt32\eclipse\works
pace\AppJCenterOpenStreetMapDemo1\libs\armeabi-v7a\libcontrols.so:
Success, Hints: 3
unit1.pas(39,32) Hint: Parameter "roadDuration" not used
unit1.pas(40,39) Hint: Parameter "outWidth" not used
unit1.pas(28,29) Hint: Parameter "manifestPermission" not used
Building APK (Gradle)... : FAILURE: Build failed with an exception.,
Errors: 1
Fatal: FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project
'AppJCenterOpenStreetMapDemo1'.
> Failed to install the following Android SDK packages as some
licences have not been accepted.
platforms;android-29 Android SDK Platform 29
To build this project, accept the SDK license agreements and install
the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one
workstation to another, see http://d.android.com/r/studio-ui/export-
licenses.html
Using Android SDK: c:\laztoapk\downloads\android-sdk-windows
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug
option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it
incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10/userguide/command_line_interface.html
#sec:command_line_warnings
BUILD FAILED in 23s
Exception, Errors: 1
Fatal: [Exception] Failed: Cannot build APK!
----------------------------------------------------------------------
Michael Collier · 2022-03-28 15:11
To get the samples working on my machine I changed the Project
Options, but my settings might not work for you. Here they are
though..
For
Project Options-> [LAMW] Android Project Options
I select
Build->Apk Builder->Gradle
and
Chipset->ARMv7a+VFPv3
But I have Android Studio installed on this machine too and I see it
uses Gradle so maybe I have more files installed than you have,
jmpessoa would probably be best person to answer.
I can help by sending you links to pre-compiled APK files for your
Android phone if it helps, at least you can try the demo?
----------------------------------------------------------------------
magleft · 2022-03-28 15:56
Unfortunately with settings
Build->Apk Builder->Gradle
and
Chipset->ARMv7a+VFPv3
it did not work.
Jmpessoa i would like if you can help.
The settings on my laztoApk are:
Current Settings
Android SDK Path: c: \ laztoapk \ downloads \ android-sdk-windows \
Android NDK Path: c: \ laztoapk \ downloads \ android-ndk-r17c \
Java JDK Path: C: \ Program Files (x86) \ Java \ jdk1.8.0_301 \
Build tool: c: \ laztoapk \ downloads \ laz4android2.0.0 \
lazbuild.exe
Apache-Ant Path: c: \ laztoapk \ downloads \ apache-ant-1.10.3 \ bin \
Gradle Path: C: \ laztoapk \ downloads \ gradle-4.10 \
The error message:
Messages, Hints: 2
Verbose: Selected chip architecture: armeabi-v7a
Verbose: Taking libraries from folder: c: \ adt32 \ eclipse \
workspace \ ElgaApp \ libs \ armeabi-v7a
Verbose: Found library: libcontrols.so
Note: Duplicate unit "controls" in "controls", orphaned ppu "c: \
adt32 \ eclipse \ workspace \ ElgaApp \ obj \ controls \ controls.o"
Note: Duplicate unit "controls" in "LCLBase 2.0.0.4", ppu = "c: \
laztoapk \ downloads \ laz4android2.0.0 \ lcl \ units \ arm-android \
controls.ppu", source = "c: \ laztoapk \ downloads \ laz4android2.0.0
\ lcl \ controls.pp "
Compile Project, OS: android, CPU: arm, Target: c: \ adt32 \ eclipse \
workspace \ ElgaApp \ libs \ armeabi-v7a \ libcontrols.so: Exit code
1, Errors: 1
Fatal: Cannot find system used by controls. Make sure all ppu files of
a package are in its output directory. ppu in wrong directory = C: \
laztoapk \ downloads \ laz4android2.0.0 \ fpc \ 3.0.4 \ units \ arm-
android \ rtl \ system.ppu ..
Exception, Errors: 1
Fatal: [Exception] Failed: Cannot build project
----------------------------------------------------------------------
dseligo · 2022-03-28 21:11
Quote from: magleft on March 28, 2022, 04:40:07 pmTo build this
project, accept the SDK license agreements and install the missing
components using the Android Studio SDK Manager.
I think this is the error message you should concentrate first. I had
same error, I think it was because I had double installation of SDK -
one from LAMW and one from Android Studio. Check if something like
this is in your case. And when you are asked to accept licence
agreements in SDK manager you should accept them.
----------------------------------------------------------------------
magleft · 2022-03-31 14:03
Thank you all for your help.
After reinstalling the sdk everything worked.