Start a new topic

Problem with POI.

Problem with POI.


I have problem with POI. After enter the world I can't see any point of interest. 

 

@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
buildGoogleApiClient();
architectView.onPostCreate();
try {
this.architectView.setLocation(mLastLocation.getLatitude(),mLastLocation.getLongitude(),mLastLocation.getAltitude(),mLastLocation.getAccuracy());
this.architectView.load( "file:///android_asset/demo2/index.html" );
}
catch (Exception e){
}

 

Html : 

<body >
<div data-role="page" id="page1" style="background: none;" >

<!-- MAIN PAGE CONTENT -->

<!-- transparent footer-->
<div data-role="footer" class="ui-bar" data-theme="f" data-position="fixed" style="text-align:center;">

<!-- small status-button -->
<a style="text-align:right;" id="popupInfoButton" href="#popupInfo" data-rel="popup" data-role="button" class="ui-icon-alt" data-inline="true" data-transition="pop" data-icon="alert" data-theme="e" data-iconpos="notext">Log</a> </p>

<!-- popup displayed when button clicked -->
<div data-role="popup" id="popupInfo" class="ui-content" data-theme="e" style="max-width:350px;">
<p style="text-align:right;" id="status-message">Trying to find out where you are</p>
</div>

</div>

</div>

</body>

And here is the javascript code from example :

// implementation of AR-Experience (aka "World")
var World = {
// true once data was fetched
initiallyLoadedData: false,

// POI-Marker asset
markerDrawable_idle: null,

// called to inject new POI data
loadPoisFromJsonData: function loadPoisFromJsonDataFn(poiData) {

/*
The example Image Recognition already explained how images are loaded and displayed in the augmented reality view. This sample loads an AR.ImageResource when the World variable was defined. It will be reused for each marker that we will create afterwards.
*/
World.markerDrawable_idle = new AR.ImageResource("assets/marker_idle.png");

/*
For creating the marker a new object AR.GeoObject will be created at the specified geolocation. An AR.GeoObject connects one or more AR.GeoLocations with multiple AR.Drawables. The AR.Drawables can be defined for multiple targets. A target can be the camera, the radar or a direction indicator. Both the radar and direction indicators will be covered in more detail in later examples.
*/
var markerLocation = new AR.GeoLocation(poiData.latitude, poiData.longitude, poiData.altitude);
var markerImageDrawable_idle = new AR.ImageDrawable(World.markerDrawable_idle, 2.5, {
zOrder: 0,
opacity: 1.0
});

// create GeoObject
var markerObject = new AR.GeoObject(markerLocation, {
drawables: {
cam:
}
});

// Updates status message as a user feedback that everything was loaded properly.
World.updateStatusMessage('1 place loaded');
},

// updates status message shon in small "i"-button aligned bottom center
updateStatusMessage: function updateStatusMessageFn(message, isWarning) {

var themeToUse = isWarning ? "e" : "c";
var iconToUse = isWarning ? "alert" : "info";

$("#status-message").html(message);
$("#popupInfoButton").buttonMarkup({
theme: themeToUse
});
$("#popupInfoButton").buttonMarkup({
icon: iconToUse
});
},

// location updates, fired every time you call architectView.setLocation() in native environment
locationChanged: function locationChangedFn(lat, lon, alt, acc) {

/*
The custom function World.onLocationChanged checks with the flag World.initiallyLoadedData if the function was already called. With the first call of World.onLocationChanged an object that contains geo information will be created which will be later used to create a marker using the World.loadPoisFromJsonData function.
*/
if (!World.initiallyLoadedData) {
// creates a poi object with a random location near the user's location
var poiData = {
"id": 1,
"longitude": (lon + (Math.random() / 5 - 0.1)),
"latitude": (lat + (Math.random() / 5 - 0.1)),
"altitude": 100.0
};

World.loadPoisFromJsonData(poiData);
World.initiallyLoadedData = true;
}
},
};

/*
Set a custom function where location changes are forwarded to. There is also a possibility to set AR.context.onLocationChanged to null. In this case the function will not be called anymore and no further location updates will be received.
*/
AR.context.onLocationChanged = World.locationChanged;

Before setting location to architectView I had message "Trying to find out where you are"
Hello Maciej,

The message you get saying "Trying to find out where you are" is shown when your location can not be fetched as needed. Please make sure that you have the location services on for the sample app.

Thank you
Eva
Login or Signup to post a comment