[DEV] - Locus API (since Locus 2.7.3)

Started by Menion, November 09, 2012, 11:29:33

0 Members and 3 Guests are viewing this topic.

Menion

Hi to all,

API location: http://code.google.com/p/android-locus-map/

  together with huge changes in database system in Locus version 2.7.0, come another expected change. I'm glad I may anounce new version of Locus API. Locus internally for points/tracks/locations etc. use new objects, that are shared also with new Locus API. Current, first version of API, now have completely same functionality as old one, except few details.

9. 11. 2012
Do not use current version of API in public version of your application. API need to be well tested and also improved by developers needs. Comments how to do things in API different or better are welcome. So use it, test it and let me know.

Conversion from deprecated version of API is possible. Some functions have now more logical names and are placed in more logical hierarchy. Best methods are to check samples in sample application
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download
  •  

ville_sml

In the new api, is there a possibility to remove a temporary point/track?

There is method listed:
protected static boolean removeDataSilently(Context ctx, String extraName,
         ArrayList<Integer> itemsId) throws RequiredVersionMissingException;
But is this the correct way? If so, should the ArrayList<Integer> itemsId be ArrayList<Long> itemsId as the GeoData has field:
   // unique ID of this object
   public long id;

  •  

Menion

hi,
  function you found is currently used only for removing circles from map, not generally on all possible map items. I have improved documentation to make this clear.

  What you need is already possible, anyway to make it easier, I just added new function

ActionDisplayPoints.removePackFromLocus(Context ctx, String packName)

that should do what you need. It's already on Google Code repository, so you may try it. Hope it will work fine
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download
  •  

Voldik

Hi menion,

as you know, I'm trying to rewrite Geoget addon to new API. This error occured after canceling the addon:
http://prntscr.com/2s6t9y

I don't know whether is my code OK or not, maybe you will know better. :-)
  •  

Menion

Hi,

if you see this error, it have to mean, that your compiled project do not have included Locus API library (the core).

This may happen probably only in case, you included project for compiling, but not included also to deploy.

Did you follow exactly steps on this page? http://code.google.com/p/android-locus-map/wiki/Installation

Check mainly
- locus-api-android - step 2
- your project (same as locus-api-android-sample) - also step 2

important is mainly "check also LocusAPI"
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download
  •  

Voldik

I have checked it four time and for the five time also together with my girlfriend. Everything is checked and added. I tried to put LocusAPI to the top of the "order and export" list but it has no effect.

Sample project does the same.

The only difference from the described setup is that I didn't use Mercurial and downloaded it directly from the google code.
  •  

Menion

#6
[CZ]
No pak by jsi mohl ještě zkusit do LocusAPI_android a toho tvého projektu přidat přímo LocusAPI.jar (z přílohy), namísto linkování knihovny.

Eclipse občas nedělá dobrotu, nicméně vyčištění projektů případně restart eclipse většinu problémů vyřeší ..
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download
  •  

Voldik

#7
[CZ]
Bohužel nepomohlo, zkusím to celé naklikat znova...

edit
Ještě přiložím tuto chybu: http://prntscr.com/2scsp6

Screeny nastavení hlavního projektu (MainActivity se jmenuje): http://prntscr.com/2sczgg

V LocusAPI_android mám zatržené "Is Library", "Project Build Target" stejně jako výše, v Java Build Path/Projects není nic, do Libraries jsem přidal externí JAR LocusAPI, v Order and Export je zatržené.

Builduju to přes pravý klik na MainActivity project a Run as -> Android Application.

V telefonu mám poslední verzi legální Pro verze, systém 2.3.3.
  •  

Menion

[CZ]
no já ti nevím :)

můžeš mi ten balíček do Eclipse nějak poslat, já se na to podívám u sebe? Pokud to co na screenshotu máš červeně přeškrtnuté, tam opravdu nemáš, tak to vypadá v pořádku.

Ta chyba co vidíš (první screen) vůbec nevím co znamená. Tam žádné LocusAPI_android.apk být nemá. Ta knihovna se ti má zkompilovat do tvého projektu rovnou a ne přes nějaké APK.

No to jsem zvědav co to nakonec bude. Vypadá že použití API budu muset nějak zjednodušit, i když zatím nevím jak protože tohle nic komplikovaného být nemá :)
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download
  •  

Menion

I'll change language back to English, to keep topic readable for others also ...

