1

I'm trying to introduce a deeplinking in my application. This is the process:

  • Open the Android app
  • Click a button
  • Button opens a chrome custom tab with specific url
  • Chrome browser shows a form
  • When you submit the form, you redirect to payment page (payment page url is something like that xyz.com/objetId?callbackUrl=encodedCharacters) When I am redirected to this payment url, I want to go back to a different activity for the same Android app. Because for this url there is a webView intent. I want to show it in the app.

I tried to add intent-filters for deeplinking. When I submit to form still, I'm staying in the chrome custom tab. (I mean in the browser) But I want to go back to app.

Is it possible?

sbb
  • 529
  • 3
  • 25

2 Answers2

1

Basically you need to listen for submit action in webview by using java script interfaces. Webview has addJavascriptInterface method to do that. Android documentation here Binding JavaScript code to Android code and the examples example_1 example_2

Fatih Santalu
  • 4,641
  • 2
  • 17
  • 34
  • Thanks for the reply. But I want to got to Android app, after chrome tabs. When I open a specific link in chrome tabs, I want to open my app with this specific link (webview). How can I listen submit action in webview in that case? – sbb Aug 14 '17 at 07:18
  • I added my solution. But thanks anyway, I didn't know this part. Good to know. – sbb Aug 14 '17 at 16:02
  • Hi, I think i misunderstood your problem. I thought you open browser inside of your application. Yeah you basically wanted to open your app from url [link](https://developer.android.com/training/app-links/deep-linking.html) – Fatih Santalu Aug 14 '17 at 16:07
1

I solved my problem with custom scheme in AndroidManifest.xml

<data android:host="backToApplication"
android:scheme="someSchemeLikeHttp"/>

I was using https as scheme but for links, default application is default browser in the phone. I changed the schema and I'm sending my schema and host in the url callback like

?callback_url=someSchemeLikeHttp://backToApplication

Now it's working for me.

sbb
  • 529
  • 3
  • 25