开发者

Obtaining Coordinates from "Share this place" in Google Maps

When viewing the details of any location in Google Maps, there's an option for "Share this place". I have successfully added myself to the list of receivers by adding this intent-filter to my application in the manifest:

<intent-filter>
    <action android:name="android.intent.action.SEND" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="text/plain" />
</intent-filter>

The extras passed along with this bundle are Intent.EXTRA_SUBJECT and Intent.EXTRA_TEXT. I retrieved these extras in my activity using:

Bundle extras = getIntent().getExtras();

Intent.EXTRA_SUBJECT contains a string with the title of the location. Intent.EXTRA_TEXT contains a string with a detailed address of the location and a mobile maps URL.

Is it at all possible to retrieve the GPS co-ordinates (latitude and longitude) of the location from the "Share this pla开发者_JAVA技巧ce" action?


You can use geocoder to obtain the location from the address:

How can I find the latitude and longitude from address?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