UniqueNickname
UniqueNickname

Reputation: 24

universal linking (deeplinking) for unity IOS

Has anyone worked with unity deeplinking. I am following all the documentation and able to trigger the application using urlschemes or universal links. But my unity application is not able to receive the intents.

I even tried Application.absoluteurl but it still returns empty.

Some help here please.

Upvotes: 0

Views: 3790

Answers (2)

UniqueNickname
UniqueNickname

Reputation: 24

In Unity 2019.3 they have introduced Application.deepLinkingActivated and Application.AbsoluteURL which check if the app is opened using deeplink. The problem i had was a null exception. Once that was cleared the app worked.

Thanks for the suggestion guys.

Upvotes: 1

Apps Maven
Apps Maven

Reputation: 1420

What you need to do is enter the application’s URL which need to open from your app in info.plist under URLSchemes.

url.scheme = “com.myApp”
url.host = “profile”
parameters = [ “user” : “Joy” ]

Then In appDelegate add this code:

func application(_ app: UIApplication, open url: URL,   
options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
if let scheme = url.scheme,
scheme.localizedCaseInsensitiveCompare("com.myApp") == .orderedSame,
let view = url.host {

var parameters: [String: String] = [ : ]
URLComponents(url: url, resolvingAgainstBaseURL: false)?.queryItems?.forEach {
parameters[$0.name] = $0.value
}

redirect(to: view, with: parameters)
}
return true
}

Upvotes: 0

Related Questions