Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NavInfoEvent not triggered in android when application is in background/minimized #169

Open
DhirajMakane opened this issue Oct 3, 2024 · 0 comments
Assignees
Labels
status: investigating The issue is under investigation, which is determined to be non-trivial. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@DhirajMakane
Copy link

Hi,
Navinfo event is not triggered when application is in background.

Environment details

google_navigation_flutter: ^0.3.0
Observed for android (Note iOS is working)
Flutter - 3.22.3
Location Permissions are enabled
Permissions added

Steps to reproduce

Set destination and origin.
Open Google Maps for turn-by-turn navigation
Initial self-location and the route are displayed on the map
Be in the app for a few minutes. The nav info events are received.
Now minimize the app -> The nav info events are not triggered

AndroidManifest

Flutter Code Snippet

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_TYPE_LOCATION" />


Future<void> _startNavigation() async {
   // popup for the terms and condition
   if (!await GoogleMapsNavigator.areTermsAccepted()) {
     await GoogleMapsNavigator.showTermsAndConditionsDialog(
       'Sample APP',
       'Sample APP',
     );
   }

   await GoogleMapsNavigator.initializeNavigationSession();
   await _setupListeners();

   /// Simulate location.
   await GoogleMapsNavigator.simulator.setUserLocation(widget.sourceLocation);

// add way points
   var wayPoints = <NavigationWaypoint>[
     NavigationWaypoint.withLatLngTarget(
       title: "destination title",
       target: widget.destinationLocation,
     ),
   ];
   final Destinations msg = Destinations(
       waypoints: wayPoints,
       displayOptions: NavigationDisplayOptions(showDestinationMarkers: true),
       routingOptions:
           RoutingOptions(travelMode: NavigationTravelMode.twoWheeler));

   final NavigationRouteStatus status =
       await GoogleMapsNavigator.setDestinations(msg);

   if (status == NavigationRouteStatus.statusOk) {
     await GoogleMapsNavigator.startGuidance();

     await _navigationViewController
         .followMyLocation(CameraPerspective.tilted);
   }
 }

 // set the nav info listener
 Future<void> _setupListeners() async {
   _navInfoSubscription = GoogleMapsNavigator.setNavInfoListener(
     _onNavInfoEvent,
     numNextStepsToPreview: 10,
   );
 }

 // event listened to update the logs
 void _onNavInfoEvent(
   NavInfoEvent event,
 ) {
   print("nav info event received");
 }

Thanks!

@DhirajMakane DhirajMakane added triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Oct 3, 2024
@jokerttu jokerttu added status: investigating The issue is under investigation, which is determined to be non-trivial. and removed triage me I really want to be triaged. labels Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: investigating The issue is under investigation, which is determined to be non-trivial. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

4 participants