Started by Menion, July 01, 2011, 00:54:41

0 Members and 1 Guest are viewing this topic.


This version of Locus API is deprecated and will not be developed anymore

Check new version on Google Code repository together with How to

Google Code

old text:
  I have started to work on simple API that allow use some extra Locus features directly without need to create manually some byte array or similar as in previous attempts. So, count that this is just an Beta version, but what it contain:

Locus API, now moved to code.google repository - http://code.google.com/p/android-locus-map/
- if you'll be interested in publishing data here, together with some more info, tell me, otherwise I'll probably place all on code.google.com site

9.12.2011 - VERSION 9
- require Locus 1.15.0 (or at least testing version
1) new "mExtraOnDisplay" callback on Point object. Allow to send only partial data to locus and load them only when needed
2) Intent call 'INTENT_ON_POINT_ACTION' now receive complete point also with GC data!
3) new possibility to send data to locus. Store byte[] on card and send link to Locus by EXTRA_POINTS_FILE_PATH. Sample under button 10
4) some minor improvements on Locus and API side

24.11.2011 - VERSION 8
1) actualized Geocaching attributes and also constructor needs to be used now for creating

21.10.2011 - VERSION 7
1) added support for older intent-filters directly into API
2) added support for new intent-filter - MAIN_FUNCTION that allow add your app directly into list of functions and also to right quick menu

1) added function to import file directly into locus
2) some small refractoring and update of sample

1) thanks to Arcao, for some Locus check functions (check menion.android.locus.addon.publiclib.LocusUtils file)
2) added boolean value "found" to set if cache is already ... found

1) some minor changes that fits actual Locus, changed time format in geocaching data

1) improved sending to Locus, not thanks to ContentProvider so almost unlimited amount of data (limit is around 4MB as I noticed, so more then enough)
2) ability to call intent with parametr "Import to database", which lunch direct import to Locus point database

1) Ability to send points into Locus. It's similar to this http://forum.asamm.cz/viewtopic.php?f=29&t=34 but much simplier (callback is still supported, but it's named as 'extra')
2) You can send also complete Geocache with all information
3) Sample application contain whole skin for top bars, so you can inspire and create addon with same design as have Locus.

this API is just library you attach to your project. Look at sample and try to run it to see what is and isn't possible now. Comments and discussion are of course welcome.
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download


Sorry newbie here, new to Android and Locus. I tried building the Sample but when I run it it crashes on me, see log below. I have Android 2.2. Do I have to have Locus Pro?

Also, if I understand correctly: in order for my application to pass data to Locus, both applications need to run at the same time. But Android has this nasty habit of closing applications, how do I even run 2 applications at once. Is my application supposed to launch Lotus or something, then hide somewhere?

E/AndroidRuntime( 5029): FATAL EXCEPTION: main
E/AndroidRuntime( 5029): java.lang.RuntimeException: Unable to get provider menion.android.locus.addon.publiclib.sample.DataStorageProvider: java.lang.ClassNotFoundException: menion.android.locus.addon.publiclib.sample.DataStorageProvider in loader dalvik.system.PathClassLoader[/data/app/menion.android.locus.addon.publiclib.sample-1.apk]
E/AndroidRuntime( 5029):    at android.app.ActivityThread.installProvider(ActivityThread.java:4509)
E/AndroidRuntime( 5029):    at android.app.ActivityThread.installContentProviders(ActivityThread.java:4281)
E/AndroidRuntime( 5029):    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4237)
E/AndroidRuntime( 5029):    at android.app.ActivityThread.access$3000(ActivityThread.java:125)
E/AndroidRuntime( 5029):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2071)
E/AndroidRuntime( 5029):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 5029):    at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 5029):    at android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime( 5029):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 5029):    at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 5029):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
E/AndroidRuntime( 5029):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
E/AndroidRuntime( 5029):    at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 5029): Caused by: java.lang.ClassNotFoundException: menion.android.locus.addon.publiclib.sample.DataStorageProvider in loader dalvik.system.PathClassLoader[/data/app/menion.android.locus.addon.publiclib.sample-1.apk]
E/AndroidRuntime( 5029):    at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
E/AndroidRuntime( 5029):    at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
E/AndroidRuntime( 5029):    at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
E/AndroidRuntime( 5029):    at android.app.ActivityThread.installProvider(ActivityThread.java:4494)


Hi! I just looked at your API. I would like to fire an intent to display (or import) a GPX file (from a file or URL). Does your API allow that?


hi guys,

