Yawong
Yawong

Reputation: 33

How do I disable SIM slot 1 in Android API Level 27

I am trying to disable SIM Slot 1 in an application built in Kotlin. This application is for API Level 27(Android 8.1, will be part of built-in app in the ROM), and you can assume that I can gain whatever permissions from the system as we are dealing with the ROM build-in app.

In the Android source code of "android/telephony/TelephonyManager.java" I see this function.

setSimPowerStateForSlot(getSlotIndex(), powerUp)

But appearantly, I cannot get access to this method by calling

telephonyManager = this.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
telephonyManager!!.setSimPowerStateForSlot(0, powerDown)

I saw in another post that somebody have done this successfully, but can anybody to guide me how to do this?

Again, my goal is:

  1. Some routine here to check if the phone is in DSDS mode, and there is a SIM card inserted in SIM Slot 2. (Done work here)
  2. Turn off SIM 1 completely so that in the system, there is only one sim which is SIM 2 (Nolonger DSDS, and only allow SIM 2 to be active. SIM 1 shall not try to scan network nor try to register at all)

Upvotes: 3

Views: 1725

Answers (0)

Related Questions