Greetings!
I used "LocationSensor1" and "LineString2" to calculate the distance
And in the same block of the "LocationSensor1.LocationChanged" event, another "LineString1" draws the traversed path.
Everything is working!
Maybe someone will find it useful!
P.S. I forgot to say that to trigger the "LocationChanged" event, I used the setting βevery 10 metersβ. So as not to write coordinates often.
is there a latest version?
The latest version currently is version 4b and as usual you can find it in the download folder, see also the documentation at App Inventor Extensions: Location Service | Pura Vida Apps
Taifun
I've downloaded it.
Thank You
It is still some scary area to use LocationSensor for my coding level. I keep this comment when I'm ready to re-try to fix the problem I posted. sorry for no response to your comment.
Version 5 now has been released
New in Version 5: Itoo integration
Thank you @Kumaraswamy for this amazing framework!
Now we can execute almost any logic in the background (no user interface components) after an location changed event occurred in the background. Please be aware, that there is no user interface available in the background.
This is the new OnLocationChanged event handler, which looks like a procedure.
The event handler will be called from Itoo from the background after a location changed event occurred.
You will have to create the procedure using the name OnLocationChanged.
Also that procedure must have 7 arguments, else it will not work. Note: This background event handler also will be called if the app is in the foreground.
Now we can execute almost any logic in the background (no user interface components) after a location changed event occurred.
Please be aware, that there is no user interface available in the background.
Some example blocks to send location data to a MySQL database in the background
See the complete documentation on my webpage here App Inventor Extensions: Location Service | Pura Vida Apps
Taifun
currently not, but it looks like an option to deactivate this would be a good idea... I will add it soon...
Taifun
I now added a new property NotificationTextLocked, just set it to true to get the constant notification text.
you can download version 5a of the extension from the Download folder
Taifun
I'm not familiar with that extension
General advice is to get it running first in the foreground
And concerning background, add Notifier LogInfo methods for debugging and use logcat to find out what's going on
What is the ConnectionState in the background? Can it be different, if that extension is not running in the background? You probably need itoo to get that extension running in the background first
Taifun
Iβm working on an app that records GPS coordinates to TinyDB every 10 seconds. The issue Iβm encountering happens during extended use β specifically when the app runs for around 8 hours a day, with a break from 11:30 AM to 12:00 noon. At some point, an error appears and the location service stops saving data to TinyDB.
Has anyone encountered a similar issue or knows how to prevent this? Any help would be appreciated. Thank you and God bless!
Try the example project as test to find out, if there is some kind of error in your blocks
Generally it's a challenge to find out what might have happened
Do you have sufficient disc space on your device?
Which devixe/Android version are you using for your tests?
Did you try another device?
How do you stop the app at 11:30am? Manually? How do you reatart it again?
Taifun
Possible cause:
Power saving options on the phone put the app to sleep
TinyDB logs need to be sharded to different namespaces, one per day because of volume
I already tried your sample project. No error displays.
Yes, the phone has enough storage.
I am using Doogee S96 GT, a rugged phone. Android version is 12.
Other devices did not experience the same thing. Based on my observation, the error displays when the phone is too hot and the phone is in idle for a few minutes.
I manually stop the app during break time and resume after break time. To fix the error, I manually restart the phone. Is there any other way to stop the error from displaying?
Thank you and God bless.
I checked the phone, battery saver option was disabled. I am really confuse what might be the cause of the error. Is it the app itself or the phone since it only happens when the battery is too hot and the app is in idle mode for few minutes.
Can you connect your device to a portable power bank, to reduce strain on its battery and reduce heat?
Unfortunately, I don't have a power bank, and I'm not planning to buy one just for this app β but I appreciate your suggestion. I'll try this approach if it solves the problem.
I asked Gemini and below is the answer
Taifun
It's frustrating when a rugged phone, designed for durability, still succumbs to overheating issues! Your observations about the Doogee S96 GT, Android 12, and the app crashing when hot and idle are key. This strongly suggests a thermal throttling issue, where the phone's system automatically reduces performance (or even shuts down apps) to prevent damage from excessive heat.
Since other devices don't experience this, it points to either a specific characteristic of your Doogee S96 GT or how the app interacts with its hardware and thermal management.
Here's a breakdown of potential causes and ways to address this, without manually restarting the phone every time:
Understanding Why It's Happening (Thermal Throttling):
-
Processor (SoC) Type: Doogee phones often use MediaTek processors. Some MediaTek chips, especially in rugged devices that may not have as robust cooling as flagship phones, are known to be more prone to overheating under sustained load.
-
App Intensive Usage: Running an app for 8 hours a day is a significant workload. Even if it seems "idle" to you, it might be performing background tasks, calculations, network requests, or maintaining an active connection that keeps the CPU and GPU working.
-
Heat Dissipation: While rugged phones are durable, their thick casings and protective layers can sometimes trap heat, making dissipation less efficient than on slimmer, more ventilated phones.
-
Battery Degradation (Less likely if new, but possible): An aging or faulty battery can generate more heat during operation.
-
Software Glitch/Optimization: There might be an issue with how Android 12 or the Doogee firmware handles thermal management, or the app itself might not be optimized for sustained operation on this particular hardware.
Ways to Mitigate and Potentially Stop the Error:
- Optimize the App (If you have control over the app):
-
Reduce Background Activity: If the app is doing heavy processing in the background when "idle," can this be reduced?
-
Polling intervals: Can data refresh rates be extended?
-
Unnecessary computations: Are there parts of the app that are constantly calculating even when not actively used?
-
Network activity: Can network calls be batched or reduced when idle?
-
-
Graphics and Animations: If the app has complex UI or animations running even when "idle," simplify them. Lowering frame rates or using less resource-intensive rendering can help.
-
Resource Management: Ensure the app properly releases resources (like network connections, GPS, camera) when they are not actively needed.
-
Memory Leaks: Long-running apps can sometimes suffer from memory leaks, where memory is allocated but never released, leading to increased resource usage and heat. This would require proper debugging by the app developer.
-
Developer Tools: If you are the app developer, use Android Profiler in Android Studio to monitor CPU, memory, and network usage over extended periods to identify bottlenecks.
- Optimize Phone Usage and Environment:
-
Remove the Phone Case (Temporarily for testing): If you're using an additional protective case on top of the phone's rugged design, it might be trapping heat. Try running the app for a period without any extra case to see if it helps.
-
Improve Airflow:
- Ensure the phone isn't placed on soft surfaces (like blankets or pillows) that can block vents or trap heat.
- If possible, place the phone in an upright position or on a stand that allows air to circulate around it.
- Avoid direct sunlight or hot environments while the app is running.
-
Reduce Screen Brightness: A brighter screen consumes more power and generates more heat.
-
Close Unnecessary Background Apps: Even if your main app is in focus, other background apps can consume resources and contribute to overall heat. Regularly clear recent apps.
-
Disable Unused Features: Turn off Wi-Fi, Bluetooth, GPS, NFC, etc., if they are not actively needed by the app or for phone functionality.
-
Use Battery Saver Mode: While this might slightly impact performance, it can help reduce CPU/GPU activity and thus heat generation.
-
Avoid Charging While Using Heavily: Charging a phone generates heat. If you're running a demanding app while charging, it significantly increases the thermal load. Try to charge the phone when the app isn't running, or during periods of low usage.
- Software Solutions on the Phone:
-
Update Firmware/Android: Check for any available system updates for your Doogee S96 GT. Doogee might release updates that improve thermal management or optimize performance for Android 12.
- Go to Settings > System > System update.
-
Clear App Cache and Data: For the specific app that's crashing:
- Go to Settings > Apps > See all apps > Find your app.
- Tap Storage & cache > Clear cache. If the problem persists, try Clear storage (be aware this will delete all app data, so back up anything important first).
-
Reinstall the App: Sometimes a fresh installation can resolve corrupt data or installation issues.
-
Factory Reset (Last Resort): If none of the above works and you suspect a deeper software issue, a factory reset might help, but it will erase all your data. Back up everything first!
- External Cooling (Workaround, not a fix):
-
Cooling Fan/Pad: For very specific, stationary use cases, you could consider placing the phone on a small USB-powered cooling fan or a specialized phone cooling pad. This is more of a band-aid than a permanent solution to the underlying thermal issue, but it might keep the app running.
-
Thermal Paste (Advanced, Risky): This is highly discouraged for the average user. Some advanced users might consider replacing the thermal paste on the phone's CPU. This involves disassembling the phone and carries a high risk of damaging the device and voiding the warranty. It's generally only for experienced technicians.
Why restarting helps:
When you restart the phone, you clear all active processes, reset the operating system, and allow the hardware to cool down completely. This temporarily resolves the overheating state and resets any thermal throttling measures that were in place.
Given that your Doogee S96 GT is a rugged phone, its design priorities are protection over ultimate thermal efficiency in prolonged, high-load scenarios. Addressing the root cause (app resource usage and phone cooling) is the best long-term strategy.
I also recommend one of the new fireproof bags for storage of Lithium Ion batteries.
Yours may be headed for rapid unplanned combustion.