Sorry, you can't post a project, which includes a paid extension in the community... this is against my t&c...
It looks like you need help with your project and you are in a hurry, so yo are not able to follow the documentation...
Please contact me by mail, send me your project and I can take a look at it... please be ready to transfer a small amount to cover my time for this..
Alternatively post a screenshot of your relevant blocks here...
You really should spend some time to read and understand the documentation and play around with the example project... to do something in the background is working on another level...
you blocks are exactly the same as previously...
you already found out yourself, this will not work like this if the app is in the background
as already mentioned earlier
Also your Clock events will not fire and you will not be able to draw something in the background...
You have to do it like this: while the app is in the background, the location data will be stored in TinyDB... additionally you can send your Post requests in the background to somewhere... as an example see the IFTTT setup... just adjust it to your needs and use the keywords as described in the documentation...
Background web properties
The following properties are used to configure the background web functionality to send a request. The following requerst methods are available: GET, POST, PUT, DELETE, PATCH, HEAD and OPTIONS. Also the background web functionality is able to convert keywords into their correponding values. The following keywords are available: DATETIME, URIENCODEDATETIME, LATITUDE, LONGITUDE, ALTITUDE, ACCURACY, SPEED, CURRENTADDRESS, URIENCODECURRENTADDRESS and PROVIDER
you have to setup the web background functionality before starting the locationservice
Later when you start again your app, then read all the stored data from TinyDB and draw on the map... my example project shows you how to draw all the stored coordinates on the map, see the ListPicker.AfterPicking event there App Inventor Extensions: Location Service | Pura Vida Apps
There should be a blacklist of paid extensions NOT allowed to be posted here. So something like what is already the case when an APK is posted (which is not allowed/possible).
Any app developer who offers paid extensions can enter their extensions in this list.
Ok so I've looked at the example blocks provided and started afresh. this is what I've got so far. My google sheet says it was updated seconds ago so i believe it's trying to post something, but nothing shows up. Please can you tell me what's missing in the simplest way as like I've already mentioned i don't understand the example at
it does not make much sense to set the bckground web property first to false and later to true... only set it to true
use a reasonable value for the distance interval... this property determines the minimum distance interval, in meters, that the sensor will try to use for sending out location updates... 0 does not make sense... try to first use the default value of 5... and after you got it running, then later you can adjust it to your needs...
as general recommendation to test your POST method: as test use the web component to send some test values to your Google spreadsheet to find out the correct blocks for the POST method... after you got this working then setup the background web functionality accordingly...
Thank you, I've tried the above suggestions and it doesn't work. The app goes to start the background process then closes, it says the app closed due to a bug. Any ideas?
we already talked about clocks... it is not a good idea to start the locationservice several times... in the latest screnshot you are using again clock components... Clock_In starts Clock2... My guess is, Clock2 will be started again and again by Clock_In... repeatedly starting the locationservice might be an issue... let me suggest you to start it only once... my suggestion is to move all the setup blocks into the Screen.Initialize event and use a button to start the service
it would be wise to use the ErrorOccurred event and display any errors for example in a label... see also Q2 here App Inventor Extensions: Location Service | Pura Vida Apps as test disable the MoveTaskToBackground methods to find out if there are any errors reported
as general recommendation to test your POST method: as test use the web component to send some test values to your Google spreadsheet to find out the correct blocks for the POST method... did you get this running successfully? can you show the blocks for this test?
the Web.Post method inside the LocationChanged event does not make sense... if the blocks were correct (they are not, because only the locationservice in the background is able to convert the keywords), you would post the information twice to your Spreadsheet, first from the extension running in the background and then again in the LocationChanged event... just remove the PostText block completely
to get more information about the runtime error you are experiencing, use logcat and post the logcat report as text file here, see also Capturing Device Logs using adb logcat
Hi Taiifun as mentioned my app uses a geofence that once you leave the fence and return to it, it will post to my Google sheet, I call procedures to only post once to the sheet instead of multiple times and to reduce the amount of blocks in location changed event. I was wondering if this logic can be done in the background.
Thank you guys for all the help. I've got my app to post to my Google sheet whilst maintaining my apps purpose. The error was with the Google script.
unfortunately this is not possible using the locationservice extension, but what about a server solution? You could write a Google Apps Script to delete the rows from the spreadsheet you do not want using some logic...
It calculates distance (miles) between your present coordinates and a destination(lat2,long2). It is sort of a geofence. When you approach a destination it posts distance to that location as you get closer. I tested this and it works to post the accuracy and the distance.
If you modify add a script to your spread sheet, you might be able to only post when the distance is less than 1 mile. Another idea is to RequestMethod immediately preceding the RequestText (I haven't tried this).
Remember, the LocationChanged event of the extension only fires if the app is NOT in the background...
also the setup (for example setup of the RequestText) needs to be done before starting the service...
but you could use the formula from Steve and calculate the distance in the spreadsheet after passing the current lat and long... the destination lat and long could be provided for example as variable in the Google Apps Script
I'm using mysql, but I want only one data to be entered into mysql database and use the UPDATE code block to change that data automatically with location change.
how do?
Your blocks look fine...
As test you can use the web component to find out, if your update statement works fine
Also you might want to use Do it to debug your query to find out, if the number is correct...
And while using the extension it helps to use the ErrorOccurred event to display any errors in a label just in case