Example usage for android.telephony SubscriptionManager getPhoneId

List of usage examples for android.telephony SubscriptionManager getPhoneId

Introduction

In this page you can find the example usage for android.telephony SubscriptionManager getPhoneId.

Prototype

@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public static int getPhoneId(int subId) 

Source Link

Usage

From source file:com.android.mms.transaction.MessagingNotification.java

private static final NotificationInfo getNewIccMessageNotificationInfo(Context context, boolean isSms,
        String address, String message, String subject, int subId, long timeMillis, Bitmap attachmentBitmap,
        Contact contact, int attachmentType) {
    Intent clickIntent = new Intent(context, ManageSimMessages.class);
    clickIntent.setFlags(/*from w ww. j  av a2s  .co  m*/
            Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);

    clickIntent.putExtra(PhoneConstants.PHONE_KEY, SubscriptionManager.getPhoneId(subId));
    String senderInfo = buildTickerMessage(context, address, null, null).toString();
    String senderInfoName = senderInfo.substring(0, senderInfo.length());
    CharSequence simName = MessageUtils.getSimName(context, subId);
    CharSequence ticker = buildTickerMessage(context, address, subject, message);

    return new NotificationInfo(isSms, clickIntent, message, subject, simName, ticker, timeMillis,
            senderInfoName, attachmentBitmap, contact, attachmentType, 0);
}