Start a new topic

Set custom user location

Set custom user location


Hi Eva,

thanks four your help!
After taking a look at the WikitudePlugin.js I found the folowing function which seems to do just the trick:




/**



 

* Use this function to inject a location into the Wikitude SDK.



 

*



 

* @param latitude The latitude which should be simulated



 

* @param longitude The longitude which should be simulated



 

* @param altitude The altitude which should be simulated



 

* @param accuracy The simulated location accuracy



 

*/



 

WikitudePlugin.prototype.setLocation = function(latitude, longitude, altitude, accuracy) {



 

cordova.exec(this.onWikitudeOK, this.onWikitudeError, "WikitudePlugin", "setLocation", );



 

};




 

 

Hi Manuel,

You can set a custom user location, but that is not linked with the Wikitude SDK. What you want to do is "fake" the user's location. You need to set that up on Android and iOS (depending on the platform you are using). Specifically for iOS, you need to look at the following information.

Injecting Locations

 

? injectLocationWithLatitude:longitude:altitude:accuracy:

? injectLocationWithLatitude:longitude:accuracy:

? setUseInjectedLocation:

? isUsingInjectedLocation

 

In addition, this documentiation may help you. 

Hi Eva,

thanks for your help!

The thing is, I do not need to get the current position, I already have that using iBeacons to determine the current position indoors. Since indoors GPS is not really working, I need to use beacons to get an accurate position. I now want to tell Wikitude to use this position (it's just lat and long) as the users location.
Another example would be: The user physically is in New York City but I want to virtually set his location to Singapore.

Do you understand what I am trying to achieve? Is there any possibility to just set the user's location?

Hello Manuel,

You could have a look at this forum post and see if this helps with your use case.

Addtional read on location handling on android:


http://stackoverflow.com/questions/6181704/good-way-of-getting-the-users-location-in-android

http://developer.android.com/guide/topics/location/strategies.html


On iOS the callback function is called whenever the first location is avaiable. Depending on your current environment (indoor, outdoor, wifi available, gps signal strong etc.) this might not immediately be available.

I hope this helps.

Hi,

is it possible to set a custom loaction for the user and not use the geolocation retrieved by Wikitude?
Login or Signup to post a comment