Skip to content

In-App Messages shows up as notification #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
epynic opened this issue May 17, 2021 · 19 comments
Closed

In-App Messages shows up as notification #44

epynic opened this issue May 17, 2021 · 19 comments
Assignees
Labels
workaround available Workaround available for this issue

Comments

@epynic
Copy link

epynic commented May 17, 2021

Have created an Campaign in CleverTap - Mobile In-app, Single Message
And as per the campaign preview we expect to see a pop up modal with the message,

image

While testing the campaign, we receive a Notification instead
image

The debug message in console is as below
image

@william-ct
Copy link
Contributor

Hi @epynic , campaigns which are being tested for in-app messages work as expected as above.However, live campaigns will render the in-app notifications as an in-app message rather than a notification.Thanks!

@epynic
Copy link
Author

epynic commented May 17, 2021

@william-ct It is the same console error for live campaigns, are we missing something ?

image

This is on Android using the latest clevertap plugin.

Thanks

@william-ct
Copy link
Contributor

Hi @epynic what's the superclass of your MainActivity?

@epynic
Copy link
Author

epynic commented May 17, 2021

@william-ct
The MainActivity file
image

AndroidManifest.xml
image

@darshanclevertap
Copy link
Contributor

darshanclevertap commented May 19, 2021

@epynic Our Header and Footer InApp templates in Android are Fragments. Now Fragments are only allowed to be created on Activities that extend FragmentActivity or AppCompatActivity. Meanwhile, the base Activity of any Flutter app is FlutterActivity.

FlutterActivity does not extend either of them and hence because of this technical issue, Header and Footer InApp templates will currently not work on Android via the CleverTap Flutter Plugin.

Now I know this is an inconvenience for our Flutter devs, but I assure you we have started working on providing a fix for the same, unfortunately, this fix will have to be made in the CleverTap Android SDK first and then shipped into the Flutter Plugin.

For the time being you can run Header/Footer InApp templates on your iOS devices or use any of our other InApp templates. I'll be marking this issue as a bug on our side and will provide proper timelines for this in the coming week.

I'd like to thank you for your patience while we fix this as soon as possible.

@darshanclevertap darshanclevertap self-assigned this May 19, 2021
@darshanclevertap darshanclevertap added the bug Something isn't working label May 19, 2021
@epynic
Copy link
Author

epynic commented May 20, 2021

@darshanclevertap thank you for acknowledging , waiting for the fix!

@darshanclevertap
Copy link
Contributor

darshanclevertap commented May 20, 2021

@epynic There is a workaround if you wish to try, you can extend your App's MainActivity from FlutterFragmentActivity instead of FlutterActivity. This will have almost no side effects on your app and it will ensure CleverTap's Header & Footer InApp templates can be used by your app. Please try it once and let us know if it works for you.

@darshanclevertap darshanclevertap added the workaround available Workaround available for this issue label May 20, 2021
@darshanclevertap
Copy link
Contributor

@epynic Did you try the workaround? You can check out the MainActivity of the example project for reference

@epynic
Copy link
Author

epynic commented May 22, 2021

@darshanclevertap - worked like a charm! Thanks :)

is there a way to handle custom key-value pair data on Button clicks ?

@darshanclevertap
Copy link
Contributor

@epynic Do you mean button click of the InApp notification?

@epynic
Copy link
Author

epynic commented May 24, 2021

@epynic Do you mean button click of the InApp notification?

Yes, the custom key-value pair data

image

@darshanclevertap
Copy link
Contributor

darshanclevertap commented May 24, 2021

@epynic Have you implemented the setCleverTapInAppNotificationButtonClickedHandler as shown here?

@epynic
Copy link
Author

epynic commented May 25, 2021

@darshanclevertap

Using the custom render in the manifest files

<service
        android:name="com.clevertap.android.sdk.pushnotification.fcm.FcmMessageListenerService">
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT"/>
        </intent-filter>
    </service>

we are able to receive the InApp messagings and Push notifications, while sending custom key-pair value data is not reflected in setCleverTapPushClickedPayloadReceivedHandler or setCleverTapInAppNotificationButtonClickedHandler

Is there anything we am missing out ?

@darshanclevertap
Copy link
Contributor

@epynic No, this should be it. Are you testing it on an emulator or a device? If you're using a device, can you disable battery optimizations for your app and test it once?

@epynic
Copy link
Author

epynic commented May 25, 2021

@darshanclevertap

the minimal main.dart

This is on android physical device there is no battery optimisations enabled.

Log when the Push Notification is sent

Screenshot 2021-05-25 at 5 18 19 PM

On notification click.
Screenshot 2021-05-25 at 5 20 51 PM

We are able to send receive notification & in-app messaging, only issue is we are unable to handle the custom key-pair values.

@epynic
Copy link
Author

epynic commented Jun 1, 2021

@darshanclevertap - help ?

@darshanclevertap
Copy link
Contributor

@epynic Sorry for the delay. Can you try calling activateCleverTapFlutterPluginHandlers inside _firebaseMessagingBackgroundHandler? My guess is that the setCleverTapPushClickedPayloadReceivedHandler is not set when the App Launches after clicking a notification. This causes the Notification Clicked event to be raised as per the logs but there is no callback to the dart file.

@darshanclevertap darshanclevertap removed the bug Something isn't working label Jun 3, 2021
@epynic
Copy link
Author

epynic commented Jun 8, 2021

@darshanclevertap is the same behaviour,setCleverTapPushClickedPayloadReceivedHandler or setCleverTapInAppNotificationButtonClickedHandler are not triggered.

The only way we could get this working is by removing the firebase cloud messaging plugin.
But this is not the intended behaviour we are look for - we would need firebase cloud-messaging to work along side with clevertap.

@darshanclevertap
Copy link
Contributor

@epynic We will be working on ensuring that Firebase cloud messaging and the CleverTap Flutter plugin do work together seamlessly but for now, this is the only way we have.

Closing this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
workaround available Workaround available for this issue
Projects
None yet
Development

No branches or pull requests

3 participants