- Home /
Unity plugins and main activity question.
Hi,
I am learning Unity for Android. I created a plugin that calls ACTION_VIEW intent. Here is the plugin function:
public void ViewURI(Activity ca, String aURI)
{
Log.i("Unity", "Hi, View URI");
try {
Log.i("Unity", aURI);
final Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(aURI));
ca.startActivity(intent);
}
catch (Exception ex) {
Log.i("Unity", "Exception: " + ex);
}
}
From Unity I am calling ViewURI
and the ca
Activity is the current activity that I grab this way.
AndroidJavaClass up = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject ca = up.GetStatic<AndroidJavaObject>("currentActivity");
I would like to understand if it is possible for the plugin to have the current activity even without passing it from Unity.
Comment
Your answer
Follow this Question
Related Questions
Android plugins add View 1 Answer
Call function From JAR Lib ? 3 Answers