How to override the behavior of opening Appboy web activity in deeplink In App messge

765 Views Asked by At

I am facing a problem in override the On Click Behavior in Appboy deeplink

Please find the following data

1- Register Appboy in BaseActivity which is the parent activity for all Application Activities

@Override
    protected void onResume() { 

         AppboyInAppMessageManager.getInstance().registerInAppMessageManager(this);
        Appboy.getInstance(this).requestInAppMessageRefresh();
}

@Override
    protected void onPause() {

        AppboyInAppMessageManager.getInstance().unregisterInAppMessageManager(this);
    }

2- Add the receivers in Manifest File as following

<receiver android:name="com.forsale.forsale.appboy.AppboyGcmReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
                <category android:name="com.forsale.forsale" />
            </intent-filter>
        </receiver>

        <receiver
            android:name="com.forsale.forsale.appboy.AppBoyOpenReceiver"
            android:exported="false" >
            <intent-filter>
                <action android:name="com.forsale.forsale.intent.APPBOY_PUSH_RECEIVED" />
            <action android:name="com.forsale.forsale.intent.APPBOY_NOTIFICATION_OPENED" />
            </intent-filter>
        </receiver>

Know I can send in app message using app boy dashboard, and receive the message, but when I click the message it open appboy web activity with the link

I need to override this behaviour to be able to get the link that I sent in In app message and parse some parameters from it and direct the use to an activity inside my app

I have tried the following

  • remove default app boy web activity from manifest file /// the app crash
  • implement the IInAppMessageManagerListener /// the app stop receiving any messages

Please note that the application call the onReceive method when trying to register appboy and print the log (action = REGISTRATION, RegId = "..."), but it never lo any other actions like RECEIVE, or OPEN

public void onReceive(Context context, Intent intent) {

      AppboyLogger.i("AMIRA", String.format("Amira %s", intent.toString()));
      String action = intent.getAction();
      AppboyLogger.i("AMIRA", String.format("Amira %s", action));

      Bundle bundle = intent.getExtras();
      for (String key : bundle.keySet()) {
          Object value = bundle.get(key);
          AppboyLogger.i("AMIRA", String.format("Amira %s", key + ":" + value.toString()));
      }
}
1

There are 1 best solutions below

0
On BEST ANSWER

The root of the problem is that we differentiate deep links and http links based on schema of the URI, so http (and some other schemes) links are detected as web links, and other formats are seen as deep links (see https://github.com/Appboy/appboy-android-sdk/blob/master/android-sdk-ui/src/com/appboy/ui/actions/ActionFactory.java).

We’ll consider how to instrument things for the use case you have, but in the meantime there’s a couple of ways you could solve the issue:

1) Create a deep link that is not also an http link. Everything should work if your link instead looks like, for example, forsale://mylink?a=b&2=3....etc.

2) Set a custom in-app message manager listener: https://documentation.appboy.com/Android/#in-app-message-customization. You can see an example of how we do this in our Droidboy sample app. In your case, you’d want to return defaults for everything but onInAppMessageButtonClicked and onInAppMessageClicked where you’d want to handle the link yourself if it’s of the format of your deep link. Your ticket indicates you’ve tried this, but I’d suggest starting with "the default one we create in the AppboyInAppMessageManager.java (#L608) in the Android SDK - and then just modifying the *clicked methods.

3) Download our UI code and modify the source. You could optionally download the Appboy Android SDK and modify the ActionFactory to handle your deep link in the way you want. Though, at the point you are going to do something like this, solution #2 is likely going to be a nicer one to implement and maintain.

Please let us know if one of these solutions works for you and if you have any other comments/questions.

Thanks,

Waciuma