I'm using the Android Maps API v2 in my app "CellViz". One feature of the app is to add lines and polygons to the mobile map in real-time that represent cell signal coverage while the user is collecting data.
There is currently a user-defined parameter (default = 25m) in my app that defines how much distance is covered before a new line and polygon are added. Obviously, the UI can get sluggish when a large amount of lines and polygons are being redrawn.
My problem is that when this sluggishness begins, in terms of number of objects on the map, is heavily hardware-dependent. Therefore, its tough for me to select a single default value for the distance parameter that both performs well on low-end devices while still making the feature useful on high-end devices by showing a reasonable amount of info on the map.
I have settings in the app where you can uncheck "Show Mobile Polygon History" and "Show Mobile Line History", and when these settings are turned off, the sluggishness goes away - so the slowdown is definitely caused by the number of objects being drawn on the map.
I'd like to be able to programmatically detect when the UI thread is having issues keeping up, so I can either auto-adjust the distance parameter to a larger value (mainly useful for future executions), or simply remove some or all of these objects from the map when they become a problem on low-end devices.
Any idea how I can programmatically detect this sluggishness on the UI thread due to objects being drawn on the map?