本文整理汇总了Java中com.csipsimple.widgets.RegistrationNotification类的典型用法代码示例。如果您正苦于以下问题:Java RegistrationNotification类的具体用法?Java RegistrationNotification怎么用?Java RegistrationNotification使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RegistrationNotification类属于com.csipsimple.widgets包,在下文中一共展示了RegistrationNotification类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: notifyRegisteredAccounts
import com.csipsimple.widgets.RegistrationNotification; //导入依赖的package包/类
public synchronized void notifyRegisteredAccounts(ArrayList<SipProfileState> activeAccountsInfos, boolean showNumbers) {
if (!isServiceWrapper) {
Log.e(THIS_FILE, "Trying to create a service notification from outside the service");
return;
}
int icon = R.drawable.ic_stat_sipok;
CharSequence tickerText = context.getString(R.string.service_ticker_registered_text);
long when = System.currentTimeMillis();
Builder nb = new Builder(context);
nb.setSmallIcon(icon);
nb.setTicker(tickerText);
nb.setWhen(when);
Intent notificationIntent = new Intent(SipManager.ACTION_SIP_DIALER);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
RegistrationNotification contentView = new RegistrationNotification(context.getPackageName());
contentView.clearRegistrations();
if(!Compatibility.isCompatible(9)) {
contentView.setTextsColor(notificationPrimaryTextColor);
}
contentView.addAccountInfos(context, activeAccountsInfos);
// notification.setLatestEventInfo(context, contentTitle,
// contentText, contentIntent);
nb.setOngoing(true);
nb.setOnlyAlertOnce(true);
nb.setContentIntent(contentIntent);
nb.setContent(contentView);
Notification notification = nb.build();
notification.flags |= Notification.FLAG_NO_CLEAR;
// We have to re-write content view because getNotification setLatestEventInfo implicitly
notification.contentView = contentView;
if (showNumbers) {
// This only affects android 2.3 and lower
notification.number = activeAccountsInfos.size();
}
startForegroundCompat(REGISTER_NOTIF_ID, notification);
}