B4J Question [ ABMaterial ] I've been trying to run my ABMateral-Project on the new IDE 9.80

johnerikson

Active Member
Licensed User
Longtime User
I have updated ABMaterial to 5.0

A helper feature doesn't seem to work
Dim GameViewHelper As GameViewHelper causes a crash. It was possible to compile but the application did not start.
Microsoft Office Translator
I have resolved this issue by removing this feature, pending further updates.

Googlemap map features doesn't work.
The program stops after a call to my own js-script function. The instructions for the update ask you to clean up the js folder. I own script functions under that folder, but they are restored under js.

I read that there had been no time to update Demon 4.51. That's more, I guess.
 

alwaysbusy

Expert
Licensed User
Longtime User
What is GameViewHelper? This has nothing to do with ABM so the cause of your error is something else.

Googlemap map features doesn't work.
The program stops after a call to my own js-script function.
What error? What is in your own JavaScript? How does your B4J code look like? What do you see in the logs (both B4J + Browser)?

Not enough information to give any answer. ABM 5.0 runs on our systems in production for over a year without any issues.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

johnerikson

Active Member
Licensed User
Longtime User
Many thanks!

GameViewHelper

Dim GameViewHelper As GameViewHelper
BuildPlayList(sDir,sFile, False, i, 0, sStat)
GameViewHelper.StopAudioClip(iGenId)'
GameViewHelper.PlayAudioClip(iGenId,
tmpPlay.bIsPlaying = True
GameViewHelper.StopAudioClip(iGenId)

received a package of help program and utilities from you Alain, among other things this,
which I downloaded from your website. I use it to view videos

The compilation shows no error but following happens when the application starts:

Waiting for debugger to connect...
Program started.
Error occurred on line: 27 (EasyImageslider)
Rad 27 = Dim GameViewHelper As GameViewHelper
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at GISIQON.EasyMedia.easyimageslider.innerInitialize(easyimageslider.java:21)
at GISIQON.EasyMedia.easyimageslider._initialize(easyimageslider.java:107)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:629)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:109)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:96)
at GISIQON.EasyMedia.main.main(main.java:29)
Caused by: java.lang.NoClassDefFoundError: javafx/scene/transform/Transform
at GISIQON.EasyMedia.easyimageslider._class_globals(easyimageslider.java:460)
... 21 more


Googlemap

I will return later with explanations about map functions
 
Upvote 0

johnerikson

Active Member
Licensed User
Longtime User
Thank you for drawing attention to my problems.
I misremembered that GameViewHelper came from ABMaterial. So, I'll have to research further!

The problem with Google map is that it does not initialize at all

B4X:
' create the google map
Dim gm1 As ABMGoogleMap
Dim x, y As Double
x = jDBUtils.GetDefsUsr(PG_UserID, "LASTPOSX")
y = jDBUtils.GetDefsUsr(PG_UserID, "LASTPOSY")
If x = 0 Or y = 0 Then
              x = 64.5: y = 18.7
              jDBUtils.PutDefsusr (PG_UserID, "LASTPOSX", x)
              jDBUtils.PutDefsusr (PG_UserID, "LASTPOSY", y)
              jDBUtils.PutDefsusr (PG_UserID, "LASTZOOM", 8)
End If
'Log(x & " " & y)
gm1.Initialize( page, "gm1", x, y, 10, 750, ABM.GOOGLEMAPTYPE_ROADMAP, 0)
gm1.Draggable = True
gm1.HasMapTypeControl = True 
gm1.HasStreetViewControl = True
gm1.HasZoomControl = True
gm1.AddMapType(ABM.GOOGLEMAPTYPE_ROADMAP)
gm1.AddMapType(ABM.GOOGLEMAPTYPE_TERRAIN)
gm1.AddMapType(ABM.GOOGLEMAPTYPE_HYBRID)
gm1.AddMapType(ABM.GOOGLEMAPTYPE_SATELLITE)

page.Refresh ' IMPORTANT
page.FinishedLoading 'IMPORTANT

The map does not initialize, no map on screen!
This has worked so far for many years until updating to 9.80, nothing is changed.