gerryscat: try to read in sample, text at button 7. This should help. Anyway you don't need to run both applications at once. When you run your app, and send intent with some information to Locus (thank's to API for example) .. system automatically start Locus if is not currently running

wrygiel: I added function that import data into Locus from file to API. You may try to switch calling from file to URL, I'm not sure but it can work also :). But rather prefer import from file on disk
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download


Okay, it works. :)

We may try to make it even better though. I will tell you what I am trying to achieve:

There are multiple geocaching sites besides geocaching.com. They also have their APIs:


Currently, I am working on a simple app that imports ~20 nearest caches from opencaching.pl. What I do is:
- capture menion.android.locus.ON_POINT_ACTION,
- download GPX file for given lat/lon,
- invoke a proper application/gpx mime-type intent.

This has some disadvantages:
- User has to click 10-20 times in order to download AND display the caches.
- User gets a window saying "you can complete this action using X or Y or Z" (because I have multiple application/gpx receivers intalled).

Users still will be happy having this, but maybe we could make the process more user-friendly. For example, maybe you could start the external intent with startActivityForResult (instead of the current startActivity) and display the caches without the need to repeat the "import, select category, select all points" stuff?


Also, it would be great if I could provide my own intents for handling some specific types of waypoints. I.e. when user clicks a geocache which came from opencaching.pl, my own handler pops up.

This approach would allow external developers to deliver customized handlers for multiple point types. For example, users would be able to log an entry to opencaching.pl site directly with Locus.


nice .. understand ...

so firstly,
  every point you send over API can have "callback" method attached in it. Check menion.android.locus.addon.publiclib.geoData.Point.setCallback() method. It's used by almost all 3rd party addons, so you may try anyone. When user display point on map (your point), under last button will be this callback

  about calling of addon. Do I need to call startActivityForResult? You may catch intent call, do whatever need and immediately return values to Locus. The import stuff you don't like is optional. If you just want to display data, you don't need to start import (it's optional parameter when you send data to locus)
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download


Ad 1. Okay, so I'd have convert my GPX file to ArrayList<Point>, and set a proper callback?

Ad 2. I think you misunderstood me. What I'm saying is your importFile API method won't always work. If user had set an other default application/gpx handler, Locus will not even be mentioned - the other handler will be called automatically. In other words, I don't see a way to FORCE it be imported by Locus.


PS. I don't see an option to make import optional if I send the data through GPX file. I know it is optional when I use List<Point> methods, but maybe it would be easy to make it optional for GPX files too?


ah I missed this important info .. you're downloading directly GPX files ... hmm ....

1) if you want to set callBack on points, then yes. You have to parse these data by your own and then set callback on Point object. This have also one more advantage ... it's then very simple to just display data on map (without need to import). Only display data from GPX file without ability to import is not possible. Reasons is one. When I'll for example import whole PQ only for display, number of information is so big, that it will surely kill application on OutOfMemory. I have to keep as many data as I can on SD card.

2) you may call locus directly I think ... something like
Intent intent = new Intent(menion.android.locus.core/menion.android.locus.core.MainActivity);should work. i do not tested it, but if this should be enough for you, I'll test it and add correct function into API

So it depend on you. If you want to write own parser and fill Point (and other) objects and send them to Locus, it's already in API and it will works fine I think (it's all used and well tested by geocaching4Locus addon). If you still want to send GPX file, I may test method 2) and add it into API but count that as I wrote - only displaying data from GPX without import will not be possible
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download


I will use the GPX import option for now (despite what I said, I still think it is the most user-friendly of currently available API options). Please modify your API so to force the GPX to be imported by Locus.


Didn't really get the gpx part.

I have an app that downloads gpx files through SSH and stores them locally on sdcard. Is there an easy way to start Locus and load a gpxfile and automatically show it in map?
What are the needed Intent-coding for this action?


Hi Guys!
  direct import to Locus is now added to API. It's tested so I'm sure it will work. Check sample app and action on button 9
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download


Hey menion,

a friend of mine, asked me to write an ornithology app, which can be used to trak spotted birds.
I think, a very pragmatic way would be, to cerate an addon for your extremly handy application.

However, what I need would be to add a new function to Locus. After clicking this a new (maybe transparent) window would open above the map, where the ornitologist could add spotted birds.

As far I can see, your api doesn't support this right now.
Can you imagine to integrade such features?



  may you describe it a little? You wrote "After clicking this" but I don't understand what you mean. You want just collect points? This can be easily done by registering intent and you application appear in submenu on every point. So when you tap long on map and you get point window, there will be your application and you'll be able to call some your window with coordinates. Is this what you want?
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download