5

overflow community,

We're developing deep-link functionality for an app, and came across a problem with the in-app messages functionality of facebook push messages.

We're trying to send a deep link associated to a button of the in-app message, but when the users clicks such button, what the app does, is to open such url on the browser.

Facebook in-app example

What we need, is to be able to capture such action an parse the sent URL (http://example.com/product?id=1234), however, we can't seem to find a way to do so.

We need to do this for iOS and Android, but as long as we can solve the problem for at least one platform, we could figure it out for the other.

BernalCarlos
  • 936
  • 3
  • 12
  • 25
  • 1
    Could you please add a bit more context? How does Facebook fit in, who's sending the link, and who's opening the link? Is the problem basically that your app does not get opened by a certain URL when it should? – Daniel Jul 19 '18 at 14:58
  • Hi @Dopapp, we're using facebooks analytics and push notifications feature to send push messages to users and show them IN-APP messages (https://developers.facebook.com/docs/push-notifications). The problem is related to the facebook in-app messages. In such message, is posible to add buttons with a related link (from the facebook web console), the thing is that these buttons contains a link like http://example.com/product?id=1234, which defines a deeplink for our app, however when the user taps the button, it gets directed to the browser. What I need to to be able to parse such intent. – BernalCarlos Jul 19 '18 at 15:13
  • Does the browser redirect to your app? – Daniel Jul 19 '18 at 15:14
  • @Dopapp precisely, I want the button to do something in my app when pressed. – BernalCarlos Jul 19 '18 at 15:14
  • Have you taken a look at this article: https://medium.com/@stasost/ios-how-to-open-deep-links-notifications-and-shortcuts-253fb38e1696 – Daniel Jul 19 '18 at 15:15
  • @Dopapp Does the browser redirect to your app?. No, it doesn't in iOS. For the deep links functionality, we're using firebase dynamic links, and what happens is that when such a link is opened from the in-app button, the users gets redirected to a page with the app information and a button to go back to the app (this doesn't happen when the user clicks then deep link from outside the app, for example, a browser or a whatsapp message). – BernalCarlos Jul 19 '18 at 15:20
  • 1
    You should read the Medium article I linked to above. It should help. – Daniel Jul 19 '18 at 15:23

2 Answers2

0

I believe you should try implementing Universal Links.

Tal Cohen
  • 1,308
  • 10
  • 20
  • Hi @tal-cohen, we're using firebase dynamic links, which implements Universal Links behind the scenes. However, the user gets redirected to the firebase app preview page when it taps the button, even thou such page was disabled in the dynamic link. – BernalCarlos Jul 19 '18 at 16:37
0

You need to get Firebase Instance of Deeplink and parse Link manually like this than set your Dialog/button action to whatever.

      FirebaseDynamicLinks.getInstance()
            .getDynamicLink(getIntent())
            .addOnSuccessListener(this, new OnSuccessListener<PendingDynamicLinkData>() {
                @Override
                public void onSuccess(PendingDynamicLinkData pendingDynamicLinkData) {
                    // Get deep link from result (may be null if no link is found)
                    Uri deepLink = null;
                    if (pendingDynamicLinkData != null) {
                        deepLink = pendingDynamicLinkData.getLink();
                        Log.d("DeepLink", deepLink.toString()+pendingDynamicLinkData.zzte().toString());

                        if(deepLink.getEncodedPath().contains("mobile-app")){
skryshtafovych
  • 572
  • 4
  • 16