I mentioned that the custom JavaScript functions did not work, but they may be because the google map is not initialized.

After updating the ABMaterial library to 5.00, a parameter for ABMGoogleMap.addmarker was added, namely poliginids As List.
What does this mean?
 
Last edited:
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
Overwrite the gmaps.4.70.min.js file in the www/js folder with this one. There was an error in the javascript file.

ABMGoogleMap.addmarker
Just pass an empty Array for the moment: Array()

I kind of remember it was some request from someone for clicking on polygons but I will have to look it up in the source code to be sure.

Quick tip: always check the logs in the browser too. If we had that one we could've had identified that the problem was in the javascript file a lot faster.
 

Attachments

  • gmaps.4.70.min.zip
    10.5 KB · Views: 146
Upvote 0

johnerikson

Active Member
Licensed User
Longtime User
Thanks a lot!

I have overwrite the gmaps.4.70.min.js file but no map on screen!

Log from the browser (Chrome)

GET http://localhost:54021/js/sessioncreator.js net::ERR_ABORTED 404 (Not Found)
js?key=AIzaSyCtyeajFj1oPi02SgZXOj1Wg9pdxvo08hk:217

Google Maps JavaScript API has been loaded directly without a callback.
This is not supported and can lead to race conditions and suboptimal performance.
For supported loading patterns please see https://goo.gle/js-api-loading
qea @ js?key=AIzaSyCtyeajFj1oPi02SgZXOj1Wg9pdxvo08hk:217
google.maps.Load @ js?key=AIzaSyCtyeajFj1oPi02SgZXOj1Wg9pdxvo08hk:14
(anonymous) @ js?key=AIzaSyCtyeajFj1oPi02SgZXOj1Wg9pdxvo08hk:340
(anonymous) @ js?key=AIzaSyCtyeajFj1oPi02SgZXOj1Wg9pdxvo08hk:340
gmaps.4.70.min.js:277

Uncaught SyntaxError: Unexpected token ')' (at gmaps.4.70.min.js:277:5)
manifest.json:1


GET http://localhost:54021/easymedia/images/manifest.json 404 (Not Found)
 
Upvote 0

johnerikson

Active Member
Licensed User
Longtime User
Thanks!

How should I find that parenthesis in gmaps.4.70.min.js. The number 277 is probably a variable in the scripts, it is about 10 of double brackets??
 
Upvote 0

johnerikson

Active Member
Licensed User
Longtime User
However I try to change by removing ) or }, I only get new errors.

Ex.
Failed to load resource: the server responded with a status of 404 (Not Found)
js?key=AIzaSyCtyeajFj1oPi02SgZXOj1Wg9pdxvo08hk:217
Google Maps JavaScript API has been loaded directly without a callback. This is not supported and can lead to race conditions and suboptimal performance. For supported loading patterns please see



What should be removed?

This is the original

