Locus Map - forum

Development => Developers => Topic started by: Menion on July 01, 2011, 00:54:41

Title: [DEV] - (DEPRECATED) Locus Data API (BETA)
Post by: Menion on July 01, 2011, 00:54:41
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 (//http://code.google.com/p/android-locus-map/)


old text:
Hi,
  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/ (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.14.6.6)
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

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

VERSION 4
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

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

VERSION 2
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

VERSION 1
1) Ability to send points into Locus. It's similar to this http://forum.asamm.cz/viewtopic.php?f=29&t=34 (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.
Title: Re: [DEV] - Locus Data API (BETA)
Post by: gerryscat on August 19, 2011, 20:22:56
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)
Title: Re: [DEV] - Locus Data API (BETA)
Post by: wrygiel on September 08, 2011, 23:18:03
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?
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Menion on September 09, 2011, 14:14:16
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
Title: Re: [DEV] - Locus Data API (BETA)
Post by: wrygiel on September 09, 2011, 16:23:52
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:

http://opencaching.pl/okapi/ (http://opencaching.pl/okapi/)
http://www.opencaching.us/okapi/ (http://www.opencaching.us/okapi/)
http://www.opencaching.org.uk/okapi/ (http://www.opencaching.org.uk/okapi/)

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?
Title: Re: [DEV] - Locus Data API (BETA)
Post by: wrygiel on September 09, 2011, 16:28:49
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.
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Menion on September 09, 2011, 16:42:28
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)
Title: Re: [DEV] - Locus Data API (BETA)
Post by: wrygiel on September 09, 2011, 16:55:27
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.
Title: Re: [DEV] - Locus Data API (BETA)
Post by: wrygiel on September 09, 2011, 17:02:44
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?
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Menion on September 09, 2011, 20:13:20
ah I missed this important info .. you're downloading directly GPX files ... hmm ....

so
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
Title: Re: [DEV] - Locus Data API (BETA)
Post by: wrygiel on September 10, 2011, 20:55:51
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.
Title: Re: [DEV] - Locus Data API (BETA)
Post by: muerte on September 20, 2011, 14:37:15
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?
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Menion on September 20, 2011, 19:25:45
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
Title: Re: [DEV] - Locus Data API (BETA)
Post by: staeff on October 17, 2011, 13:06:28
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?

Regards,
staeff
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Menion on October 17, 2011, 13:17:01
hi,
  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?
Title: Re: [DEV] - Locus Data API (BETA)
Post by: staeff on October 17, 2011, 15:23:27
of course:

With "Function", i ment what appears in the function-menu of Locus and what can be put into the right icon bar.

This should offer the possibilities to add a species, the spotted count of them, and the date.
I think just collection points won't be enough. It would be better, if it can be an own type of point, like the parking-place. (The additional information can be handled in the addon).

It is very common for bird-spotters watch and cound tens of thousends of birds,(of different species), during their migration.
So, what they need is a menu for a specific place, where they can add and count birds.
At some time, they like to transfer their counts into a internet-database and share it with other ornitologists for scientific analysis.
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Menion on October 18, 2011, 18:20:31
Ok I think we should try this. Ability to add custom function to function list and also to right menu should be possible I think. I'll call this function with coordinates and you'll store all info in your addon after user fill some data and confirm. Then you'll have to send locus data to display on map. You can simply use API that is already working together with some icons. Hmm .. as I think about it, I think it's really possible. If you're really interested in this (and think carefully about it :) ) ... I think I should add some support for intent-filter that will add function to the function list and you should then start with some developing ...
Title: Re: [DEV] - Locus Data API (BETA)
Post by: staeff on October 18, 2011, 21:17:53
Cool. I'm very interested to create a prototype for this idea.
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Menion on October 21, 2011, 18:25:35
fine, so testing version is here viewtopic.php?f=25&t=1013 (http://forum.asamm.cz/viewtopic.php?f=25&t=1013)

you need this version and last version of this API (version 7). There is also a sample application, so you may try it. Now you can add you application to quick right menu and call it directly together with current map center and GPS location (if GPS is enabled). Best is to store all data in your own application and display only points in Locus thanks to API. Also every point can have "call back" so user can directly call back your application from point. All functionality for developers that Locus offer is now in this API. I'm looking forward to some request and comments
Title: Re: [DEV] - Locus Data API (BETA)
Post by: staeff on October 24, 2011, 17:40:04
Thank you for the fast update.

I've loaded the newest release of your api, took a look at the changes of the manifest and the sample activity and run it (even installed it).
I can see the app in the sub-menu of every point and in the Location List. However it doesn't appear in my function-list.

On main-screen-> menu-key -> (there is no app) add new button -> (there is no app)

Am I looking in the wrong place?
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Menion on October 24, 2011, 17:48:19
I think you look on correct place ... menu > function > and below all functions is 'LocusAddonPublic...', same with list of "Add new button" ... try it once more :) (searching)
Title: Re: [DEV] - Locus Data API (BETA)
Post by: staeff on October 24, 2011, 22:53:01
The last update did it. (or it was just a plain restart)
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Martin Sloup on November 28, 2011, 23:49:27
Hi Menion,

