

One app that can handle the intent and it's safe to call startActivity(). If the result is non-null, there is at least To first verify thatĪn app exists to receive the intent, call resolveActivity() on your Intent object. Receive the implicit intent, your app will crash when it calls startActivity(). Section also shows how you can create an intentįilter to advertise your app's ability to perform the same action.Ĭaution: If there are no apps on the device that can This page describes several implicit intents that you can use to performĬommon actions, organized by the type of app that handles the intent. That can handle the intent, the system presents the user with a dialog to The intent to an app that can handle the intent and starts itsĬorresponding Activity. Or startActivityForResult() and pass it an implicit intent, the system Some data with which to perform the action. Is called an implicit intent because it does not specify the appĬomponent to start, but instead specifies an action and provides Simple action you'd like to perform (such as "view a map" or "take a We'll also need to grab the intent and save the data so it can be accessed by Unity.An intent allows you to start an activity in another app by describing a You can find an example of this here link. To use a custom class, we need to extend UnityPlayerActivity and grab the Intent extra that we're passing in.

Right click in the Project panel (found on the left)Ĭlick - (at the top left) and remove module Create an Activity classĪ Unity android app uses UnityPlayerActivity as the main activity class when launching.

Select the sdk you want to use and click NextĪdd the library name you wish to use (I used Plugin)įilename: /Applications/Unity/PlaybackEngines/AndroidPlayer/Variations/mono/Release/Classes/classes.jar Open Android Studio Create Android Studio project Steps for creating the plugin from scratch (NB I'm using a Mac.) Now save the file and we'll create the plugin. Make sure to change the package name to match the bundle identifier in the project settings. You can find an example xml file here link Steps for creating the Unity ProjectĬreate the android plugin directory (Assets/Plugins/Android)Ĭreate a new xml file called AndroidManifest.xml in the Android folder (this is important- anywhere else and Unity won't pick it up). This is a stripped down version of that project - I hope someone finds it useful! Setupĭownload and install Android Studio and make sure you have the sdk installed - take a look in the SDK manager (you can launch this via android studio) and make sure you have the build and sdk tools. Recently I've been working on a project that required a unity app to be launched via an intent with a piece of data attached (an Intent 'extra'). Intents are a great way to pass information between apps on an android device. Launch Unity app using Android Intents Intro
