fix: prevents infinite recursion when getting the location permission by dkhawk · Pull Request #1813 · googlemaps-samples/android-samples

@dkhawk

The code was repeatedly requesting the access fine location permission in an infinite recursion loop which resulted in the app crashing. This removes the unnecessary call to request the permission in the updateLocationUI method.

@dkhawk

kikoso

import android.widget.FrameLayout;
import android.widget.TextView;

import androidx.activity.result.ActivityResultLauncher;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need those imports?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. Those were added when I looked into using the newer permission request flow, but that requires API 24

@dkhawk

kikoso

@kikoso kikoso left a comment

Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I was able to reproduce the issue on the previous code.

@dkhawk dkhawk deleted the fix-infinite-permission-loop branch

September 19, 2024 18:21

@googlemaps-bot