271 //i(e, t)
if (typeof i != "undefined")
i(e,t);
}), function(e,t) {
if (typeof i2 != "undefined")
i2(e,t);
277 };
}), l
}, l.prototype.addMarker = function(e) {
var t;
if (e.hasOwnProperty("gm_accessors_")) t = e;
282 else {
 
Upvote 0

johnerikson

Active Member
Licensed User
Longtime User
Sorry, I get another error from browser log
Perhaps something wrong with the Google map API-key, but I have one laptop as I run with IDE 9.30 without problem.
I check it!


sessioncreator.js:1

Failed to load resource: the server responded with a status of 404 (Not Found)
js?key=AIzaSyCtyeajF…Oj1Wg9pdxvo08hk:217

Google Maps JavaScript API has been loaded directly without a callback. This is not supported and can lead to race conditions and suboptimal performance. For supported loading patterns please see gmaps.4.70.min.js:235
Uncaught SyntaxError: Unexpected number
manifest.json:1
Failed to load resource: the server responded with a status of 404 (Not Found)
manifest.json:1
Manifest: Line: 1, column: 1,
 
Upvote 0

johnerikson

Active Member
Licensed User
Longtime User
Maybe I was misunderstood with that last message.
What I meant was that the key is OK approved by Google Map.
The problem with gmaps.4.70.min.js is still there:

Browser log:
Failed to load resource: the server responded with a status of 404 (Not Found)
js?key=AIzaSyCtyeajF…Oj1Wg9pdxvo08hk:217
gmaps.4.70.min.js:235

Uncaught SyntaxError: Unexpected number
manifest.json:1
Failed to load resource: the server responded with a status of 404 (Not Found)
manifest.json:1
Manifest: Line: 1, column: 1,

Reply
 
Upvote 0

johnerikson

Active Member
Licensed User
Longtime User
After updating the ABMaterial library to 5.00, a parameter for ABMGoogleMap.addmarker was added, namely poliginids As List.

An added parameter poliginids As List.
What does this mean?
1681161275419.png
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
I checked the source code, and It has to do with setting fences when e.g. dragging a marker.

B4X:
' create the google map
Dim gm1 As ABMGoogleMap
gm1.Initialize(page, "gm1", -12.043333, -77.028333, 15, 350, ABM.GOOGLEMAPTYPE_ROADMAP,0)
gm1.Draggable = True
gm1.HasMapTypeControl = True
gm1.HasStreetViewControl = True
gm1.HasZoomControl = True
gm1.AddMapType(ABM.GOOGLEMAPTYPE_ROADMAP)
gm1.AddMapType(ABM.GOOGLEMAPTYPE_TERRAIN)
gm1.AddMapType(ABM.GOOGLEMAPTYPE_HYBRID)
gm1.AddMapType(ABM.GOOGLEMAPTYPE_SATELLITE)  
page.Cell(2,1).AddComponent(gm1)
...
page.Refresh
page.FinishedLoading  
page.RestoreNavigationBarPosition

' create a fence polygon named 'fence"
Dim Markers As List
Markers.Initialize
AddPoint(Markers, -12.040397656836609,-77.03373871559225, "fence")
AddPoint(Markers, -12.040248585302038,-77.03993927003302, "fence")
AddPoint(Markers, -12.050047116528843,-77.02448169303511, "fence")
AddPoint(Markers, -12.044804866577001,-77.02154422636042, "fence")
' add the fence polygon  
gm1.AddPolygon("fence", Markers, ABM.COLOR_DEEPPURPLE, ABM.INTENSITY_NORMAL, 0.6, 5, ABM.COLOR_CYAN, ABM.INTENSITY_NORMAL, 0.3)
gm1.refresh ' IMPORTANT
' add a draggable marker  in the fence  (red one)
gm1.AddMarkerDraggable("mymarker1", -12.043333, -77.028333, ABM.COLOR_RED, "", "", Array("fence"))
gm1.refresh ' IMPORTANT

when you drag the marker outside the fence, a 'OutsideGeofence' event is raised. (InsideGeoEvence does also exist, but does nothing as the gmaps.js library does not raise it)
B4X:
Sub gm1_OutsideGeofence(MarkerId As String, polygonId As String)
    Log(MarkerId & " is outside fence '" & polygonId & "'")
End Sub

Helper method AddPoint:
B4X:
public Sub AddPoint(markers As List, lat As Double, lon As Double, fencePolygonID As String)
    MarkerCounter = MarkerCounter + 1
    Dim ll As LatLon
    ll.Initialize
    ll.lat = lat
    ll.lon = lon
    ll.PolygonID = fencePolygonID
    MarkersMap.Put("polygonmarker" & MarkerCounter, ll)
    markers.Add(lat)
    markers.Add(lon)
End Sub

When adding a new marker (blue one), you can check if it is inside the fence:
B4X:
Sub btn_Clicked(Target As String)
    Dim gm1 As ABMGoogleMap = page.Component("gm1")
  
    gm1.AddMarker("mymarker2", -12.053333, -77.028333, ABM.COLOR_BLUE, "", "", Array("fence"))
    gm1.refresh ' IMPORTANT
  
    ' will raise the gm1_OutsideGeofence() event if it is outside
    gm1.CheckMarkerGeofence("mymarker2")
End Sub

1681196638304.png
 
Upvote 0
Top