2

I am trying to make an android application, with a button I call google navigation and it works correctly, and my question is: somehow I can close the navigation of google once finished and return to my application?

I do not want to press the back button.

This is the method

Uri gmmIntentUri = Uri.parse("google.navigation:q="+ lat + ","+ lng + ");
            Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
            mapIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK&Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
            mapIntent.setClassName("com.google.android.apps.maps","com.google.android.maps.MapsActivity");
            startActivity(mapIntent);
Paul Quito
  • 45
  • 4

1 Answers1

1

If any application can close other applications then there will be a big question about security.

There is no way to close other applications in Android. Also, you can't get a callback once the navigation finished. I have also faced the same issue and resolved it by ChatHead. When the user taps on ChatHead you can redirect the user to your app.

Here is a reference to create ChatHead: https://medium.com/@kevalpatel2106/create-chat-heads-like-facebook-messenger-32f7f1a62064

Bhuvanesh BS
  • 13,474
  • 12
  • 40
  • 66
  • You can find close application using app id. But it won't work. I tried and finally got the answer there is no way to close other apps. Try and post if you really resolved it. – Bhuvanesh BS Sep 07 '17 at 16:42
  • I implemented it in my application and it worked correctly, although the optimum would have been that once the navigation was completed, the navigation was closed and my application was opened, but it was a good solution and thanks. – Paul Quito Sep 07 '17 at 23:38