Start a new topic
Solved

Problem with the location (Xamarin)

I have a problem with the location, I tried it in the browser and it works when I put the latitude and the longitude, but in the phone it does not recognize the location.
The location, the internet, the permissions, everything is activated and it does not work for me with the examples that give "08_PointOfInterest_4_SelectingPois" (I'm using Xamarin sdk 7.1.0) I execute it and I get the message of always "Trying to find out where you are "uh tried everything but there is no way, it seems to me that the method is not being called" AR.context.onLocationChanged = World.locationChanged; " and I have less than a month to present the project to see if it is invested in the purchase of your license.

Any help is of great value.


Hello Sergio,

You mentioned that you have also tried with our sample (without any modification) and it does not work. Does your phone has a compass and an accelerometer?

Thanks
Eva

 

Hi Eva, yes is an Asus ZenFone 2 ZE551ML, look the picture about specifications.
You could test if the example of "08_PointOfInterest_4_SelectingPois" works for you by using the Xamarin component on sdk 7.1.0 to see if it is me that is doing something wrong or effectively the component has a fault.

I await the answer and I appreciate any help.

Thank you

 

Hello Sergio,

Since you are using Android, you need to provide a location strategy. Please refer to the documentation here for further information on how to do that.

Thanks
Eva

 

Hi, I tried to implement that which is made for "Android" and not for Xamarin.Android, but still the same problem, has someone else happened to him or knows how to solve it?

 

Hello Sergio,

Could you please send your architect world so we can test internally?

Thanks
Eva

 

Hello, of course, in the following link is the code so they can check what may be wrong, the only thing that is not there are the packages and components.

Anything tell me.

Thank you very much.

 

Hello,



looking at your code, I could not find anything regarding the location permissions required. Are you asking for Android.Manifest.Permission.AccessFineLocation and Android.Manifest.Permission.AccessCoarseLocation?


In any case, I would recommend just calling ArchitectView.setLocation with hard-coded parameters and checking whether that causes onLocationChanged to be called. That way, errors that might be in the Xamarin location access code can be ruled out.



- Daniel

Small amendment:


calling

 

architectView.SetLocation(1.0, 2.0, 3.0);

 

in

 

protected override void OnResume

 

of the WikitudeActivity works for me using the sample world you mentioned. I do get onLocationChanged called with the supplied values.



- Daniel


1 person likes this
Thanks Daniel, you're right, it works perfectly, now to work alone, just ask for the location with the android location and in the same way for correct IOS?

 

I think you would just need to add more permissions to the one that is already requested in MainActivity.cs, like so:


ArchitectView.PermissionManager.CheckPermissions(this, new String[] { Android.Manifest.Permission.Camera, Android.Manifest.Permission.AccessCoarseLocation, Android.Manifest.Permission.AccessFineLocation }, PermissionManager.WikitudePermissionRequest, this);


I believe iOS will take care of getting the location internally, if I am not mistaken. No need to do anything other than making sure the permissions are in order.



- Daniel

Perfect, it works very well, I'm going to try it in several locations and I'll tell you anything, in the same way I'm missing the distance to the scoreboard and open a page when the score is tapped but that's what I do, anything I am commenting, thank you very much...

 

Login or Signup to post a comment