This object is in archive! 

Send point to locus and import

Pedro Assunção de Vasconcellos shared this question 5 years ago
Answered

Hi,


Beginning to use locus api.

I´m using version 0.2.6 but am open to other versions.

I want to send to Locus a point from my app.


Is it possible to use

ActionDisplayPoints.sendPackSilent
and them somehow from Locus import/save this points? As i understand and if it´s not imported it´s a temporary data that will be lost.


Or is it possible to use

ActionDisplayPoints.sendPack
and do some kind of automatic import? (i would prefer the user did not need to care about this).Or is there another way you would suggest?


I also thought about from my app to send to a server and them to download from locus somehow, but there is not always internet available. But could also help.


Thanks!

Replies (3)

photo
1

Hello Pedro,

I think that such heavy modification of users database like import data into certain folders without even know, is not correct and welcome behavior. So no, it is not simply possible to import anything into users points/tracks database without confirmation by the user.

"sendPackSilent" really only display data on the map without saving into the database. If you really want to remove "import" step, you will have to implement this logic on your own side and work with the lifecycle of Locus Map app. So probably register to receive of periodicUpdates and when app opens, send all necessary data for display on the map. It has on second side advantage, that you may create something like "live map" in geocaching4Locus add-on, so you may display only data for the currently visible area, not all at once.

Feel free to ask if something won't be clear.

photo
1

Hi there!


Thanks for the answer it may work this way that you told but makes the apps more dependent on each other (they both have to be always on).


Is it possible to send from my app a gpx file with all the points and them the user do one confirmation and get all the points?


I´m trying to use:

locus.api.android.ActionFiles.importFileLocus(getActivity(), gpxFile); 


But i am receiving a:


android.content.ActivityNotFoundException: Unable to find explicit activity class {menion.android.locus.pro/menion.android.locus.core.MainActivity}; have you declared this activity in your AndroidManifest.xml?


Thanks!

photo
1

Hello Pedro,

"they both have to be always on" ... well, what does this mean in the world of Android? :). If you register your app for "periodic updates" broadcasts, then when Locus Map will be running, your broadcast receiver always received broadcasts from Locus Map, no matter if the user started your application or not.

Problem with the import of file ... heh, seems that nobody used this function for a very very long time. In this function is incorrectly hardcoded class name for main app activity. Also since some changes in the latest Android versions, direct sending of file like this is no longer possible.

I've made a bigger update in Locus API and added documentation here: https://github.com/asamm/locus-api/wiki/Sending-file-to-Locus-Map

You will need to update to latest API version to make this work.

Let me know if there will be any problem, missing docs, something unclear etc.

Menion

Replies have been locked on this page!