telephonymanager

java.lang.NoSuchMethodError: No virtual method getMccString()Ljava/lang/String;

给你一囗甜甜゛ 提交于 2021-02-10 05:16:16
问题 I am retrieving cell information data ( CellInfo ) from TelephonyManager For each cell info object, I am querying for mcc (Mobile Country Code) and mnc (Mobile Network Code) via eachCellInfo.cellIdentity.mcc eachCellInfo.cellIdentity.mnc Where eachCellInfo is an object of CellInfo The function is deprecated as per the doc: /** * @return 2 or 3-digit Mobile Network Code, 0..999, Integer.MAX_VALUE if unknown * @deprecated Use {@link #getMncString} instead. */ @Deprecated public int getMnc() {

java.lang.NoSuchMethodError: No virtual method getMccString()Ljava/lang/String;

我的梦境 提交于 2021-02-10 05:14:15
问题 I am retrieving cell information data ( CellInfo ) from TelephonyManager For each cell info object, I am querying for mcc (Mobile Country Code) and mnc (Mobile Network Code) via eachCellInfo.cellIdentity.mcc eachCellInfo.cellIdentity.mnc Where eachCellInfo is an object of CellInfo The function is deprecated as per the doc: /** * @return 2 or 3-digit Mobile Network Code, 0..999, Integer.MAX_VALUE if unknown * @deprecated Use {@link #getMncString} instead. */ @Deprecated public int getMnc() {

getAllCellInfo in dual SIM

血红的双手。 提交于 2021-02-09 07:30:48
问题 Does anyone know if the cell indexes on the list returned from TelephonyManager.getAllCellInfo() are related to SIM slot numbers? I'm using Android API 24... After experimenting a bit, it seems that running the method updateCellInfo - described below - always returns a list where it's first index corresponds to device's last SIM slot, and it's last index corresponds to device's first SIM slot. Can anybody confirm this? Is this correlation plausible? private ArrayList<CellInfo> updateCellInfo

getAllCellInfo in dual SIM

馋奶兔 提交于 2021-02-09 07:27:10
问题 Does anyone know if the cell indexes on the list returned from TelephonyManager.getAllCellInfo() are related to SIM slot numbers? I'm using Android API 24... After experimenting a bit, it seems that running the method updateCellInfo - described below - always returns a list where it's first index corresponds to device's last SIM slot, and it's last index corresponds to device's first SIM slot. Can anybody confirm this? Is this correlation plausible? private ArrayList<CellInfo> updateCellInfo

Get incoming call number programmatically on android

偶尔善良 提交于 2021-02-08 08:06:34
问题 I am trying to get incoming call info using broadcast receivers on android studio. following are the methods i tried: <receiver android:name=".receivers.IncomingCalls"> <intent-filter> <action android:name="android.intent.action.PHONE_STATE" /> </intent-filter> </receiver> On this receiver's intent i tried: Method one: incnumber=intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER); Method two: final String state1 = intent.getStringExtra(TelephonyManager.EXTRA_STATE); telephony.listen

How to know Phone call has ended?

ⅰ亾dé卋堺 提交于 2021-02-08 03:59:54
问题 What is current Phone state at the time of call end. In android there are three states. TelephonyManager.CALL_STATE_IDLE TelephonyManager.CALL_STATE_OFFHOOK TelephonyManager.CALL_STATE_RINGING: 回答1: This code works for me. Hope it will help you import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.telephony.TelephonyManager; import android.util.Log; public class CallStateReceiver extends

Getting phone state in Xamarin

寵の児 提交于 2021-01-28 18:16:59
问题 I have following code: public class StateListener : PhoneStateListener { StateListener phoneStateListener = new StateListener(); TelephonyManager telephonyManager = (TelephonyManager)GetSystemService(Context.TelephonyService); telephonyManager.Listen(phoneStateListender, PhoneStateListenerFlags.CallState); public void onCallStateChanged(CallState state, String incomingNumber) { base.OnCallStateChanged(state, incomingNumber); switch (state) { case CallState.Ringing: break; case CallState

In android. Check whether mobile data is on or off

夙愿已清 提交于 2021-01-07 02:47:58
问题 My app need a function to check user's mobile phone has turned on the mobile data or not. I have referenced this link: #32239785 Here is the code provided in that topic boolean mobileYN = false; TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); if (tm.getSimState() == TelephonyManager.SIM_STATE_READY) { if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) { mobileYN = Settings.Global.getInt(context.getContentResolver(),

In android. Check whether mobile data is on or off

限于喜欢 提交于 2021-01-07 02:43:42
问题 My app need a function to check user's mobile phone has turned on the mobile data or not. I have referenced this link: #32239785 Here is the code provided in that topic boolean mobileYN = false; TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); if (tm.getSimState() == TelephonyManager.SIM_STATE_READY) { if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) { mobileYN = Settings.Global.getInt(context.getContentResolver(),

Telephonymanager.EXTRA_INCOMING_NUMBER is deprecated in API level 29

社会主义新天地 提交于 2020-12-26 18:38:24
问题 I am in situation where I need to identify incoming call phone number in Android but when using TelephonyManager.EXTRA_INCOMING_NUMBER android studio warning EXTRA_INCOMING_NUMBER is deprecated .I gone through the developers.android.com, it shows apps performing call screening should use the CallScreeningService API instead. But I can't figure out how to use CallScreeningService to get incoming call phone number. Anyone can help me? 回答1: As @Saurabh said, the new way to screen calls is