Hi, I'm a new developer, so that also means I'm new to Android.
I am familiar with Java and with the explenation of the samples I I understood the Js documents. What I don't quite get is how the Java source files of the example interact with the Js samples. With this I mean, I can't find where they are "called", if they ever finis by themselves or only when I hit return on the phone and how to send parameters and call functions of the Js.
Could anbody help me figure this out or tell me where I can read about it?
Thanks for your help
about 10 years ago
There are 2 types of communication
Java -> JS
JS -> Java
From JS to java you have to do following steps:
implement an ArchitectUrlListener and register it with ArchitectView.registerUrlListener(ArchitectUrlListener listener)
in JS set the "document.location" to any url starting with "archtiectsdk://"
once set, the listener's urlWasInvoked method is called
parse the url (parameters are possible as well) and react accordingly
Another question, the camera view and render of the drawable objects on it is handled by de js files o by the Java activity? I would appreciate if you could tell me exactly were on the sample app this is made.
almost 10 years ago
is the "callactioninJava" is a method name in a java class or a java class name?
What I tried is the following: I have button ("Take me there") in Poi detail panel near the "More" button and when user clicked to the "Take me there" button, I want to call a java method to do some calculation.
in my js file on button click method I have:
var currentMarker = World.currentMarker; var architectSdkUrlm = "architectsdk://Navigation?id=" + encodeURIComponent(currentMarker.poiData.id) + "&title=" + encodeURIComponent(currentMarker.poiData.title); document.location = architectSdkUrlm;
where "Navigation" in the architectSdkUrlm is name of the java class that I created for the calculations. Navigation class is:
I want to see if I could call the java file from js by a Log message but I don't get anything.
Do you have any idea about what might be the problem?
almost 8 years ago
Please have a look at the sample app for recommended approaches. Although I just see the snippets please check that you set the architectView properly (using id from your layout.xml)
Best regards, Andreas
over 7 years ago
over 7 years ago
Note that this document location changes is handled in a special way - the UrlListener will intercept them and report them to your native Android/iOS listener. That way you can pass information from JS to native in an easy way.