271
Views
5
Comments
Solved
Deeplink now working with specific screen and input parameters
Question

Hi,

I am trying to launch the OutSystems mobile application from another third party application(built in Native Android) on Android device. I want to open a specific screen which is default screen of my application and has anonymous access. This screen has an input parameter. When I am trying to launch the application from native application with input parameter, nothing happens meaning I am not redirected to my OutSystems app. However, if I remove the input parameters, my OutSystems app gets launched. Here is what I am trying to do in Android code:


val pm = applicationContext.packageManager
        val intent:intent? = pm.getLaunchIntentForPackage("appidentifier://MyModule/DefaultScreen?ClientId=1234")
        intent?.addCategory(Intent.CATEGORY_LAUNCHER)
        if(intent!=null){
            applicationContext.startActivity(intent)
        }else{
            println("Intent is null.")
        }

I am getting Intent in null. if I use the parameter ClientId=1234, If I don't use it it works fine.


Can someone help me here and suggest if I am doing anything wrong here?

2023-01-04 05-10-52
Akshay Puri
Solution

You should try to run the application with high speed internet just in case it's related to caching all the files not being processed in given time while switching between the applications. Also check if you can trace any native logs through xcode by connecting your device.

2019-06-15 21-39-22
Afonso Carvalho
 
MVP

Hi Akshay,

I haven't done native Android in a couple of years, but have you tried passing those inputs outside of the link, and within the intent? With this syntax:

https://stackoverflow.com/questions/2405120/how-to-start-an-intent-by-passing-some-parameters-to-it/

UserImage.jpg
Sach

Thanks Afonso. How should I read them in OutSystems app?

2019-06-15 21-39-22
Afonso Carvalho
 
MVP

I don't think there's any Outsystems functionality out-of-the-box for capturing Intents, you'd have to find or build a Cordova plugin that would allow you to read the Intent parameters.

I was looking at the deep link documentation and your format looks correct:

https://success.outsystems.com/Documentation/Development_FAQs/How_to_Define_Mobile_App_Deep_Links

Could it be an escaping issue with the question mark/equal sign?

UserImage.jpg
Sach

This is working for Android now with following code:

val packageName = "iappIdentifier"
val context = getActivity()
val pm = context!!.packageManager

val myAction = Uri.parse(“appIdentifier://Module/Screen?UserName=username&Password=password”)
val intent: Intent? = pm.getLaunchIntentForPackage(packageName)

if(intent!=null){
    intent!!.setAction(Intent.ACTION_VIEW)
    intent!!.setData(myAction)
    context!!.startActivity(intent)
}else{
    Toast.makeText(activity!!, "Please install the App", Toast.LENGTH_SHORT).show()
}

But I am struggling to get this working for iOS. Here is the code I am trying:


UIApplication.shared.open(URL.init(string: url)!, options: [:], completionHandler: nil)
let url = "“appIdentifier://MyModule/DefaultScreen?ClientId=1234"
UIApplication.shared.open(URL.init(string: url)!, options: [:], completionHandler: nil)


Has anyone faced this and can help me resolve?


Thank you.

2023-01-04 05-10-52
Akshay Puri
Solution

You should try to run the application with high speed internet just in case it's related to caching all the files not being processed in given time while switching between the applications. Also check if you can trace any native logs through xcode by connecting your device.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.