Start a new topic

Location-Based AR questions (database,markers)

Hello,

 

We're creating a location-based AR android application using javaScript API with android studio,

and we have a few questions that we struggled to find an answer to.

 

1- how can we retrieve the data from the remote database (we're using 000webhost) then send it to the marker information to javascript.

 

2- is it possible to make the markers with different images (marker image) or they should all have the same icon?

 

3- can I call a java activity from javascript when the marker is clicked?


1 Comment

Hello Doaa,


There is a documentation section that describes how you can retrieve the data if they are stored locally or in a webservice. You can find more information here https://www.wikitude.com/external/doc/documentation/latest/android/retrievingpoidata.html#from-a-local-resource. You can also define custom visual representation of your POIs, that's no problem. You may e.g. define a mapping between type and idle/selected marker. Create one ImageDrawable per type in your experience code's init block. e.g.

 

World.markerImageRessources = {"idle": {}, "selected": {}};
World.markerImageRessources.idle["typeA"] = new AR.ImageRessource("https://myserver.com/typeA_idle.png")
World.markerImageRessources.selected["typeA"] = new AR.ImageRessource("https://myserver.com/typeA_selected.png")
World.markerImageRessources.idle["typeB"] = new AR.ImageRessource("https://myserver.com/typeB_idle.png")
World.markerImageRessources.selected["typeB"] = new AR.ImageRessource("https://myserver.com/typeB_selected.png")

// that way you can then call, e.g.
this.markerDrawable_selected = new AR.ImageDrawable(World.markerImageRessources.selected[poiData.type], 2.5, {});


Finally, you can define another activity when a marker is clicked by creating a GeoObject and calling the event onClick. You can have more information here https://www.wikitude.com/external/doc/documentation/latest/Reference/JavaScript%20API/classes/GeoObject.html.


Thanks

Eva

Login or Signup to post a comment