- Home /
Question by
dmpitu · Feb 27, 2018 at 02:08 AM ·
c#coordinatesmapsintent
Launch Google maps app from unity csharp with intent and coordenates
Hello. I can`t find the solution about how to implement the coordenates in the intent to launch google maps (android app) with some coordenates includes.
With this method launch Google Maps app in the android smartphone. But how to add coordenates?? I read about extraData or androidManifest or putExtra but all in Java and I dont know how to implement a solution in csharp to include the coordenates in the intent of this method.
The method (take of this)
public void abrirGoogleMaps(){
AndroidJavaClass up = new AndroidJavaClass ("com.unity3d.player.UnityPlayer");
AndroidJavaObject ca = up.GetStatic<AndroidJavaObject> ("currentActivity");
AndroidJavaObject packageManager = ca.Call<AndroidJavaObject> ("getPackageManager");
AndroidJavaObject launchIntent = null;
try {
launchIntent = packageManager.Call<AndroidJavaObject> ("getLaunchIntentForPackage", bundleId);
} catch (System.Exception e) {
fail = true;
}
if (fail) { //open app in store
Application.OpenURL ("https://play.google.com/store/apps/details?id=com.google.android.apps.maps");
} else {//open the app
ca.Call ("startActivity", launchIntent);
up.Dispose ();
ca.Dispose ();
packageManager.Dispose ();
launchIntent.Dispose ();
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612153532im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Move a whole enemy object to a new point 1 Answer
[Augmented reality] Change object in different Coordinates system? 1 Answer