語言

SubscriptionManager.SetOpportunistic(Boolean, Int32) 方法

定義

設定訂閱是否屬於機會性,也就是所連接的網路覆蓋範圍是否有限。

[Android.Runtime.Register("setOpportunistic", "(ZI)Z", "GetSetOpportunistic_ZIHandler", ApiSince=29)]
[Android.Runtime.RequiresPermission("android.permission.MODIFY_PHONE_STATE")]
public virtual bool SetOpportunistic(bool opportunistic, int subId);
[<Android.Runtime.Register("setOpportunistic", "(ZI)Z", "GetSetOpportunistic_ZIHandler", ApiSince=29)>]
[<Android.Runtime.RequiresPermission("android.permission.MODIFY_PHONE_STATE")>]
abstract member SetOpportunistic : bool * int -> bool
override this.SetOpportunistic : bool * int -> bool

參數

opportunistic
Boolean

不管是投機購訂。

subId
Int32

資料庫中獨特的 SubscriptionInfo 索引

傳回

true 如果操作成功, false 否則。

屬性

備註

設定訂閱是否屬於機會性,也就是所連接的網路覆蓋範圍是否有限。 例如,CBRS。 設定機會訂閱有以下影響:1) 即使訂閱有效,大部分時間仍處於休眠狀態。 數據機不會嘗試掃描或守備,直到確定附近有可用的網路以節省電力。 2) 電話系統依賴系統應用程式或電信業者的輸入來通知附近的可用網路。 如需相關資訊,請參閱 TelephonyManager#updateAvailableNetworks(List, Executor, Consumer) 。 3) 在多SIM裝置中,當網路靠近且被鎖定時,系統會根據電信業者建議、訊號強度和計量程度等,自動在網路與預設數據訂閱之間切換網路資料。

來電者將擁有 android.Manifest.permission#MODIFY_PHONE_STATE 或營運商的訂閱權限。

Java 文件 android.telephony.SubscriptionManager.setOpportunistic(boolean, int)。

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於