在Appcelerator Titanium中的通知抽屉上显示/隐藏推送通知

时间:2018-06-28 06:50:45

标签: android push-notification firebase-cloud-messaging titanium android-push-notification

我已经在我的应用程序中实现了ti.cloudpush模块以进行推送服务。我正在从Firebase那里得到推动。但是我不想显示所有从firebase到通知抽屉的通知。我该如何在我的应用程序中进行控制,以验证通知抽屉中哪些是可见的,哪些不是?

var CloudPush = require('ti.cloudpush');
CloudPush.showTrayNotification = true;
CloudPush.enabled = true;
CloudPush.showTrayNotificationsWhenFocused = true;
CloudPush.showAppOnTrayClick = true;

CloudPush.addEventListener('callback', function(evt) {

        var json = JSON.parse(evt.payload);
        //  alert(JSON.stringify(json));
        Ti.API.info("Json : " + JSON.stringify(json));

});

CloudPush.addEventListener('trayClickLaunchedApp', function(evt) {

        Ti.API.info('Tray Click Launched App (app was not running : )' + JSON.stringify(evt));

});

CloudPush.addEventListener('trayClickFocusedApp', function(evt) {

        Ti.API.info('Tray Click Focused App (app was already running)' + JSON.stringify(evt));

});

0 个答案:

没有答案