Author Topic: [DEV] - Locus API (since Locus 2.7.3)  (Read 16825 times)

Offline menion

  • Administrator
  • Professor of Locus
  • *****
  • Posts: 9860
  • Thanked: 43 times
    • View Profile
    • http://www.asamm.com
  • Device: SGS7
[DEV] - Locus API (since Locus 2.7.3)
« on: November 09, 2012, 11:29:33 »
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
« Last Edit: January 01, 1970, 01:00:00 by Guest »
Ideas, wishes, problems
Advanced topics, public discussion, sharing of knowledges, testing beta versions: you're here!
 

Offline ville_sml

  • More than Newbie
  • *
  • Posts: 23
    • View Profile
Re: [DEV] - Locus API (since Locus 2.7.3)
« Reply #1 on: January 20, 2014, 19:32:28 »
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;

 

Offline menion

  • Administrator
  • Professor of Locus
  • *****
  • Posts: 9860
  • Thanked: 43 times
    • View Profile
    • http://www.asamm.com
  • Device: SGS7
Re: [DEV] - Locus API (since Locus 2.7.3)
« Reply #2 on: January 21, 2014, 08:45:34 »
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

Code: [Select]
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
Ideas, wishes, problems
Advanced topics, public discussion, sharing of knowledges, testing beta versions: you're here!
 

Offline Voldik

  • More than Newbie
  • *
  • Posts: 20
    • View Profile
Re: [DEV] - Locus API (since Locus 2.7.3)
« Reply #3 on: February 13, 2014, 21:19:42 »
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. :-)
 

Offline menion

  • Administrator
  • Professor of Locus
  • *****
  • Posts: 9860
  • Thanked: 43 times
    • View Profile
    • http://www.asamm.com
  • Device: SGS7
Re: [DEV] - Locus API (since Locus 2.7.3)
« Reply #4 on: February 13, 2014, 21:27:54 »
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"
Ideas, wishes, problems
Advanced topics, public discussion, sharing of knowledges, testing beta versions: you're here!
 

Offline Voldik

  • More than Newbie
  • *
  • Posts: 20
    • View Profile
Re: [DEV] - Locus API (since Locus 2.7.3)
« Reply #5 on: February 13, 2014, 22:46:58 »
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.
 

Offline menion

  • Administrator
  • Professor of Locus
  • *****
  • Posts: 9860
  • Thanked: 43 times
    • View Profile
    • http://www.asamm.com
  • Device: SGS7
Re: [DEV] - Locus API (since Locus 2.7.3)
« Reply #6 on: February 14, 2014, 08:50:50 »
[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ší ..
« Last Edit: February 14, 2014, 14:01:36 by gynta »
Ideas, wishes, problems
Advanced topics, public discussion, sharing of knowledges, testing beta versions: you're here!
 

Offline Voldik

  • More than Newbie
  • *
  • Posts: 20
    • View Profile
Re: [DEV] - Locus API (since Locus 2.7.3)
« Reply #7 on: February 14, 2014, 13:15:19 »
[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.
« Last Edit: February 14, 2014, 14:02:32 by gynta »
 

Offline menion

  • Administrator
  • Professor of Locus
  • *****
  • Posts: 9860
  • Thanked: 43 times
    • View Profile
    • http://www.asamm.com
  • Device: SGS7
Re: [DEV] - Locus API (since Locus 2.7.3)
« Reply #8 on: February 14, 2014, 14:04:33 »
[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á :)
Ideas, wishes, problems
Advanced topics, public discussion, sharing of knowledges, testing beta versions: you're here!
 

Offline menion

  • Administrator
  • Professor of Locus
  • *****
  • Posts: 9860
  • Thanked: 43 times
    • View Profile
    • http://www.asamm.com
  • Device: SGS7
Re: [DEV] - Locus API (since Locus 2.7.3)
« Reply #9 on: February 16, 2014, 12:00:42 »
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

 
Code: [Select]
           <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
Ideas, wishes, problems
Advanced topics, public discussion, sharing of knowledges, testing beta versions: you're here!
 

Offline Voldik

  • More than Newbie
  • *
  • Posts: 20
    • View Profile
Re: [DEV] - Locus API (since Locus 2.7.3)
« Reply #10 on: February 17, 2014, 14:38:29 »
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)
 

Offline menion

  • Administrator
  • Professor of Locus
  • *****
  • Posts: 9860
  • Thanked: 43 times
    • View Profile
    • http://www.asamm.com
  • Device: SGS7
Re: [DEV] - Locus API (since Locus 2.7.3)
« Reply #11 on: February 17, 2014, 15:37:56 »
possible is everything, but I see no reason for this.

Anyway really do not forget to change parameter in manifest. Good it works now ...
Ideas, wishes, problems
Advanced topics, public discussion, sharing of knowledges, testing beta versions: you're here!
 

Offline Voldik

  • More than Newbie
  • *
  • Posts: 20
    • View Profile
Re: [DEV] - Locus API (since Locus 2.7.3)
« Reply #12 on: February 20, 2014, 21:16:04 »
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?
 

Offline menion

  • Administrator
  • Professor of Locus
  • *****
  • Posts: 9860
  • Thanked: 43 times
    • View Profile
    • http://www.asamm.com
  • Device: SGS7
Re: [DEV] - Locus API (since Locus 2.7.3)
« Reply #13 on: February 21, 2014, 07:39:22 »
1) cache is computed if:
Code: [Select]
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
Ideas, wishes, problems
Advanced topics, public discussion, sharing of knowledges, testing beta versions: you're here!
 

Offline Voldik

  • More than Newbie
  • *
  • Posts: 20
    • View Profile
Re: [DEV] - Locus API (since Locus 2.7.3)
« Reply #14 on: February 21, 2014, 22:25:58 »
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
Code: [Select]
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! :-)
« Last Edit: February 21, 2014, 23:17:57 by Voldik »