I need help with my science fair project (track a mosquito spraying truck in real time using CloudDB)

I am making 2 apps to track a mosquito spray truck. The first one will be in the truck transmitting its longitude and latitude to the Cloud DB.


Then this one should zoom to your location and then get the longitude and latitude from Cloud DB and display it as a marker on their screen.

When I get my location it puts me in the ocean of the coast of Africa for some reason but I need to click it a bunch of times like spam clicking for it to get my actual lovation and it doesn't display the marker. If anyone can help me debug it that would be amazing.

Try using CentreToString instead of PanTo.

also,

Rely on the LocationChanged event. Using Button1.Click does not take into account the time needed for the sensor to get a location. You may also need to be outside to get a location.

Your tracking app should not need the location sensor, unless you want to calculate how close the mosquito spray truck is to your location (cough, cough).

You need a Button or a Clock Timer to ask CloudDB for its truck location info.
Posting the lat and long under separate CloudDB tags makes life harder for you on the receiving end of CloudDB inquiries.
Instead of posting them separately to different CloudDB tags, make a list (lat,long) and post that to a single CloudDB tag. That way, the two vakues will arrive together. (Maybe use a dictionary {"lat":nnnn,"long":nnnn} if you don't want the burden of remembering the order lat,long)

In your CloudDb GotValue event, you need to test the tag to see what arrived, before deciding what to do with the data (build a map marker and hang some data off it.)

Don't do another CloudDB GetData in the GotValue event. CloudDB does not like to be pestered.

Your CloudDB value procedure is pure fiction.
Learn about local variables, procedure parameters in the free book
http://www.appinventor.org/book2

1 Like

This tutorial shows how to track a bus using the CloudDB; it can be adapted for your mosquito spray truck John.

You are seeing the default location of the LocationSensor (0,0) it happens because you have not provided sufficient time for the location to post.

Hope this stuff helps.

Steve