Paul Quito
Paul Quito

Reputation: 45

Close intent to navigate google and return to my application

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);

Upvotes: 2

Views: 556

Answers (1)

Bhuvanesh BS
Bhuvanesh BS

Reputation: 13617

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

Upvotes: 1

Related Questions