You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the opened issues and there are no duplicates
Describe the bug
Faced a problem while building a mobile app for android 14 (redmi note 11E pro). Does not give permissions for geolocation via request_permission()
I noticed that in Windows 11 everything works correctly, but in android the popup window that should ask for geolocation permissions does not come out.
I also had to downgrade Flutter version to Flutter 3.24.3 because of incompatibility and constant errors.
Who knows how to solve this problem?
Code sample
import flet as ft
async def main(page: ft.Page):
page.scroll = ft.ScrollMode.ADAPTIVE
page.appbar = ft.AppBar(title=ft.Text("Geolocator Tests"))
def handle_position_change(e):
page.add(ft.Text(f"New position: {e.latitude} {e.longitude}"))
gl = ft.Geolocator(
location_settings=ft.GeolocatorSettings(
accuracy=ft.GeolocatorPositionAccuracy.LOW
),
on_position_change=handle_position_change,
on_error=lambda e: page.add(ft.Text(f"Error: {e.data}")),
)
page.overlay.append(gl)
settings_dlg = lambda handler: ft.AlertDialog(
adaptive=True,
title=ft.Text("Opening Location Settings..."),
content=ft.Text(
"You are about to be redirected to the location/app settings. "
"Please locate this app and grant it location permissions."
),
actions=[ft.TextButton(text="Take me there", on_click=handler)],
actions_alignment=ft.MainAxisAlignment.CENTER,
)
async def handle_permission_request(e):
p = await gl.request_permission_async(wait_timeout=60)
page.add(ft.Text(f"request_permission: {p}"))
async def handle_get_permission_status(e):
p = await gl.get_permission_status_async()
page.add(ft.Text(f"get_permission_status: {p}"))
async def handle_get_current_position(e):
p = await gl.get_current_position_async()
page.add(ft.Text(f"get_current_position: ({p.latitude}, {p.longitude})"))
async def handle_get_last_known_position(e):
p = await gl.get_last_known_position_async()
page.add(ft.Text(f"get_last_known_position: ({p.latitude}, {p.longitude})"))
async def handle_location_service_enabled(e):
p = await gl.is_location_service_enabled_async()
page.add(ft.Text(f"is_location_service_enabled: {p}"))
async def handle_open_location_settings(e):
p = await gl.open_location_settings_async()
page.close(location_settings_dlg)
page.add(ft.Text(f"open_location_settings: {p}"))
async def handle_open_app_settings(e):
p = await gl.open_app_settings_async()
page.close(app_settings_dlg)
page.add(ft.Text(f"open_app_settings: {p}"))
location_settings_dlg = settings_dlg(handle_open_location_settings)
app_settings_dlg = settings_dlg(handle_open_app_settings)
page.add(
ft.Row(
wrap=True,
controls=[
ft.OutlinedButton(
"Request Permission",
on_click=handle_permission_request,
),
ft.OutlinedButton(
"Get Permission Status",
on_click=handle_get_permission_status,
),
ft.OutlinedButton(
"Get Current Position",
on_click=handle_get_current_position,
),
ft.OutlinedButton(
"Get Last Known Position",
visible=False if page.web else True,
on_click=handle_get_last_known_position,
),
ft.OutlinedButton(
"Is Location Service Enabled",
on_click=handle_location_service_enabled,
),
ft.OutlinedButton(
"Open Location Settings",
visible=False if page.web else True,
on_click=lambda e: page.open(location_settings_dlg),
),
ft.OutlinedButton(
"Open App Settings",
visible=False if page.web else True,
on_click=lambda e: page.open(app_settings_dlg),
),
],
)
)
ft.app(main)
To reproduce
flet build apk --include-packages flet_geolocator
Expected behavior
When you click on the geolocation authorization button, a pop-up window will appear requesting geolocation authorization. An example is shown in the photo
Screenshots / Videos
video_2025-01-11_04-28-51.mp4
Operating System
Windows
Operating system details
android 14.0.6
Flet version
0.25.0
Regression
I'm not sure / I don't know
Suggestions
No response
Logs
flet build apk --include-packages flet_geolocator
Installing flet-cli 0.25.0 package...OK
[18:37:17] Created Flutter bootstrap project from gh:flet-dev/flet-build-template with ref 0.25.0 ✅
Customized app icons and splash images ✅
[18:37:38] Generated app icons ✅
[18:37:45] Generated splash screens ✅
[18:39:07] Packaged Python app ✅
[18:41:35] Built .apk for Android ✅
Copied build to build\apk directory ✅
Successfully built your .apk for Android! 🥳 Find it in build\apk directory. 📁
Additional details
I also tried changing the version of Flet from the newest to older versions where geolocation permissions are supported, but it doesn't help. I tried different android emulators and different android versions and it doesn't work either.
The text was updated successfully, but these errors were encountered:
Duplicate Check
Describe the bug
Faced a problem while building a mobile app for android 14 (redmi note 11E pro). Does not give permissions for geolocation via request_permission()
I noticed that in Windows 11 everything works correctly, but in android the popup window that should ask for geolocation permissions does not come out.
I also had to downgrade Flutter version to Flutter 3.24.3 because of incompatibility and constant errors.
Who knows how to solve this problem?
Code sample
To reproduce
flet build apk --include-packages flet_geolocator
Expected behavior
When you click on the geolocation authorization button, a pop-up window will appear requesting geolocation authorization. An example is shown in the photo
Screenshots / Videos
video_2025-01-11_04-28-51.mp4
Operating System
Windows
Operating system details
android 14.0.6
Flet version
0.25.0
Regression
I'm not sure / I don't know
Suggestions
No response
Logs
Additional details
I also tried changing the version of Flet from the newest to older versions where geolocation permissions are supported, but it doesn't help. I tried different android emulators and different android versions and it doesn't work either.
The text was updated successfully, but these errors were encountered: