- Home /
The question is answered, right answer was accepted
accessing custom url parameters on android
Im looking for some way to access data passed with custom uri in unity script (like scheme://myapp?data1=xxx&data2=yyy). Is there anything similiar to Application.srcValue that is working on Android?
Answer by mkielczyk · Apr 08, 2013 at 02:06 PM
Since no one answered my question, i found answer by my own and wrote little plugin holding whole uri in static var. Suprisingly its working very well.
can you please post/explain your solution? how do you create a custom url scheme for a unity application? how do you handle it?
Right, this answer doesn't really answer the question for the community, thus it's not really an answer to the question.
However mkielczyk was last seen 9 days ago, so it's unlikely to get a response any time soon.
creating custom url scheme is simple. you must add just 1 line to your manifest, where activity you want to belanched is defined, like in this example.
android:scheme parameter defines your protocol name (above is http, but you probably want ur own, unique name). you can skip android:host part, then you get nice and short custom url scheme like: launchmyapp://?parameters by adding just one simple line with
<data android:scheme="laynchmyapp" />
in activity you wisch to start with it.
getting parameters from unity is bit harder. u must write plugin extending unityplayeractivity (tutorial)
from plugin u can access full starting url and expose it as static member that can be accessed from unity script
Thanks.
Anyway, while it seem simple, it took me a while to put all the pieces together. For anybody interested, here's a comprehensive guide I wrote: Serverless Authentication with Instagram
@bahenni: Thanks for your post, I'm sure it will be helpful for others.
Follow this Question
Related Questions
How to open the game on an android device using a URL? 0 Answers
How to read URL parameters from Unity WebGL Build 4 Answers
How to get Updated Context in Unity3D Android when app is open from Backgroung? 1 Answer
Open another app with intent url on Android 1 Answer
Openning deep link to a Facebook Messenger on Android 1 Answer