This object is in archive! 
Can't tell Locus Maps to send locus.api.android.ACTION_PERIODIC_UPDATE
Closed
What are the requirements for Locus Map to send locus.api.android.ACTION_PERIODIC_UPDATE ?
I did create an App with Locus API:
- it has an activity
- broadcast receiver is enabled by default
<application android:allowBackup="false" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme"> <!-- receiver for handling of periodic updates --> <receiver android:name=".receivers.PeriodicUpdateReceiver"> <intent-filter> <action android:name="locus.api.android.ACTION_PERIODIC_UPDATE"/> </intent-filter> </receiver> <activity android:name=".MainActivity" android:theme="@style/AppTheme.NoActionBar"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application>After installation I could find the registered receiver:
cmd package query-receivers -a locus.api.android.ACTION_PERIODIC_UPDATE 1 receivers found: Receiver #0: priority=0 preferredOrder=0 match=0x108000 specificIndex=-1 isDefault=false ActivityInfo: name=falcosc.locus.addon.tasker.receivers.PeriodicUpdateReceiver packageName=falcosc.locus.addon.tasker enabled=true exported=true directBootAware=false taskAffinity=falcosc.locus.addon.tasker targetActivity=null persistableMode=PERSIST_ROOT_ONLY launchMode=0 flags=0x3 theme=0x0 lockTaskLaunchMode=LOCK_TASK_LAUNCH_MODE_DEFAULT resizeMode=RESIZE_MODE_RESIZEABLE ApplicationInfo: packageName=falcosc.locus.addon.tasker labelRes=0x7f0c001d nonLocalizedLabel=null icon=0x7f0b0000 banner=0x0 processName=falcosc.locus.addon.tasker taskAffinity=falcosc.locus.addon.tasker uid=10109 flags=0x3 privateFlags=0x800 theme=0x7f0d0006 requiresSmallestWidthDp=0 compatibleWidthLimitDp=0 largestWidthLimitDp=0 sourceDir=/data/app/falcosc.locus.addon.tasker-2/base.apk splitSourceDirs=[/data/app/falcosc.locus.addon.tasker-2/split_lib_dependencies_apk.apk, /data/app/falcosc.locus.addon.tasker-2/split_lib_slice_0_apk.apk, /data/app/falcosc.locus.addon.tasker-2/split_lib_slice_1_apk.apk, /data/app/falcosc.locus.addon.tasker-2/split_lib_slice_2_apk.apk, /data/app/falcosc.locus.addon.tasker-2/split_lib_slice_3_apk.apk, /data/app/falcosc.locus.addon.tasker-2/split_lib_slice_4_apk.apk, /data/app/falcosc.locus.addon.tasker-2/split_lib_slice_5_apk.apk, /data/app/falcosc.locus.addon.tasker-2/split_lib_slice_6_apk.apk, /data/app/falcosc.locus.addon.tasker-2/split_lib_slice_7_apk.apk, /data/app/falcosc.locus.addon.tasker-2/split_lib_slice_8_apk.apk, /data/app/falcosc.locus.addon.tasker-2/split_lib_slice_9_apk.apk] seinfo=default dataDir=/data/user/0/falcosc.locus.addon.tasker deviceProtectedDataDir=/data/user_de/0/falcosc.locus.addon.tasker credentialProtectedDataDir=/data/user/0/falcosc.locus.addon.tasker enabled=true minSdkVersion=16 targetSdkVersion=27 versionCode=1 supportsRtl=false fullBackupContent=trueThen I try to prepair locus:
- exit locus maps
- force close the process
- start locus maps
- enable GPS NMEA Simulation
- start recording
Nothing happens in my debugger.
But If I do fire the intent over adb, I got a onReceive in my debugger:
am broadcast -a locus.api.android.ACTION_PERIODIC_UPDATE -e test test
I guess there is something missing to tell Locus Maps to send these ACTION_PERIODIC_UPDATE intents.
My broadcast Receiver is as basic as possible
package falcosc.locus.addon.tasker.receivers; public class PeriodicUpdateReceiver extends BroadcastReceiver { @Override public void onReceive(final Context context, Intent intent) { // check intent Logger.logW(TAG, "onReceive(" + context + ", " + intent + ")"); } }
I use Locus Pro and in my classpath I have the locus api android 0.2.24 if this does matter in any way.
What is the difference between PERIODIC_UPDATE intent handling and many manuall calls of ActionTools.getDataUpdateContainer?
After I did look at PeriodicUpdatesFiller I would guess that ActionTools.getDataUpdateContainer blob query and ordered data block read is less expensive then intent handling with hashmap key handling.
What is the difference between PERIODIC_UPDATE intent handling and many manuall calls of ActionTools.getDataUpdateContainer?
After I did look at PeriodicUpdatesFiller I would guess that ActionTools.getDataUpdateContainer blob query and ordered data block read is less expensive then intent handling with hashmap key handling.
Good day Falco,
so you started with Android development? Nice :).
Your code looks correct and should work. The main question here: do you have enabled global settings in Locus Map to send periodic updates in menu > settings > misc > Connect with add-ons? This needs to be enabled.
And difference:
This manual call for update container works correctly for you?
Good day Falco,
so you started with Android development? Nice :).
Your code looks correct and should work. The main question here: do you have enabled global settings in Locus Map to send periodic updates in menu > settings > misc > Connect with add-ons? This needs to be enabled.
And difference:
This manual call for update container works correctly for you?
Thanks I did know about "menu > settings > misc > Connect with add-ons".
But anyway I will go for manual call because this have less overhead and is the new method.
Thanks I did know about "menu > settings > misc > Connect with add-ons".
But anyway I will go for manual call because this have less overhead and is the new method.
Ah oki.
Anyway, this really should work as most of the add-ons use this method. We may debug it if you will need later. Anyway, if you do not need new updateContainer every second, then manual request for a fresh data is better solution.
Ah oki.
Anyway, this really should work as most of the add-ons use this method. We may debug it if you will need later. Anyway, if you do not need new updateContainer every second, then manual request for a fresh data is better solution.
Replies have been locked on this page!