Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Titanium android push notification - Notifying multiple times

$
0
0

On receiving push notification - Its defaults showing by module but its only shows message and streched application icon.

I need to customise the notification - How it possible ?

Now in my below code showing push notification two times...

var win = Ti.UI.createWindow({
 
    layout: 'vertical',
 
    backgroundColor: 'white'
 
});
 
var CloudPush = require('ti.cloudpush');
 
var Cloud = require("ti.cloud");
 
CloudPush.addEventListener('callback', function (evt) {
 
var message = evt.payload;
 
    alert( 'Push notification : '+ evt.payload);
 
    var ntfId = 1;
 
    var launcherIntent = Ti.Android.createIntent({
 
className: 'com.MobiSam.MobiSamActivity',
 
action: 'action' + ntfId, // we need an action identifier to be able to track click on notifications
 
packageName: Ti.App.id,
 
flags: Ti.Android.FLAG_ACTIVITY_NEW_TASK | Ti.Android.FLAG_ACTIVITY_SINGLE_TOP
 
});
 
launcherIntent.addCategory(Ti.Android.CATEGORY_LAUNCHER);
 
launcherIntent.putExtra("ntfId", ntfId);
 
 
var pintent = Ti.Android.createPendingIntent({
 
intent: launcherIntent
 
});
 
var notification = Ti.Android.createNotification({
 
contentIntent: pintent,
 
contentTitle: message,
 
contentText: message,
 
tickerText: message,
 
icon: Ti.App.Android.R.drawable.appicon,
 
flags: Ti.Android.FLAG_AUTO_CANCEL | Ti.Android.FLAG_SHOW_LIGHTS
 
});
 
Ti.Android.NotificationManager.notify(ntfId, notification);
 
    });

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>