InApp NATIV
InApp NATIV Campaigns target your users by showing a message while the user is using your app. They are very effective in providing contextual information and help to cross-sell/up-sell on desired screens of your app or/and on desired actions performed by the user in your app.
Show InApp
Call the below API to show an inApp campaign on a screen.
import 'package:moengage_flutter/moengage_flutter.dart';
final MoEngageFlutter _moengagePlugin = MoEngageFlutter();
_moengagePlugin.showInApp();
Note
In the case of Android, by default in-apps are shown using the Activity Lifecycle Callbacks of an activity. To use the above mentioned
showInApp()
you need to opt-out of the default in-app display.
You can opt-out of the default display by calling theoptOutDefaultInAppDisplay()
on theMoEngage.Builder
object in theApplication
class.*
InApp Callbacks
We provide callbacks for inAppShown
and inAppClicked
events and you can register for the same as shown below.
import 'package:moengage_flutter/moengage_flutter.dart';
final MoEngageFlutter _moengagePlugin = MoEngageFlutter();
//Register for callbacks
_moengagePlugin.setUpInAppCallbacks(onInAppClick: _onInAppClick, onInAppShown:_onInAppShown);
// Callback Implementation
void _onInAppClick(Map<String, dynamic> message) {
print("This is a inApp click callback from native to flutter. Payload " +
message);
}
void _onInAppShown(Map<String, dynamic> message) {
print("This is a callback on inApp shown from native to flutter. Payload " +
message);
}
InApp Payload
InApp Payload will be received in the below format:
{
"platform": "ios/android",
"payload": {
"screenName" : "Screen Name",
"deepLinkUrl" : "deeplink URL", // Only in Android
"kvPairs" : {
// Custom Key-Value pairs
}
}
}
Updated almost 6 years ago