In which version is implemented Locus Data API VERSION 8?
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Menion on November 29, 2011, 06:39:26
Hi Arcao, last market version already use this API
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Martin2 on December 19, 2011, 23:09:57
Hi Menion

I'd like to implement an addon for routing service of http://www.freemap.sk/ (http://www.freemap.sk/). Currently I can do it so that first user selects the first point on the map, opens it with (sends it to) my routing addon that stores the point, shows the instructions to select another point and then goes bask to Locus. After choosing destination point the addon asks user for route type (car, hiking, cycle, walk) then gets the GPX from http://www.freemap.sk/ (http://www.freemap.sk/) and tells Locus to import it. User can also add multiple stops. My questions:


Thanks in advance
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Menion on December 20, 2011, 14:42:48
hello Martin,
  implementing routing ability to API seems like good idea. I'll try to think about it. First problem I see is the ability to define more then start and end point. About second point, check first post of this topic and let me know if it work or not ...
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Martin2 on December 20, 2011, 20:30:43
Hi Menion

I've tried LocusUtils.importFileLocus(LocusAddonPublicLibSampleActivity.this, tempFile, false), but it still prompts the import dialog.
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Menion on December 20, 2011, 20:44:48
hehe, I was already started test your previous post message with error :). Seems that one problem solved ... ok, I'll look at it
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Menion on December 20, 2011, 21:40:52
Martin, please try this test version viewtopic.php?f=25&t=1404&p=8598#p8598 (http://forum.asamm.cz/viewtopic.php?f=25&t=1404&p=8598#p8598)
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Martin2 on December 20, 2011, 23:10:03
Quote from: "menion"hehe, I was already started test your previous post message with error :). Seems that one problem solved ... ok, I'll look at it

Yes, this was my fault :-).

Quote from: "menion"Martin, please try this test version viewtopic.php?f=25&t=1404&p=8598#p8598 (http://forum.asamm.cz/viewtopic.php?f=25&t=1404&p=8598#p8598)

It works with this version. Thanks.

Is it possible to "overwrite" previous route with a new one? Maybe by some unique route ID. Because after every computed route a new one is displayed. Maybe an additional intent parameter could specify it ;-). And also if there were extra parameters to specify route description, type, visual properties, etc... ;-)

BTW is it possible to save a route from Locus once it is a temporary one? I found no way to do it so far.

Another feature I'd like to have is that my addon would ask Locus to pick a point for it (Intent with result?). Could this be added too? :-)

Thanks in advance.

PS: later I'd like to add more and more features to my addon to support more of the freemap.sk functionality. For example image gallery, wikipedia placemarks, ... Not sure if alll will be possible to do by using just addon API ;-).
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Menion on December 21, 2011, 10:03:41
quite a lot of requests. About unique name ... you're using method that import some file ... for this, is not possible (and will not be) to set some unique values on data. Anyway as Points have now own system for posting to Locus, same will be done also for tracks, so then will be possibility to update already existing track.

and lot of other things ... I also don't know what all can be possible with intent system, but we'll try ... ;)
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Menion on December 22, 2011, 09:09:30
so,
 - new commit is on web ... here http://code.google.com/p/android-locus-map/ (http://code.google.com/p/android-locus-map/) (if you don't know)

 - testing version is attached!

only one think before you'll test. In commited version is check for locus version before call. It's file DisplayData, line 245 "return sendData(context, intent, callImport, 64, 125);", so here, you need to reduce numbers to 63, 124. This will allow use "send track" function also on testing version
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Menion on December 27, 2011, 18:37:56
martin, current market version can work correctly now and also include new "Pick location" feature ;)
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Martin2 on December 27, 2011, 21:21:37
Thank you, it works, but...

If I select a point then Loucs intent ON_LOCATION_RECEIVE always starts a new activity and calls onCreate in my addon. All the internal state of my activity is reset after every point selection. Currently the only solution I see is to persist the state of my activity. I tried to use startActivityForResult like described at http://developer.android.com/reference/ ... Activities (http://developer.android.com/reference/android/app/Activity.html#StartingActivities) but it doesn't work - onActivityResult is never called. Could this be implemented too? Or do you recommend me to use different approach to remember internal activity state (in my case the list of already selected points)?

Thanks in advance!
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Menion on December 27, 2011, 21:25:51
read please comment in code ... http://code.google.com/p/android-locus- ... s.java#188 (http://code.google.com/p/android-locus-map/source/browse/LocusAddonPublicLib/src/menion/android/locus/addon/publiclib/LocusIntents.java#188)

