azavea / cac-tripplanner-android

GoPhillyGo Android app
https://gophillygo.org
Apache License 2.0
3 stars 3 forks source link

Finish Android SDK 31 Upgrade #216

Closed ddohler closed 1 year ago

ddohler commented 1 year ago

Overview

We need to target at least Android SDK 31 in order to remain on the Play Store past August 31. The start of this work was completed in https://github.com/azavea/cac-tripplanner-android/pull/210 but there were still some outstanding issues that needed to be addressed. This addresses some of them, but not all (see notes, below).

Demo

Screenshot from 2023-07-26 12-06-03

Notes

There were a number of issues identified in #209 . Here's a list of the resolutions of each one:

Some of the linting issues point to the deprecation of AsyncTask. Some quick Googling suggests there is no 1-to-1 replacement for this, so we should learn a bit more about fixing these would entail and if it's worth the effort to address this right now.

There are a lot of these spots and AsyncTask has just been deprecated, not removed, so we should punt until we're less time-crunched. I opened https://github.com/azavea/cac-tripplanner-android/issues/213 for this.

We use features that are deprecated in Gradle v8, so we should decide whether those features are worth updating to upgrade our version of Gradle.

We should upgrade eventually but don't need to now because Gradle's maintenance support extends back one major version. In other words, Gradle 7 will only receive support until Gradle 9 is released, but if we're on Gradle 8 then we'll have support until Gradle 10. I opened https://github.com/azavea/cac-tripplanner-android/issues/214 for this.

We have been seeing E/RecyclerView: No adapter attached; skipping layout and E/PlacesList: image view not found; not setting up scroll listener errors for the last couple of versions. Is there an easy fix for this or can it be fixed by a dependency upgrade?

I did some research on this and my best understanding is that this seems like it could be from calling setAdapter() inside of an asynchronous callback: https://stackoverflow.com/questions/29141729/recyclerview-no-adapter-attached-skipping-layout . It mostly doesn't seem to hurt anything (although I think it might cause some images to be blank when they scroll into view), and we're going to have to rework the asynchronous code soon anyway, so I think it's best to punt on this for the time being. I opened https://github.com/azavea/cac-tripplanner-android/issues/215 to address this.

E/libprocessgroup: set_timerslack_ns write failed: Operation not permitted errors appear on API level 28+ following issue #201. To replicate, go to the "places" map view, select an event from the map, or select filter on the map view. These errors appear to be related to the dialogue boxes and map.

I was able to replicate this, but the only discussion I was able to find online indicated that it happens when displaying a dialog over the map (which we do) and that the only solution is to avoid doing that, which would be more effort than we have time for. Luckily, it doesn't seem to harm anything so I think we can safely ignore this.

Google's pre-launch report from releasing the app to testing resulted in the following error java.lang.IllegalStateException: android.os.ServiceManager$ServiceNotFoundException: No service published for: search. We should figure out how to replicate and address this issue.

I wasn't able to replicate this but it seems like there's only one spot in the code that could throw this exception, so I wrapped it in a try/catch and hopefully that'll do the trick.

API level 31 added the ability to share approximate location instead of precise location. The app works if you only share approximate location, but you'll continue to see permissions pop ups and toast messages. We should try to find and fix whatever is checking again and again for precise location and update it to accept approximate location.

I changed the permission checking logic so that it works with either precise or approximate location.

One final note is that SDK is the minimum version to remain on the Play Store, but in order to publish updates we need to target at least SDK 33. We should start on the SDK 33 upgrade as soon as SDK 31 is published.

Testing Instructions

Closes #209

ddohler commented 1 year ago

Thanks for reviewing @rachelekm !