So I create new Workspace, imported your two projects with File > Import > Existing project

In both projects, I fixed problem with absolute path to library LocusAPI

And after that, no problem to start and to run this project!

BUT: Seems you switched from old API to new, but not all! In manifest file is receiver for broadcast messages. This needs to be set to

           <intent-filter>
                <action android:name="locus.api.android.ACTION_PERIODIC_UPDATE" />
            </intent-filter>


you have there set old parameter.

It's weird that you saw some completely different error message, but this may solve that problems
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download
  •  

Voldik

Is it possible that problem is in old (not latest) version of ADT bundle? I have just downloaded the latest one and now everything seems working...

(The video I sent to you is with the previous version)
  •  

Menion

possible is everything, but I see no reason for this.

Anyway really do not forget to change parameter in manifest. Good it works now ...
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download
  •  

Voldik

I have question, how Locus recognizes that cache (during import) is computed and moves it to final coords? (checkbox in Locus is checked)

And another question: It seems that in field GeocachingWaypoint.desc can be HTML tags but when I edit that WP I see HTML tags - is it expected behavior?
  •  

Menion

1) cache is computed if:

waypoint.gcData.computed = true;

or cache contains waypoint that starts with "fi", "fl"  and it's coordinates are non-zero

2) yes, all these descriptions may contain HTML code and Locus display them in WebView view so they will look exactly as should! Negative effect is, that if fiels, like "desc" is editable, you see all these HTML tags. Anyway in case of caches, I think there is no need to put anything to waypoint.desc. Rather use waypoint.gcData.setShortDescription() and waypoint.gcData.setLongDescription() functions
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download
  •  

Voldik

#14
Ad 1) So, during the reading from geoget database, I can detect cache with final waypoint in two ways - according the type of waypoint (GeocachingWaypoint.CACHE_WAYPOINT_TYPE_FINAL) and according to waypoint's flag (http://geoget.ararat.cz/doku.php/user:databaze#struktura_databaze_geogetu - see table "waypoint" and column "flag").
What should I do so user with checked "move to final coords" will see red star in the corner and icon on final coords?

Is setting GeocachingWaypoint.type = GeocachingWaypoint.CACHE_WAYPOINT_TYPE_FINAL not enough?
Would be condition
if (GeocachingWaypoint.type == GeocachingWaypoint.CACHE_WAYPOINT_TYPE_FINAL || flag == 2){
    gcData.computed = true;
}

enough?

BTW FYI, final waypoints are in Geoget with prefix Fx, where x = {0, 1, 2, 3, 4, ...}.

[CZE for better understanding :-)]
Mám v databázi Geogetu staženou keš přes API, u které mám přepsané souřadnice na webu. V geogetu tedy vidím nový WP a to: Prefix=F0, Druh=Final Location, Název=Coordinate Override, Flag=2 a nenulové souřadnice.

Momentálně v addonu testuji onen flag a pokud je 2, tak nastavuji gcData.computed = true; a nic víc. V Locusu potom po importu vidím ikonku na výchozích souřadnicích s hvězdičkou. Když jsem u jiné keše změnil pouze prefix z F0 na FI, flag zůstal 2, tak se nic nezměnilo. Pokud změním prefix z F0 na FI a zároven změním flag na 0 (to dělá GG automaticky při editaci), tak mám keš přesunutou na nové souřadnice, ale je bez hvězdičky.

Není mi tedy jasné, co musím a jak nastavit, aby byl výsledek ten, že keš bude na nových souřadnicích a zároven bude mít hvězdičku. Z tvé poslední odpovědi mi není jasné, jestli keš ohvězdičkuje Locus sám, když narazí na WP s prefixem FI.

Takže abych to shrnul, jak musí být nastaveny hodnoty, aby mohl být proveden přesun a přidána hvězdička?
[EN]To sum it up, how to set these fields so that Locus can move the cache and add red star to its icon?
GeocachingWaypoint.type = ?
GeocachingWaypoint.code = ?
GeocachingWaypoint.name = ?
Waypoint.gcData.computed = ?
something else = ?

Ad 2) In this description could be information from listing such as "Parkovani u Nemojanskeho mlyna" from listing http://coord.info/GC3JK82. In geoget, there is also another field for your own personal note, such as code to lock at final coords and I have been asked whether is it possible to import this information into Locus. So I add this personal note right behind the owner's note.

Thank you in advance! :-)
  •