[DEV] - Locus API (since Locus 2.7.3)

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

0 Members and 1 Guest are viewing this topic.

Voldik

Another minor problem:
I'm setting fields "dateCreated" and "lastUpdated" in class GeocachingData and no matter what I set, I see actuall date and time when I click on a cache in field "Created:" and no field "Updated:".

I think, that information about update could be important to know how old are data in listing and so on. In my case (importing from Geoget) would by lastUpdated date before dateCreated.

I have taken a look into your sample project, but you don't work with these dates so it doesn't answer my questions.

Thank you.
  •  

Menion

so

1) best is to set new cache coordinates to computed and set parameter "computed" to "true"

or you may as I wrote, add new waypoint that starts with 'FI'nal text. When Locus during import find such waypoint, it move cache to waypoint coordinates and also mark cache as computed automatically. So just simply try attach final waypoint to cache and check if Locus works correctly. It should

So parameters ...
simply add new waypoint. Locus test it's code by this function


private static boolean isFinalWaypoint(String testText) {
// check text
if (TextUtils.isEmpty(testText)) {
return false;
}

// decide if start as final waypoint
testText = testText.toLowerCase();
return testText.startsWith("fi") || testText.startsWith("fl");
}


or in description is just text "Coordinate Override"

If you want to improve this system, just let me know

ad 2) to add notes to cache or read users notes (there were also logical requests to synchronize users notes edited in Locus, back to GeoGet)

waypoint.gcData.getNotes(), setNotes()

ad 3) about times - I'm now worried, that these times are not used in Locus. Every Waypoint has own field "timeCreated" (it's in GeoData.timeCreated) which is used as main visible time. When you will have some working add-on, let me know, send me it for test and I'll fix this problem, so Locus will correctly display these values
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download
  •  

petulinka1

The problem is, you're testing prefix, but you should test waypoint TYPE! Prefix can be WW, if I chose it... But WP type is the first thing, which decides, what WP is it.
  •  

Voldik

#18
I have to agree with Petulinka1, only waypoint type is significant and unambiguous. Everything else is quite unpredictable. :-)

To the second point - you are talking about personal note to whole cache, not only waypoint. See attached screenshot (from new addon's version). After the bold text is personal note only for this WP (before the bold text is owner's description). So, I have solved this issue and "no action needed" now. But if you want, you can add field to Locus for clear handling these personal notes. :)

Ad 3: That explain a lot. :-) When I update cache with GC4Locus addon I see "Last update" field (see attachment), so, it is obviously possible to set this value.
I set it in this way:
Date date = new Date();
gcData.dateCreated = date.getTime();
gcData.lastUpdated = c.getLong(c.getColumnIndex("dtupdate2"));

Current beta version is downloadable from http://www.voldik.cz/geo/locus/LocusAddonGeoget.apk.
  •  

Raddino

Totally agree with Voldik and Petulinka. It should be recognized by type of WP, not by name or prefix. It will be nice to change it. Thanks

Odesláno z mého Nexus 5 pomocí Tapatalk

  •  

Menion

fine, so caching waypoints by type is now fixed. Thanks

about times - I see, there are three types of times in GeocachingData

/* time of last updated time (long since 1.1.1970 in ms) */
public long lastUpdated;
/* String with date of last exported - groundspeak:exported */
public long dateCreated;
/* String with date of hidden - value from CachePrinter */
public long hidden;


which you wanna see in Locus?


btw. because there will be more to discuss, it should be fine to create a czech topic for this ;)
- 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 to set elevation to GeocachingData? (I suppose it is not, so: Would it be possible to add this ability to API?) :-)

And once again thank you for previous work.
  •  

Menion

hmm I'm thinking about it and see no simple solution.

How you image it, as a function that allows you to get computed altitude based on coordinates or an ability to "fill altitude" automatically to points send to Locus?

Because I would like to create first option more, which gives quite a freedom to you or other developers, on second side, it will be slower because you will have to firstly ask locus for altitudes
- 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

No no, I mean just simple method GeocachingData.setElevation(float elevation); In my case (import from Geoget), I already have the elevation computed.
  •  

Menion

ah just set elevation to point? Hmm all values realted to location are in waypoint location object

waypoint.getLocation().set ...
- 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

  •  

Voldik

I've found possible bug. When I use LocusUtils.handleIntentMainFunction(intent, new LocusUtils.OnIntentMainFunction() {...} I'm getting NullPointerException(). I thought it is bug in my application but when I run your sample application I get the same error. StackTrace is here: http://i.imgur.com/SKcqyxO.png

In your MainActivity it is line 230.
  •  

Menion

Sorry, I'm unable to find it.

What you do to achieve same problem? What you wrote about should apper when I install Locus API sample and then in Locus > menu > more > tap on MainActivity. But this works fine and Locus API sample appear and display result of this action.
- 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

Yes, it's working (as far I can tell).

The NullPointerException is thrown at line 422 in LocusUtils.java in method public static Location getLocationFromIntent(Intent intent, String intentExtra) {}

I add Sample App to the right panel, then click on it.
I've tried two different devices and also 'niximor' has reported me this bug.
  •  

Menion

Hmm it's weird. I'm unable to simulate it.

If this problem happen to you and you have access to source of Locus API, check please where this error happen (check if you have latest API). Because you wrote line 422, but on this line if function that creates location from Intent, but this line is in try/catch block

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