SmsManager.InjectSmsPdu(Byte[], String, PendingIntent) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將 SMS PDU 注入 Android 應用程式框架。
[Android.Runtime.Register("injectSmsPdu", "([BLjava/lang/String;Landroid/app/PendingIntent;)V", "", ApiSince=22)]
public void InjectSmsPdu(byte[]? pdu, string? format, Android.App.PendingIntent? receivedIntent);
[<Android.Runtime.Register("injectSmsPdu", "([BLjava/lang/String;Landroid/app/PendingIntent;)V", "", ApiSince=22)>]
member this.InjectSmsPdu : byte[] * string * Android.App.PendingIntent -> unit
參數
- pdu
- Byte[]
是要注入 Android 應用程式框架的 PDU 位元組陣列
- format
- String
是 SMS PDU 的格式(SmsMessage#FORMAT_3GPP 或 SmsMessage#FORMAT_3GPP2)
- receivedIntent
- PendingIntent
若非 NULL,則當訊息被 Android 應用程式框架成功接收或失敗時,該訊息 PendingIntent 會被廣播。 此意圖在收到無線電的簡訊回覆時同步廣播。
結果代碼會顯示android.provider.Telephony.Sms.Intents#RESULT_SMS_HANDLED成功或android.provider.Telephony.Sms.Intents#RESULT_SMS_GENERIC_ERROR#RESULT_REMOTE_EXCEPTION錯誤。
- 屬性
備註
將 SMS PDU 注入 Android 應用程式框架。
需要授權: android.Manifest.permission#MODIFY_PHONE_STATE 或是每單位 android.telephony.TelephonyManager#hasCarrierPrivileges的承運人權限。
注意: 此方法設計給電信業者應用程式或電話框架內部使用,且永遠不會觸發 SMS 消歧義對話框。 若此方法在擁有多個有效訂閱的裝置上呼叫,且 SmsManager 該實例已建立為 #getDefault(),且未定義使用者定義的預設訂閱,則與此訊息相關的訂閱 ID 將為 INVALID,導致該簡訊被注入與邏輯槽 0 相關的訂閱。 用 #getSmsManagerForSubscriptionId(int) 來確保簡訊送達正確的訂閱單位。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。