EDIT: if not clear, I suggest to flag your activity with "singleTask" for this case
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Martin2 on December 29, 2011, 21:44:29
Thanks, it works with singleTask! :-)

Another question: how to set the track to temporary when using DisplayData.sendData(this, track, false)? Currently it is neither temporary (hiding temp. items will not hide it) or listed in the track list.

( offtopic bugreport: when deleting track(s) it asks "Do you really want to delete null?" )
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Menion on January 02, 2012, 00:12:00
ah thanks, only displayed track of course have to be handled by "Remove temp map items" ... fixed

about "null" in delete ... track is without name?
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Martin2 on January 02, 2012, 09:01:50
Quoteabout "null" in delete ... track is without name?
It has a name. Null will only appear if you first select one or multiple tracks with checkbox and use the right down button / delete.
Title: Re: [DEV] - Locus Data API (BETA)
Post by: wrygiel on February 08, 2012, 01:48:59
Couple of months ago I made a simple OpenCaching.PL plugin for Locus. It had a fair number of users and worked well, but stopped working ubrubptly after Locus was upgraded. I haven't touched my application in months, does this mean the API has changed?
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Menion on February 08, 2012, 06:08:40
Hi,
  I cannot say now what exactly, but many changes was done and as I remember correctly, also one that unfortunately breaked backward compatibility. I noticed all addon developers that I know that have published addon on market. Don't know you have also one. So sorry for that, please update to last API version http://code.google.com/p/android-locus-map/ (http://code.google.com/p/android-locus-map/), it will be simple process
Title: Re: [DEV] - Locus Data API (BETA)
Post by: wrygiel on February 08, 2012, 13:27:43
In my case it won't be so simple, because I am travelling for the next two months. I would have to install the whole development package somewhere. :-/ I will have to pray that most of my users won't update Locus in any time soon ;)

I haven't published it on the market. It was my first Android app and I didn't have any plans for future development, so it didn't seem right to put it on the market. No more than a 100 people use it (based on download count).
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Menion on February 08, 2012, 13:30:12
OK, so how can I help ... hmm I can offer that if you send me code, I'll fix small issue that cause troubles and send you fixed code back. Anyway you'll still need to compile result and sign it by your key, so not much help from me. I'm sorry for that, damn ...
Title: Re: [DEV] - Locus Data API (BETA)
Post by: berkley on February 08, 2012, 19:19:18
Hi,

I do a lot of different things than standard developing in Java. Long story... Anyway, just as a small hint: I work on at least 3 different desktop pc's all using the same program which is installed in a dropbox directory. The key is located in the same directory. Everything I do while coding (in my case it is more some try-and-error-version of coding) gets synced to dropbox, so i can continue work on another desktop pc. This works also for compiling ;)
But I don't know, if this also works for standard Android SDK tools... Anyway, Good luck!

Cheers, berkley
Title: Re: [DEV] - Locus Data API (BETA)
Post by: wrygiel on February 09, 2012, 05:54:25
I also have these files on my dropbox :) What I don't have is Eclipse and Java SDK installed. Anyway, menion helped me with the fix (thanks!), now I have the APK and I only have to sign it. Internet connection in my previous hostel was awful, but I just changed hostels, so I think I will manage to do it through remote desktop connection of some sorts.
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Sputnik on March 23, 2012, 14:09:33
Hi,

I'm new to Java so struggling a lot here. I am successfully sending points to Locus from a remote JSON source. Its great. I was hoping to be able to send a little additional data like Speed and Heading and time received. The Geocaching class? has a little too much specialised info/buttons.

This is what I have.   Would anybody be able to suggest a (simple!) way to attach this additional info.

Thanks.

P.S. I don't suppose there is anything built into the API for auto refreshing this content ?   :)

          PointsData pd = new PointsData("callSendMorePoints");

   // Getting Array of remote markers from server
   contacts = json.getJSONArray(TAG_CONTACTS);

   // looping through All Contacts
   for(int i = 0; i < contacts.length(); i++){
       JSONObject c = contacts.getJSONObject(i);

       // Storing each json item in variable
       String label = c.getString(TAG_LABEL);
       String lat = c.getString(TAG_LAT);
       String lon = c.getString(TAG_LON);
       String speed = c.getString(TAG_SPEED);
       String heading = c.getString(TAG_HEADING);
       String received = c.getString(TAG_RECEIVED);
       
      Location loc = new Location(TAG);

       ///convert from string to double
       double aDouble = Double.parseDouble(lat);
loc.setLatitude(aDouble);

///convert from string to double
double bDouble = Double.parseDouble(lon);
loc.setLongitude(bDouble);

/// Anyway to attach my speed and heading with this ?
                       Point mydata = new Point(label, loc);


pd.addPoint(mydata);
        }
       DisplayData.sendData(activity, pd, false);
       }
          catch (JSONException e) {
          e.printStackTrace();
           } catch (RequiredVersionMissingException e) {
// TODO Auto-generated catch block
    e.printStackTrace();
            }
  }
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Menion on March 23, 2012, 14:32:03
hi, simple way :) - try loc.set ... Altitude, Bearing, Speed, Time (as long in millisecs since 1.1.1970)

