Start a new topic

How description pages work

How description pages work


hi , I have a question about description page . in sample code it's like : "document.location = "architectsdk://opendetailpage?id="+id;"

I wanted to know about the location it refers . 

I changed this code to refer to a simple html page I created : "document.location = "description.html";"

and it works the way I want , but the problem is that unlinke the original sample code , when I click on my Android device back button , it doesn't return to the AR borwser and shows POIs , it quits the app . 

I'll be appreciated if you can help me with this 

thanks

 

Hi,

setting the document.location changes the location of the current ARchitectView. Therefore hitting back will exit to the last screen.

You have a few different options:

- use an android activity that displays an webview with your description.html. You will need to use the special protocol identifer architectsdk:// and react to the ArchitectListener. This is similar to the SimpleARBrowser example.

- alternatively you can integrate the description page directly in the ARchitectView but must need to change the back button behavior of the activity containing the ARchitectView. e.g. using callJavascript('history.back()')

 

Hi there!

Just a few additional hints / recommendations:

As you might have noticed, clicks inside ARchitect html files are fetched by the urlWasInvoked-method in the SimpleARBrowserActivity.java

This is where a new activity is launched when you clicked a POI's info-box.
Ensure to handle new Activity-launches in the urlWasInvoked-method, because otherwise the webview itself refreshes the content when using document.location and back-button will close current Activity/App. So in your case you'd need to start a new Brower-Activity by using


Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(browserIntent);

Hope that helps.

Kind regards,
Andi

thanks Andreas I'm using this approach right now , it's easier for me to implement I think :) 

thanks for your help

thanks Wolfgang . I'm trying to figure out how this protocol ("architectsdk://") works . and how can I exchange data between native code and ARchitect file . I'm trying to understand how this urlWasInvoked method works and unfortunately the ArchitectUrlListener source is not available in SimpleARBrowser sample . 

could you tell me more about architechtsdk protocol , for example right now I'm calculating some distance in the ARchitect and I need to pass those values to the native app to show them in the poi_detail page . 

thanks

Aha! I finally found out how to pass data between ARchitect and native app . I passed my distances like this :

document.location = "architectsdk://opendetailpage?id="+id+"&dis="+distance;

thanks so much

 
Login or Signup to post a comment