Current user location:<not sure if its actually working or not>


#1

Hello.

I am trying to retrieve user’s current location to see how far all the events are from their current location.

So on page load I have done this:

  1. Request location authorization ( for this I created a page variable with location manager type variable)

  2. Request location update ( for the location manager I used the same page variable in step 1)
    2.1 When location is updated.
    Set value of current location (type CLLocation) to Event data location updated > recent location

    2.2 when location update failed!
    Show alert!

So i always get the alert that the location update failed. Not sure what i am doing wrong. I have followed all of the instructions.

However in the Events page > when the cell is loaded I have this steps that take place!

  1. Create a location object
    sasda
  2. Calculate distance

123123
3. Set value

I get this as the result
< The last line of every event is the distance away text >

111111111111111

So I am confused if its calculating the distance or not.


#2

Did you test on real device.
I’ve found that using the simulator with location actions isn’t reliable.


#3

@seanhoots I haven’t subscribed to the paid plan as of yet.
Is there any other way?
I tried to create a separate page and find the user location and pin it on a map but I wasn’t able to do that either.
Do you recommend any other method?


#4

Hello @hg.hermes.l, Location/GPS functionality requires device testing. The web simulators don’t handle that capability. While I’m on the topic of web simulator limitations, you’ll find that push notifications are also another achilles heel that requires device testing as well.

From the looks of the logic in your question, I believe this looks correct in your logic but that the web simulator isn’t pushing you any coordinates. As for the last screen shot there, I don’t believe it’s calculating distance however if the alert for location updates failed is being received. That portion should be solves when testing on a device however.


#5

I don’t think you need a paid plan to download the APK to test on device.
It is the source code that you will need a paid plan to get access to.


#6

lol I was just about to say that, you can test on a device without upgrading now, it’s only source code download that requires a paid plan :smiley:


#7

OOPS… That’s right! Apologies there. I’m forgetting what we shifted to here. Yes, it’s only access to source when it comes to requiring a license. Basically you can be free up to a deployment point. Sorry about that.


#8

You guys are awesome. Thank you all for your help.