[DEV] - (DEPRECATED) calling app from Locus (4.5.2011)

Started by Menion, May 04, 2011, 19:52:04

0 Members and 2 Guests are viewing this topic.

Menion

Method is deprecated, use Locus API


This is useful function that allow you to add shortcut into point submenu in Locus, and call your application with point coordinates.

Simple example:
  when you hold finger on screen, you then see address. Click on address and you get new point on place you tap (or when you click on red center cross, you get exactly map center). Now in last bottom submenu, is few items like Street view and more. And this tool add new item on top of this list. Nice :)

How to do this

  • register intent-filter for your activity
    <intent-filter>
    <action android:name="menion.android.locus.ON_POINT_ACTION" />
    <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
  • now register intent receiver in your application.
    if (getIntent().getAction().equals("menion.android.locus.ON_POINT_ACTION")) {
    double lat = getIntent().getDoubleExtra("latitude", 0.0);
    double lon = getIntent().getDoubleExtra("longitude", 0.0);
    double alt = getIntent().getDoubleExtra("altitude", 0.0);
    double acc = getIntent().getDoubleExtra("accuracy", 0.0);

    // do what you want with this ...
    }

and that's all.

Actual application that use this feature
...
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download
  •  

fabiancz

#1
This feature is used in Foursquare4Locus addon from version 0.2.1. See: viewtopic.php?f=26&t=550&p=3002#p3002
Twitter: fabiancz
  •