these values will be then displayed at point info screen in Locus. And auto-refresh? Hmm you may autorefresh these points by your own by sending PointsData object with same name. This will overwrite previous points in Locus memory
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Sputnik on March 23, 2012, 15:04:08
Thanks Menion

Thats a great help. Took a little while to figure out that the time is Milliseconds (Like you said !) and not unixtime like I was doing.
Very happy now. Thanks for the API. Love this software  :D
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Sputnik on March 25, 2012, 17:51:33
Hi Menion,

Thanks your api is working beautifully. I have one little problem though.  When I import my points, it is as if they arrive in locus at the wrong zoom level.  And initially they are in the wrong position. When I zoom in or out they then jump to the correct location. I was hoping you might have a suggestion for me.

Many thanks once again.
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Menion on March 26, 2012, 09:11:22
Hi,
  this was issue in Locus. Fixed now ...
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Sputnik on March 26, 2012, 11:04:15
Fantastic,

I guess this will be available in the next update ?

Thanks...
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Menion on March 26, 2012, 11:14:00
exactly. tomorrow probably
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Sputnik on April 04, 2012, 16:18:06
Hi Menion,

I think that problem might still be present. I noticed on a couple of occasions that the points appeared in the wrong position. I loaded the markers while viewing a zoomed in map of my location (200km from where the markers were supposed to appear). The markers showed up in my view (200km error) when I zoom in or out they then jump to their correct position.

Hope that makes sense.
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Menion on April 04, 2012, 16:30:11
hmm still really? .. do you really test in on last version? ok fine, may you describe me which function you use and some short step-by-step to achieve this issue also on my phone? Thanks
Title: Re: [DEV] - Locus Data API (BETA)
Post by: LunaSela on April 21, 2012, 20:24:26
Hi,

what is the actual license of Locus API?

The license information on Google Code says LGPL, but the comment headers in code itself in the repository state GPL.

IMHO both are not suitable for use in non-GPL apps / extensions as AFAIK you cannot easily relink code on Android. A user (not only the App developer) has to be able to modify the Locus API lib and relink the modified version to an app if he wishes, doesn't he?
Title: Re: [DEV] - Locus Data API (BETA)
Post by: Menion on April 21, 2012, 20:39:10
ah sorry. I changed license from GPL to LGPL and forget to change headers also.

Anyway why LGPL is not suitable? LGPL just say that you may use it in non-gpl as you want, it's not a problem. Only a changes have to be reflected back to code owner. In this case it's logical. Changing Locus API without reflection to Locus itself don't have much sense.

You just cannot simply change way how Locus communicate over API  with your application without changes in Locus itself, so LGPL make sense here.
Title: Re: [DEV] - Locus Data API (BETA)
Post by: LunaSela on April 24, 2012, 20:32:22
The LGPL requires that anybody who receives the software with a LGPL library in it to be able to change the LGPL library and link it with the application.

Example

1. Mr. Somebody downloads and uses a fictional LocosFoo.apk extension app (not open-sourced)
2. LocusFoo.apk includes Locus data library (LGPL licensed)
3. Mr. Somebody changes the Locus data library (he has access to the sources) - lets say he changes it to swap latitude and longitude before passing it to Locus
4. Mr. Somebody MUST be able to link LocosFoo.apk against the modified library so that LocusFoo.apk runs with the modified version and swaps latitude and longitude when passing data to Locus

In C++ world, this is usually done by shared library linking, the shared library could easily be exchanged. Alternatively one can ship
the non-linked object files and the user can link it against the executable.

In pure Java world, one could unpack the .jar file and exchange the .class files. (when the .jar is not signed)

In Android world is starts to get complicated. You have to open the .apk and the .dex to get the .class files again. Then you have to pack it all together and sign it with your own private key. Before reinstalling the modified version, you have to delete the original .apk as the public key / certificate changed and all stored data of the .apk is lost. I am not sure if that is still ok with LGPL.

Adding an exception like in GNU Classpath //http://www.gnu.org/software/classpath/license.html might work - or even a more liberal license like the 2 clause BSD license.

Modifing the library itself might be no problem as long as the interface to Locus does not change.But you are correct - most changes do not make sense without changing Locus too. But if the developer does that in an incompatible way, he is simply asking for trouble - and he can do that anyway even with pure GPL