locationSensor & BTclient Interfering?

Better for what?

Regarding the use of the Location speed value, you may find this useful

I remember reading through that some time ago - in the case of this project, the attached and modified example file works, but when grafted into my other app, it doesnt as soon as i connect bt (works otherwise which is weird). the only code associated with the speed sensor in my app im trying to get to work is attached. so perhaps theres something i have missing from one app to the other in locationsensor setup causing me issues.

theres an aia file attached of the functional test app.

as suggested earlier set the provider to gps (after it is available) and then lock the provider
http://ai2.appinventor.mit.edu/reference/components/sensors.html#LocationSensor

AvailableProviders

List of available service providers, such as gps or network. This information is provided as a list and in text form.

ProviderLocked

The device will not change the service provider.

It is possible for a device to switch service providers when the current provider is unable to provide adequate location information. ProviderLocked is a Boolean value: true/false. Set to true to prevent providers from changing. Set to false to allow for automatic switching when necessary.

ProviderName

The current service provider. The provider will most likely be either GPS or network.
Taifun

forgive my ignorance, the further explanation helped here.
im a PLC, fanuc robotic programmer, and controller scripter by day - very much a physical world scenario but on a screen.
with the web and connectivity stuff I'm like on an infant knowledge base level, where it has to be spelled out for me.
appreciate everyones patience.

lock provider
so this is where i have gotten to here. unaltered, available providers reads as (fused passive network fused gps)
if i dont drive it to anything and call provider name, its listed as "fused"
not sure what fused means.

if i drive it to GPS, it says gps (the code blocks).
am i doing the right thing or no?

Dear @Reality_Bytes,
why Speed Accuracy = 0 ?

in my apps I use a different approach
image

In other words: when the location has changed with a meaningful accuracy, I consider also the speed.
Otherwise I skip an input not accurate enough.

1 Like

honestly Im sure I had a reason, like its some sort of workaround for something, but its been so long since I attempted this that i cannot remember.
if i could get it working correctly on this app, im sure it will reveal itself - probably something due to something I experienced on the AIA file I posted above.

could also be a mistake, but being an or function it shouldnt be a hard telemetry block like im experiencing

Sorry but whenever your location sensor accuracy, that you have named GPSSpeed (I guess), is less then 20, also the value = 0 is comprised, therefore is useless to test this equality.
Moreover when the location sensor accuracy is = 0 this means that the location sensor is not giving a right value. With your test ("or") whenever the accuracy is = 0 you consider Lat and Lon valid, when on the contrary, they aren't !

but thats not my issue as it would still show something albiet inaccurate at times. ill say it again - it works until i connect BT, then I get nothing. im sure it was an accident on my part there but after changing it to "and" and "not equal", it didnt fix the issue.
good catch on that one, as its something i should fix, but its not the issue im dealing with

can we address the rest of this though - specifically the (fused passive network fused gps) part and what specifically I should set the provider name to

It does not look like you read @SteveJG 's beautiful explanation?

your blocks to lock the provider look fine... iprobably t takes some time until gps shows up in the AvailableProvider property...
what about doing a test?

Taifun

are you working in battery saving mode ? Sometimes this mode avoids the contemporary use of GPS (at least its high accuracy mode) and the BT, while Google maps raises the power (though it's working in background) by disabling the battery saving mode.

I guess i still dont understand - seems like "fused passive network" and "fused gps" are the options?
I understand what fused means, for sure - previously and as per steve's explanation.
its confusing because "fused" appears twice in the list?

Im worried that me telling it to connect to "gps" is not a correct target since its not an option as per the list?

im not, but I could see that being very much so related in some way.

Don't know if it will help, but have you considered this:

As far as I am aware, html5 geolocation will use whatever location service is available (wifi/data/gps) to return an accurate position

If you use the list to csv rows block together with AvailableProviders and post a Do it result then we knew more...

Make sure to enable GPS...

What do you get 1 minute later?

Taifun

1 Like

What happens when you force the Provider to gps? Do you see the location icon in your title bar? See the attached image. If so, you are using gps. if not, you are probably letting Android decide and using fused

On my Samsung A13, these are the Providers possible.

1 Like

thanks, that really clears a lot up - ill be able to give it a shot this evening and ill be on the lookout for the appropriate icon. I appreciate all the help.
the double fused option had me extremely confused (wow... no pun intended)

also all this really makes sense why setting a google maps destination makes it work - like you all say, its probably literally driving it to the appropriate provider (which probably takes more power and why its not the primary unless forced)
a lot of assumptions there on my part, but I really appreciate the help - making progress is always a relief

so I wanted to follow up with everyone - being a long time automotive tuning forum guy (usually I'm the one answering other peoples questions), its nice when people follow up with the resolution of an issue.

so, that being said - I appreciate everyone's help. The below layout works well and for me and doesnt cause any issues despite being a part of a MUCH larger app that constantly is reading and parsing BT.
response time is immediate, without any delays or hangups - from rural areas to in town.

can what I did be improved upon? surely - but this will get someone rolling with an extremely functional setup from my experience.

speedo works2

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.