I need to pass info into my Unity/Android game (apk) It is being started from a webpage link via intent-filter. The game (or just a dummy app for now), is being started by a link: <a href="myapp://i_need_this_data_in_the_game">click</a>
If you can help, send me a private message and we can work out the details. -eric
I would guess you need a plugin that does getIntent().getData() for your app
Awesome. I was beginning to think the same thing. I guess I was hoping for something more “out of the box”, but I believe your suggestion would be much more road-worthy. Thank you Agent!
After much work and head scratching, I have finally figured this out. In a nutshell what I had to do was this:
- Incorporate my Unity game with Eclipse
- Set up the proper “” in the AndroidManifest.xml inside my Java project
- Grab the intent from within my Java project, along the same lines as Agent_007 pointed out above. However, I used:
protected void onCreate(Bundle savedInstanceState)
.....
Intent intent = getIntent();
String intentData = intent.getDataString();
.....
- Send the resulting string back to Unity:
UnityPlayer.UnitySendMessage("GameObject", "functionName", intentData );
- Then, back in Unity, strip out the unnecessary parts of the intentData string.
Now, whenever I update my game, it is a simple copy of the assets folder content into my assets folder in the Java (app) project.
Result, If the player has my game installed, it can be launched directly from a webpage link with all the necessary parameters. 