Open Maps app from Code - Where/How to find the “Current Location”?

后端 未结 4 1446
故里飘歌
故里飘歌 2020-12-15 01:18

I am opening Maps app to show directions from user\'s Current Location to a destination coordinate, from my code. I am using the following code to open the Maps app. I am ca

4条回答
  •  攒了一身酷
    2020-12-15 02:12

    You don't have to determine the user's current location yourself, the Maps app will take care of it.

    Instead of passing a latitude/longitude pair you can pass Current%%20Location and Maps will determine the user's current location itself.

    %20 is a url-encoded space character, and the extra % escapes the actual % so it won't be interpreted as a format substitution.


    Thanks to @Carlos P for pointing out my escape character blunder in the original answer.

提交回复
热议问题