web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Location field not pic...
Power Apps
Unanswered

Location field not picking location sometimes

(0) ShareShare
ReportReport
Posted on by 422

Hello All,

 

I have a button on my App which is responsible to fill latitude and longitude in my field using a local variable LocVarAS. Sometimes even after pressing button location field does not get the data , can someone advise something which can guaranty that pressing button will always fill the data in the field , 

Thanks  

 

UpdateContext({LocVarAS:Location.Latitude & "," & Location.Longitude})

 

Categories:
  • Ramole Profile Picture
    Super User 2024 Season 1 on at

    Hi @SachinG31 

    I Use similar to your code exempt its global variable and I never had any issues, try this please 

     

    Set(LocVarAS,Location.Latitude & "," & Location.Longitude)

     

  • SachinG31 Profile Picture
    422 on at

    Hello @Ramole , Thank  you so much for the response . i will do that and get back to you if this works for me. it might take few days as only sometimes field does not get location. 

  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @SachinG31,

    Have you solved your problem?

    Do you want to display the latitude and longitude

    Could you please tell me that if you have enable the following settings every time?

    vqiaqimsft_0-1631696162852.png

    If you display this variable in a screen where you create this variable, I think there is no need to use the Set() function. Attention if you allow the app to access your location.

    Besides, not sure if you run the app on web or mobile, if you use it on your mobile phone, Power Apps can automatically disable location services in order to preserve battery life. There are more details here.

    https://docs.microsoft.com/en-gb/powerapps/maker/canvas-apps/functions/function-enable-disable

    Therefore, can you try to enable location services before you reference the signal to see if that makes a difference?

    Enable(Location);
    UpdateContext({var_latitude:Location.Latitude});
    UpdateContext({var_longitude:Location.Longitude})

     

  • SachinG31 Profile Picture
    422 on at

    Hello @v-qiaqi-msft , thanks for looking into this , i am still observing this. 

    Yes  i want to display the  latitude and longitude

    This issue users are facing while using app in their phone , I have variable in a screen where i create this variable.

    As per your advise have added Enable(Location) to the location button , i hope this will work. i will update here once i will make sure this is working.

    Thanks again

  • SachinG31 Profile Picture
    422 on at

    Hello @v-qiaqi-msft , As advised i tried enable location services before you reference the signal. i put Enable(Location); on button OnSelect before capturing the lat long. but unfortunately still sometimes field does not capture the data. Can you advise any other solution ? 

  • SachinG31 Profile Picture
    422 on at

    Hello @Ramole , if i set my variable as global , how will i display it on the location field , i tried set the variable on default property of field but its not working there. Please advise

  • Ramole Profile Picture
    Super User 2024 Season 1 on at

    Hi @SachinG31 

    Set the global on start of the app 

    Set(LocVarAS,Location.Latitude & "," & Location.Longitude)

     

    and use this anywhere you will like to display

     

    LocVarAS

     

  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @SachinG31,

    That's weird.

    Could you please try to remove the variable and put the following formula into the Text property of the Label:

    Location.Latitude

    vqiaqimsft_0-1632379380636.png

  • SachinG31 Profile Picture
    422 on at

    Hello @v-qiaqi-msft , its is showing value now but sometimes it missed even after pressing button.

    SachinG31_0-1632379882744.png

     

    my button does many changes 

    These are all the code i written on my button 

    Enable(Location);UpdateContext({DateNow1: Now()}); UpdateContext({LocVarAS:Location.Latitude & "," & Location.Longitude});Set(buttonPressedAStart,true);UpdateContext({flg: "0"});Set(Var,LookUp(Choices('BG Activity Recorder'.'Activity Status'),Value="Open"));Set(buttonPressedAEnd,false);
  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @SachinG31,

    The issue you mentioned happened from time to time, if you store the latitude and longitude using a variable, it may have display issue for some reason that we don't know.

    I suggest that you give the variable and consider display the location info using the Location.Latitude directly.

    If this issue stays, I think you could consider opening a ticket to investigate this issue for more.

    Support | Microsoft Power Apps

    Sorry for the inconvenience we bring you.

    I hope you are well on your way to solving this problem。

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 234 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard