本文整理匯總了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);
}