Closed snghnishant closed 1 year ago
@snghnishant Are you sending the push via FCM or via CleverTap dashboard?
@snghnishant Are you sending the push via FCM or via CleverTap dashboard?
We have integrations for both FCM and CleverTap, we are using FCM for user-level notification that we push from our custom dashboard/backend. This notification was pushed from the CleverTap dashboard.
@snghnishant Where have you set the setCleverTapPushClickedPayloadReceivedHandler
on the Dart side to handle the pushClickedPayloadReceived
callback?
in main.dart file
class _AppState extends State<App> {
static FirebaseAnalytics analytics = FirebaseAnalytics();
static FirebaseAnalyticsObserver observer = FirebaseAnalyticsObserver(
analytics: analytics); // instance used to track pages in the Material app
// For Clevertap
CleverTapPlugin _clevertapPlugin;
// var inboxInitialized = false;
@override
void initState() {
super.initState();
// Clevertap
initPlatformState();
activateCleverTapFlutterPluginHandlers();
CleverTapPlugin.setDebugLevel(3);
CleverTapPlugin.createNotificationChannel(
"CleverTapNotification",
"Stratzy Notifications",
"Marketing, Account related, and Investment Tips from Stratzy",
3,
true);
CleverTapPlugin.registerForPush(); //only for iOS
// CleverTapPlugin.initializeInbox();
CleverTapPlugin.enableDeviceNetworkInfoReporting(true);
/*
CleverTapPlugin.setOptOut(false); ///Will opt in the user to send data to CleverTap
CleverTapPlugin.setOptOut(true); ///Will opt out the user to send data to CleverTap
CleverTapPlugin.enableDeviceNetworkInfoReporting(false); // Will opt out the user to send Device Network data to CleverTap
CleverTapPlugin.enableDeviceNetworkInfoReporting(true); // Will opt in the user to send Device Network data to CleverTap
CleverTapPlugin.setOffline(false); // Will set the user online
CleverTapPlugin.setOffline(true); // Will set the user offline
*/
}
// Clevertap methods
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initPlatformState() async {
if (!mounted) return;
}
void activateCleverTapFlutterPluginHandlers() {
_clevertapPlugin = new CleverTapPlugin();
_clevertapPlugin.setCleverTapPushAmpPayloadReceivedHandler(
pushAmplificationPayloadReceived);
// You can get the custom value after clicking the notification using the setCleverTapPushClickedPayloadReceivedHandler.
// This will give you the entire Push Notification payload as sent from CleverTap in the form of a Map.
_clevertapPlugin.setCleverTapPushClickedPayloadReceivedHandler(
pushClickedPayloadReceived);
// ... rest of the handlers
}
// ... rest of the handlers definitions
void pushAmplificationPayloadReceived(Map<String, dynamic> map) {
print("-------pushAmplificationPayloadReceived called------");
this.setState(() async {
var data = jsonEncode(map);
print("Push Amp Payload = " + data.toString());
CleverTapPlugin.createNotification(data);
});
}
void pushClickedPayloadReceived(Map<String, dynamic> message) {
print("------ Notification CT-------");
print("CT DATA: $message");
// Handle redirections
var screen = message['data']['screen'];
switch (screen) {
case "PortfolioScreen":
// root level
Provider.of<GlobalBottomBarNotifier>(context, listen: false)
.changeActiveTabIndex(1);
break;
case "ClubScreen":
// root level
Provider.of<GlobalBottomBarNotifier>(context, listen: false)
.changeActiveTabIndex(4);
break;
case "DiscoverScreen":
// root level
Provider.of<GlobalBottomBarNotifier>(context, listen: false)
.changeActiveTabIndex(2);
break;
case "InsightsScreen":
// root level
Provider.of<GlobalBottomBarNotifier>(context, listen: false)
.changeActiveTabIndex(3);
break;
case "ActiveTradesScreen":
Navigator.of(context).push(animatedRoute(
ActiveTrades(),
RouteType.RIGHT_TO_LEFT,
));
break;
case "ExitInvestmentScreen":
Navigator.of(context).push(animatedRoute(
ExitInvestmentPage(
strategyRealName: message['data']['strategyRealName']),
RouteType.RIGHT_TO_LEFT,
));
break;
case "StrategyListScreen":
Navigator.of(context).push(animatedRoute(
StrategyListPage(),
RouteType.RIGHT_TO_LEFT,
));
break;
case "IdeaListScreen":
Navigator.of(context).push(animatedRoute(
IdeasListScreen(),
RouteType.RIGHT_TO_LEFT,
));
break;
case "StrategyExploreScreen":
var strategy = message['data']['strategyRealName'];
var strategyData = Hive.box<Strategy>('strategiesData')
.get(strategy, defaultValue: null);
if (strategyData != null)
Navigator.of(context).push(animatedRoute(
ExploreStrategyScreen(
strategyRealName: strategy,
minInvestment: strategyData.minInvestmentVal,
),
RouteType.RIGHT_TO_LEFT,
));
break;
case "IdeaExploreScreen":
getIdeasAndSaveToHive().then((response) {
if (response) {
Navigator.of(context).push(animatedRoute(
ExploreIdeaScreen(
ideaName: message['data']['ideaName'],
),
RouteType.RIGHT_TO_LEFT,
));
} else {
Navigator.of(context).push(animatedRoute(
IdeasListScreen(),
RouteType.RIGHT_TO_LEFT,
));
}
});
break;
/*case "IndividualPortfolioScreen":
Navigator.of(context).push(animatedRoute(
IndividualPortfolioScreen(strategy: strategy),
RouteType.RIGHT_TO_LEFT,
));
break;*/
default:
debugPrint("No redirects present, Opening the App!");
}
}
This is how I am invoking the handler (the way it was mentioned in your example project)
// Initializing firebase background isolate
Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
// If you're going to use other Firebase services in the background, such as Firestore,
// make sure you call `initializeApp` before using other Firebase services.
// Used for CleverTap
// This will be called to render the Notification in System tray when app is in background/terminated state
await Firebase.initializeApp();
print("Im in the background handler");
await CleverTapPlugin();
await CleverTapPlugin.createNotification(jsonEncode(message.data));
print("Tried calling createNotification");
}
void main() async {
runZonedGuarded<Future<void>>(() async {
WidgetsFlutterBinding.ensureInitialized();
// Initialization
await Firebase.initializeApp();
await Hive.initFlutter();
// register fcm handler to handle message on background/terminate state
// called for both FCM and CleverTap Notifications
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
// status bar color & brightness
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
statusBarBrightness: Brightness.light,
statusBarIconBrightness: Brightness.light,
),
);
// device orientation
await SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]);
runApp(
App(),
);
}, (error, stack) => FirebaseCrashlytics.instance.recordError(error, stack));
}
these are the detailed logs on initiating the push notification from the clever tap dashboard
D/FLTFireMsgReceiver(23283): broadcast received for message
I/flutter (23283): ---FOREGROUND STATE FCM MESSAGE HANDLER---
I/flutter (23283): Message title: null, body: null, data: {wzrk_pn: true, wzrk_acct_id: 6Z8-4Z9-WK6Z, wzrk_pivot: wzrk_default, wzrk_sound: true, screen: PortfolioScreen, nm: Redirect to Portfolio screen, wzrk_cid: , nt: Hello Nishant, wzrk_push_amp: false, wzrk_dt: FIREBASE, wzrk_ck: 1630914816_1637057457, strategyRealName: beta_basket, wzrk_ttl: 1637143857, wzrk_rnv: false, wzrk_bc: , wzrk_id: 0_0, pr: , wzrk_bi: 2}
V/CleverTap:[:PushProvider:6Z8-4Z9-WK6Z](23283): [PushType:FCM] received notification from CleverTap: Bundle[{wzrk_acct_id=6Z8-4Z9-WK6Z, screen=PortfolioScreen, nm=Redirect to Portfolio screen, nt=Hello Nishant, pr=, wzrk_pivot=wzrk_default, wzrk_sound=true, wzrk_cid=, wzrk_rnv=false, wzrk_ttl=1637143857, wzrk_push_amp=false, strategyRealName=beta_basket, wzrk_bc=, wzrk_bi=2, wzrk_ck=1630914816_1637057457, wzrk_dt=FIREBASE, wzrk_id=0_0, wzrk_pn=true}]
V/CleverTap(23283): PostAsyncSafely Task: CleverTapAPI#_createNotification starting on...pool-16-thread-1
D/CleverTap:6Z8-4Z9-WK6Z(23283): Handling notification: Bundle[{wzrk_acct_id=6Z8-4Z9-WK6Z, screen=PortfolioScreen, nm=Redirect to Portfolio screen, nt=Hello Nishant, pr=, wzrk_pivot=wzrk_default, wzrk_sound=true, wzrk_cid=, wzrk_rnv=false, wzrk_ttl=1637143857, wzrk_push_amp=false, strategyRealName=beta_basket, wzrk_bc=, wzrk_bi=2, wzrk_ck=1630914816_1637057457, wzrk_dt=FIREBASE, wzrk_id=0_0, wzrk_pn=true}]
D/CleverTap:6Z8-4Z9-WK6Z(23283): Converting collapse_key: 1630914816_1637057457 to notificationId int: -642571383
E/ApplicationPackageManager(23283): checkSettingsForIconTray value : 0
V/CleverTap(23283): Service com.clevertap.android.sdk.pushnotification.CTNotificationIntentService found
D/CleverTap:6Z8-4Z9-WK6Z(23283): Rendered notification: Notification(pri=0 contentView=null vibrate=null sound=content://settings/system/notification_sound defaults=0x0 flags=0x10 color=0x00000000 vis=PRIVATE semFlags=0x0 semPriority=0)
V/CleverTap(23283): Storing Push Notification...null - with ttl - 1637143857
D/CleverTap(23283): Recording of Notification Viewed is disabled in the CleverTap Dashboard for notification payload: Bundle[{wzrk_acct_id=6Z8-4Z9-WK6Z, screen=PortfolioScreen, nm=Redirect to Portfolio screen, nt=Hello Nishant, pr=, wzrk_pivot=wzrk_default, wzrk_sound=true, wzrk_cid=, wzrk_rnv=false, wzrk_ttl=1637143857, wzrk_push_amp=false, strategyRealName=beta_basket, wzrk_bc=, wzrk_bi=2, wzrk_ck=1630914816_1637057457, wzrk_dt=FIREBASE, wzrk_id=0_0, wzrk_pn=true}]
V/CleverTap(23283): PostAsyncSafely Task: CleverTapAPI#_createNotification executed successfully on...pool-16-thread-1
Detailed logs on Notification click
V/CleverTap(23283): PostAsyncSafely Task: queueEvent starting on...pool-16-thread-1
V/CleverTap:6Z8-4Z9-WK6Z(23283): Local cache doesn't need to be updated
D/CleverTap:6Z8-4Z9-WK6Z(23283): Queued event: {"evtName":"Notification Clicked","evtData":{"wzrk_acct_id":"6Z8-4Z9-WK6Z","wzrk_pivot":"wzrk_default","wzrk_sound":"true","wzrk_cid":"","wzrk_rnv":"false","wzrk_ttl":"1637143857","wzrk_push_amp":"false","wzrk_bc":"","wzrk_bi":"2","wzrk_ck":"1630914816_1637057457","wzrk_dt":"FIREBASE","wzrk_id":"0_0","wzrk_pn":"true"},"s":1637052744,"pg":1,"type":"event","ep":1637057619,"f":false,"lsl":3380,"wzrk_error":{"c":512,"d":"Recording of Notification Viewed is disabled in the CleverTap Dashboard for notification payload: Bundle[{wzrk_acct_id=6Z8-4Z9-WK6Z, screen=PortfolioScreen, nm=Redirect to Portfolio screen, nt=Hello Nishant, pr=, wzrk_pivot=wzrk_default, wzrk_sound=true, wzrk_cid=, wzrk_rnv=false, wzrk_ttl=1637139653, wzrk_push_amp=false, strategyRealName=beta_basket, wzrk_bc=, wzrk_bi=2, wzrk_ck=1630914816_1637053253, wzrk_dt=FIREBASE, wzrk_id=0_0, wzrk_pn=true}]"},"dsync":false}
V/CleverTap:6Z8-4Z9-WK6Z(23283): Queued event to DB table EVENTS: {"evtName":"Notification Clicked","evtData":{"wzrk_acct_id":"6Z8-4Z9-WK6Z","wzrk_pivot":"wzrk_default","wzrk_sound":"true","wzrk_cid":"","wzrk_rnv":"false","wzrk_ttl":"1637143857","wzrk_push_amp":"false","wzrk_bc":"","wzrk_bi":"2","wzrk_ck":"1630914816_1637057457","wzrk_dt":"FIREBASE","wzrk_id":"0_0","wzrk_pn":"true"},"s":1637052744,"pg":1,"type":"event","ep":1637057619,"f":false,"lsl":3380,"wzrk_error":{"c":512,"d":"Recording of Notification Viewed is disabled in the CleverTap Dashboard for notification payload: Bundle[{wzrk_acct_id=6Z8-4Z9-WK6Z, screen=PortfolioScreen, nm=Redirect to Portfolio screen, nt=Hello Nishant, pr=, wzrk_pivot=wzrk_default, wzrk_sound=true, wzrk_cid=, wzrk_rnv=false, wzrk_ttl=1637139653, wzrk_push_amp=false, strategyRealName=beta_basket, wzrk_bc=, wzrk_bi=2, wzrk_ck=1630914816_1637053253, wzrk_dt=FIREBASE, wzrk_id=0_0, wzrk_pn=true}]"},"dsync":false}
D/CleverTap:6Z8-4Z9-WK6Z(23283): Network retry #0
D/CleverTap:6Z8-4Z9-WK6Z(23283): Failure count is 0. Setting delay frequency to 1s
V/CleverTap:6Z8-4Z9-WK6Z(23283): Scheduling delayed queue flush on main event loop
V/CleverTap(23283): PostAsyncSafely Task: queueEvent executed successfully on...pool-16-thread-1
D/CleverTap(23283): CTPushNotificationReceiver: handled notification: Bundle[{wzrk_acct_id=6Z8-4Z9-WK6Z, screen=PortfolioScreen, nm=Redirect to Portfolio screen, nt=Hello Nishant, pr=, wzrk_pivot=wzrk_default, wzrk_sound=true, wzrk_cid=, wzrk_rnv=false, wzrk_ttl=1637143857, wzrk_push_amp=false, strategyRealName=beta_basket, wzrk_bc=, wzrk_bi=2, wzrk_ck=1630914816_1637057457, wzrk_dt=FIREBASE, wzrk_id=0_0, wzrk_pn=true}]
D/ViewRootImpl@827ab46[MainActivity](23283): MSG_WINDOW_FOCUS_CHANGED 1
D/ViewRootImpl@827ab46[MainActivity](23283): mHardwareRenderer.initializeIfNeeded()#2 mSurface={isValid=true 482222374400}
D/SensorManager(23283): unregisterListener ::
V/CleverTap:6Z8-4Z9-WK6Z(23283): App in background
V/CleverTap:6Z8-4Z9-WK6Z(23283): Updated session time: 1637057619
D/SensorManager(23283): registerListener :: 0, MPU6500 Acceleration Sensor, 66667, 0,
V/CleverTap:6Z8-4Z9-WK6Z(23283): App in foreground
V/CleverTap(23283): PostAsyncSafely Task: InappController#showNotificationIfAvailable starting on...pool-23-thread-1
V/CleverTap:6Z8-4Z9-WK6Z(23283): checking Pending Notifications
V/CleverTap(23283): PostAsyncSafely Task: InappController#showNotificationIfAvailable executed successfully on...pool-23-thread-1
V/CleverTap(23283): PostAsyncSafely Task: CommsManager#flushQueueAsync starting on...pool-16-thread-1
V/CleverTap:6Z8-4Z9-WK6Z(23283): Pushing event onto queue flush sync
V/CleverTap:6Z8-4Z9-WK6Z(23283): Pushing Notification Viewed event onto queue DB flush
V/CleverTap:6Z8-4Z9-WK6Z(23283): Somebody has invoked me to send the queue to CleverTap servers
V/CleverTap:6Z8-4Z9-WK6Z(23283): Returning Queued events
V/CleverTap:[:ON_USER_LOGIN:6Z8-4Z9-WK6Z](23283): getCachedGUIDs:[{"Email_nsr291998@gmail.com":"__g07a96b5e899a45eb80c980dba949fc94"}]
V/CleverTap:[:ON_USER_LOGIN:6Z8-4Z9-WK6Z](23283): getCachedIdentityKeysForAccount:Identity,Email
V/CleverTap:[:ON_USER_LOGIN:6Z8-4Z9-WK6Z](23283): isLegacyProfileLoggedIn:false
V/CleverTap:[:ON_USER_LOGIN:6Z8-4Z9-WK6Z](23283): getCachedIdentityKeysForAccount:Identity,Email
V/CleverTap:[:ON_USER_LOGIN:6Z8-4Z9-WK6Z](23283): ConfigurableIdentityRepoPrefIdentitySet [Identity,Email]
V/CleverTap:[:ON_USER_LOGIN:6Z8-4Z9-WK6Z](23283): ConfigurableIdentityRepoConfigIdentitySet []
V/CleverTap:[:ON_USER_LOGIN:6Z8-4Z9-WK6Z](23283): ConfigurableIdentityRepoNo error found while comparing [Pref:Identity,Email], [Config:]
V/CleverTap:[:ON_USER_LOGIN:6Z8-4Z9-WK6Z](23283): ConfigurableIdentityRepoIdentity Set activated from Pref[Identity,Email]
V/CleverTap:[:ON_USER_LOGIN:6Z8-4Z9-WK6Z](23283): Repo provider: ConfigurableIdentityRepo
V/CleverTap:[:PushProvider:6Z8-4Z9-WK6Z](23283): [PushType:FCM] getting Cached Token - dnin2nuySOyo3Vxob3zTIz:APA91bFgYnVaP6NwuBE9I8bdRVZ4J7HEWEqzYiDhIiooTLobVZWL0f95Wtc_wnbOlvo9i5NXlGvH9_-o8XcbWxjUm7rvOYpwSHBe1LCXnWdXzy-D5ZbsjbU-qK6LTEXDhlVmXTtxep7J
V/CleverTap:6Z8-4Z9-WK6Z(23283): New ARP Key = ARP:6Z8-4Z9-WK6Z:__g07a96b5e899a45eb80c980dba949fc94
V/CleverTap:6Z8-4Z9-WK6Z(23283): Fetched ARP for namespace key: ARP:6Z8-4Z9-WK6Z:__g07a96b5e899a45eb80c980dba949fc94 values: {hgt=4, j_n=Zg==, i_n=Zg==, d_ts=1636991734, j_s={ }, av=2.0.0, sv=40200, v=1, k_n=[ "nsr291998@gmail.com"], id=6Z8-4Z9-WK6Z, dh=907109299, r_ts=1637053492, e_ts=0, wdt=2}
V/CleverTap(23283): Attaching InAppFC to Header
D/CleverTap:6Z8-4Z9-WK6Z(23283): Send queue contains 1 items: [{"g":"__g07a96b5e899a45eb80c980dba949fc94","type":"meta","af":{"Build":"27","Version":"2.0.0","OS Version":"7.0","SDK Version":40200,"Make":"samsung","Model":"SM-G920I","Carrier":"JIO 4G | Jio 4G","useIP":true,"OS":"Android","wdt":2.48,"hgt":4.41,"dpi":640,"dt":1,"lib":"Flutter","cc":"in","wifi":true,"BluetoothVersion":"ble","Radio":"4G"},"id":"6Z8-4Z9-WK6Z","tk":"c14-b16","l_ts":1637053492,"f_ts":1636991736,"ct_pi":"Identity,Email","ddnd":false,"rtl":[],"rct":0,"ait":0,"frs":false,"arp":{"hgt":4,"j_n":"Zg==","i_n":"Zg==","d_ts":1636991734,"j_s":"{ }","av":"2.0.0","sv":40200,"v":1,"k_n":"[ \"nsr291998@gmail.com\"]","id":"6Z8-4Z9-WK6Z","dh":907109299,"r_ts":1637053492,"e_ts":0,"wdt":2},"wzrk_ref":{"wzrk_acct_id":"6Z8-4Z9-WK6Z","wzrk_pivot":"wzrk_default","wzrk_sound":"true","wzrk_cid":"","wzrk_rnv":"false","wzrk_ttl":"1637139653","wzrk_push_amp":"false","wzrk_bc":"","wzrk_bi":"2","wzrk_ck":"1630914816_1637053253","wzrk_dt":"FIREBASE","wzrk_id":"0_0","wzrk_pn":"true"},"imp":0,"tlc":[]}, {"evtName":"Notification Clicked","evtData":{"wzrk_acct_id":"6Z8-4Z9-WK6Z","wzrk_pivot":"wzrk_default","wzrk_sound":"true","wzrk_cid":"","wzrk_rnv":"false","wzrk_ttl":"1637143857","wzrk_push_amp":"false","wzrk_bc":"","wzrk_bi":"2","wzrk_ck":"1630914816_1637057457","wzrk_dt":"FIREBASE","wzrk_id":"0_0","wzrk_pn":"true"},"s":1637052744,"pg":1,"type":"event","ep":1637057619,"f":false,"lsl":3380,"wzrk_error":{"c":512,"d":"Recording of Notification Viewed is disabled in the CleverTap Dashboard for notification payload: Bundle[{wzrk_acct_id=6Z8-4Z9-WK6Z, screen=PortfolioScreen, nm=Redirect to Portfolio screen, nt=Hello Nishant, pr=, wzrk_pivot=wzrk_default, wzrk_sound=true, wzrk_cid=, wzrk_rnv=false, wzrk_ttl=1637139653, wzrk_push_amp=false, strategyRealName=beta_basket, wzrk_bc=, wzrk_bi=2, wzrk_ck=1630914816_1637053253, wzrk_dt=FIREBASE, wzrk_id=0_0, wzrk_pn=true}]"},"dsync":false}]
D/CleverTap:6Z8-4Z9-WK6Z(23283): Sending queue to: https://wzrkt.com/a1?os=Android&t=40200&z=6Z8-4Z9-WK6Z&ts=1637057620
I/System.out(23283): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out(23283): (HTTPLog)-Static: isSBSettingEnabled false
V/CleverTap(23283): Getting domain from header - null
V/CleverTap:6Z8-4Z9-WK6Z(23283): Trying to process response: { "arp" : { "k_n" : "[ \"nsr291998@gmail.com\"]" , "j_n" : "Zg==" , "i_n" : "Zg==" , "d_ts" : 1636991734 , "dh" : 907109299 , "v" : 1 , "j_s" : "{ }" , "id" : "6Z8-4Z9-WK6Z" , "e_ts" : 0 , "r_ts" : 1637057620 , "wdt" : 2.48 , "hgt" : 4.41 , "av" : "2.0.0" , "sv" : 40200} , "imc" : 1 , "imp" : 10 , "pushamp_notifs" : { "list" : [ ] , "ack" : true , "pf" : 240}}
V/CleverTap:6Z8-4Z9-WK6Z(23283): InApp: Processing response
V/CleverTap:6Z8-4Z9-WK6Z(23283): InApp: Response JSON object doesn't contain the inapp key, failing
V/CleverTap:6Z8-4Z9-WK6Z(23283): ARP doesn't contain the Discarded Events key
V/CleverTap:6Z8-4Z9-WK6Z(23283): New ARP Key = ARP:6Z8-4Z9-WK6Z:__g07a96b5e899a45eb80c980dba949fc94
V/CleverTap:6Z8-4Z9-WK6Z(23283): Stored ARP for namespace key: ARP:6Z8-4Z9-WK6Z:__g07a96b5e899a45eb80c980dba949fc94 values: {"k_n":"[ \"nsr291998@gmail.com\"]","j_n":"Zg==","i_n":"Zg==","d_ts":1636991734,"dh":907109299,"v":1,"j_s":"{ }","id":"6Z8-4Z9-WK6Z","e_ts":0,"r_ts":1637057620,"wdt":2.48,"hgt":4.41,"av":"2.0.0","sv":40200}
V/CleverTap:6Z8-4Z9-WK6Z(23283): Inbox: Processing response
V/CleverTap:6Z8-4Z9-WK6Z(23283): Inbox: Response JSON object doesn't contain the inbox key
V/CleverTap:6Z8-4Z9-WK6Z(23283): Processing pushamp messages...
V/CleverTap(23283): Ping frequency received - 240
V/CleverTap(23283): Stored Ping Frequency - 240
V/CleverTap(23283): Received ACK -true
V/CleverTap(23283): Updating RTL values...
V/CleverTap:6Z8-4Z9-WK6Z(23283): Processing Display Unit items...
V/CleverTap:6Z8-4Z9-WK6Z(23283): DisplayUnit : JSON object doesn't contain the Display Units key
V/CleverTap:6Z8-4Z9-WK6Z(23283): Processing Feature Flags response...
V/CleverTap:6Z8-4Z9-WK6Z(23283): Feature Flag : JSON object doesn't contain the Feature Flags key
V/CleverTap:6Z8-4Z9-WK6Z(23283): Processing Product Config response...
V/CleverTap:6Z8-4Z9-WK6Z(23283): Product Config : JSON object doesn't contain the Product Config key
V/CleverTap:6Z8-4Z9-WK6Z(23283): Processing GeoFences response...
V/CleverTap:6Z8-4Z9-WK6Z(23283): Geofences : JSON object doesn't contain the Geofences key
I/CleverTapResponse(23283): Done processing response!
D/CleverTap:6Z8-4Z9-WK6Z(23283): Queue sent successfully
V/CleverTap:6Z8-4Z9-WK6Z(23283): Returning Queued events
V/CleverTap:6Z8-4Z9-WK6Z(23283): No events in the queue, failing
V/CleverTap(23283): PostAsyncSafely Task: CommsManager#flushQueueAsync executed successfully on...pool-16-thread-1
V/CleverTap(23283): PostAsyncSafely Task: CommsManager#flushQueueAsync starting on...pool-16-thread-1
V/CleverTap:6Z8-4Z9-WK6Z(23283): Pushing Notification Viewed event onto queue flush sync
V/CleverTap:6Z8-4Z9-WK6Z(23283): Pushing Notification Viewed event onto queue DB flush
V/CleverTap:6Z8-4Z9-WK6Z(23283): Somebody has invoked me to send the queue to CleverTap servers
V/CleverTap:6Z8-4Z9-WK6Z(23283): Returning Queued Notification Viewed events
V/CleverTap:6Z8-4Z9-WK6Z(23283): No events in the queue, failing
V/CleverTap(23283): PostAsyncSafely Task: CommsManager#flushQueueAsync executed successfully on...pool-16-thread-1
@snghnishant Are you calling createNotification
only in the _firebaseMessagingBackgroundHandler
?
I'm assuming your issue here is that the notification is getting rendered but with the click of the notification you are not getting the pushClickedPayloadReceived
callback.
@snghnishant Are you calling
createNotification
only in the_firebaseMessagingBackgroundHandler
?I'm assuming your issue here is that the notification is getting rendered but with the click of the notification you are not getting the
pushClickedPayloadReceived
callback.
Yup, but also in the handler registered for push amplification
void pushAmplificationPayloadReceived(Map<String, dynamic> map) {
print("-------pushAmplificationPayloadReceived called------");
this.setState(() async {
var data = jsonEncode(map);
print("Push Amp Payload = " + data.toString());
CleverTapPlugin.createNotification(data);
});
}
The notification is rendering but when clicked nothing happens at all, i.e the call to void pushClickedPayloadReceived(Map<String, dynamic> message)
method doesn't get invoked.
I have tried this in all 3 app state(terminated, background and foreground)
@snghnishant Got it! I would suggest you try calling activateCleverTapFlutterPluginHandlers
inside the _firebaseMessagingBackgroundHandler
as well.
I think the callback listener is not getting set when the notification arrives on the device and hence you are not receiving the pushClickedPayloadReceived
callback on the click.
@snghnishant Got it! I would suggest you try calling
activateCleverTapFlutterPluginHandlers
inside the_firebaseMessagingBackgroundHandler
as well.I think the callback listener is not getting set when the notification arrives on the device and hence you are not receiving the
pushClickedPayloadReceived
callback on the click.
_firebaseMessagingBackgroundHandler
is globally declared and the activateCleverTapFlutterPluginHandlers
is defined as the class method so it can't be called inside _firebaseMessagingBackgroundHandler
@darshanclevertap can you please give a solution for this. We are using Clevertap in our mobile app in production and are unable to do any marketing campaigns which requires us to send user level notifications with redirections.
@darshanclevertap I have figured out a workaround for this which works for notification redirection. Instead of passing parameters as key-value pairs in notification data to get to a specific screen inside the app, we can use deep links with query parameters and use the firebase dynamic links package to handle the user notification click redirection.
But this doesn't solve the actual issue. A solution will be really appreciated.
Any update on this post? Our team also facing the same issue. Able to receive payload on FirebaseMessaging, but not on pushClickedPayloadReceived callback. Appreciate if anyone on CleverTap Team can follow up on this.
Any update on this post? Our team also facing the same issue. Able to receive payload on FirebaseMessaging, but not on pushClickedPayloadReceived callback. Appreciate if anyone on CleverTap Team can follow up on this.
Hey as of now there's no way to get the notification data and their tech team is working on that to get this resolved. If you want to try out my workaround to handle redirections through deeplinks then do let me know I'll share the code and steps in a gist.
On tap of system tray notification from Clevertap still not able to get the payload in any 3 states of the app tested on clevertap_plugin: ^1.5.0
but I have found another yet better workaround for handling redirects by using the firebase dynamic link plugin to capture the dynamic link sent in push notification from Clevertap in all 3 app states and then further extracting the deep link in the function callbacks to pass on to the redirect logic. Since the firebase dynamic link plugin doesn't seem to work on iOS so this workaround is only for Android.
@darshanclevertap would like to know the updates on this, please!
@snghnishant I was also facing the same issue . I removed all firebase handlers and it started working.
Any update on this @darshanclevertap the issue has been pending from a very long time now.
@snghnishant same problem
@darshanclevertap any news?
@snghnishant Did Firebase Dynamic Links work when app is terminated
@william-ct @darshanclevertap We are facing the same issue we started integrating clevertap in mid-January and we are still in the integration phase. Have a look at these ticket id's #122515 #119425
@darshanclevertap
I am still facing this issue on android using clevertap_plugin: ^1.6.1
. Is there any progress on resolving it or any workaround that I can try?
Hello @Mohanedy98. Could you please provide more details about the issue you are facing?
Hello @shivamsharma2710 ,
I have followed the documentation to set up push notifications and registered the setCleverTapPushClickedPayloadReceivedHandler
callback to handle notification clicks. However, this callback is not invoked when the notification is clicked even though I have used CleverTapPlugin.createNotification
in the FirebaseMessaging.onMessage
listener.
Relevant code snippets:
cleverTapPlugin.setCleverTapPushClickedPayloadReceivedHandler(pushClickedPayloadReceived);
void pushClickedPayloadReceived(Map<String, dynamic> map) {
Logger.debugLog('CleverTap push clicked payload received = $map');
_onPushNotificationClickedStreamController.add(map);
}
FirebaseMessaging.onMessage.listen((RemoteMessage message) async {
await localNotificationsDataSource.incrementUnreadNotifications();
if (onMessageReceived != null) {
onMessageReceived(message);
}
if (Platform.isAndroid) {
if (message.data.containsKey('wzrk_acct_id')) {
/// CleverTap notification
final dataPayload = jsonEncode(message.data);
CleverTapPlugin.createNotification(dataPayload);
} else {
/// Normal notification
onMessageReceivedHandler(message, onMessageClicked: onMessageClicked);
}
}
});
Hello y'all
I'm facing the exact same issue on my flutter project (the push notification is rendered, but click events don't work...the callbacks registered are never triggered). Any solutions for this?...this bug is now 2 years old...
@RamiroGarrido This issue has been fixed in version 1.8.0. Please refer to the ChangeLog and developer documentation for more information on this.
Hey, @darshanclevertap I have tried all the mentioned solutions in #46 to get the Notification Data for redirecting when the app is in the background or terminated state and this is still not working at all.
When the app is in Foreground I am able to get the message payload in
FirebaseMessaging.onMessage.listen((RemoteMessage message) {...}
and handle redirections through our custom made alert box. But we also get the Notification rendered in the System Tray, and on clicking that notification the app opens but there's no method handler calls tovoid pushClickedPayloadReceived(Map<String, dynamic> message) {...}
which you said will give you the message payload. So basically there's no way by which we can get the message payload on the onClick event of the Notification being rendered in the system tray in any of the app states.