telephonymanager

Get mobile Number on GSM Mobile using android code

折月煮酒 提交于 2019-12-08 01:59:59
问题 I am using following android code to get mobile number and it's working on android emulators only: TelephonyManager tm =(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); String number = tm.getLine1Number(); But when I tested it in real device ( Samsung Galaxy Chat B5330 ) it gives nothing (Empty String) Please help with some code snippet. 回答1: For GSM, the phone number is on the SIM card, and some carriers just don't put it on the card, and then the phone does not know what it is

Android - Navigating through USSD menu using pre-determined inputs sent via requests

妖精的绣舞 提交于 2019-12-08 01:54:39
问题 I am planning to create an Android App that will automate sending a users response to a USSD Menu. At a click of a button, the app will send the initial code, followed by the rest of the menu inputs. For example, the initial number is *143#, followed by 1, 1, 1, and a user PIN. I'd like to be able to automate that sequence of inputs so that the user won't have to input it on their own. I know that in Android Oreo, they implemented a USSD Callback using the TelephonyManager, where the Android

Handling Incoming calls in android application

无人久伴 提交于 2019-12-07 20:46:44
问题 I have developed a music related android application. I have a problem in handling the mediaplayer on incoming call. I want to pause the audio during the phonecall and resume it back after the call gets ended. I need suggestions whether to use TelephonyManager with onstatechanged to pause and resume the audio (OR ) any other methods to pause and resume the application itself during Incoming calls. 回答1: use onPause() and onResume() methods in your activity. When an incoming call comes, onPause

Why is getNetworkOperator not reliable for CDMA?

僤鯓⒐⒋嵵緔 提交于 2019-12-07 07:05:38
问题 Can anyone say why the documentation for the getNetworkOperator function of TelephonyManager states that this can return unreliable result for CDMA ? getNetworkOperator documentation Availability: Only when user is registered to a network. Result may be unreliable on CDMA networks (use getPhoneType() to determine if on a CDMA network). What kind of results are you getting when calling this method on a CDMA device ? and if it's not reliable, How can I get the MCC for a CDMA device ? 回答1: I

how to find outgoing number in Telephony manager

a 夏天 提交于 2019-12-07 04:43:39
问题 I am using this: public void onCallStateChanged(int state, String incomingNumber) which is listening to: telephonyManager.listen(listener,PhoneStateListener.LISTEN_CALL_STATE); I want to know both outgoing and incoming calls but for now I only get incoming calls (when state changes is ringing). Can anyone tell me when can I detect outgoing call and its end Also is there a way to simulate outgoing calls in Eclipse emulator. was able to do that for incoming calls via emulator control in eclipse

How to determine a call made is local or STD OR ISD

南楼画角 提交于 2019-12-07 04:05:23
问题 I am developing an application which requires to keep track of the outgoing calls made by user, which I am able to track by Using Broadcast Receiver. I also want to detect that is that call is Local or STD or ISD, but I am not able to detect that. 回答1: Suppose, you know to which State (Telecom Circles) the outgoing call is going. Then you just need to check if your Local-State (Telecom Circles) is same as Outgoing-call-State (Telecom Circles) or not. If it is same, then local call else STD

Android still detects cellular signal strength while no cellular network connected

别等时光非礼了梦想. 提交于 2019-12-06 16:52:59
I wrote a little Android program to detect cellular signal strength. I inserted an expired SIM card into my phone, it displayed zero signal in status bar. However, the following code returns Signal strength equals to 22 . public class WelcomeActivity extends AppCompatActivity { TelephonyManager telephonyManager; CustomPhoneStateListener customPhoneStateListener; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_welcome); customPhoneStateListener = new CustomPhoneStateListener(); telephonyManager =

Handling Incoming calls in android application

被刻印的时光 ゝ 提交于 2019-12-06 14:01:14
I have developed a music related android application. I have a problem in handling the mediaplayer on incoming call. I want to pause the audio during the phonecall and resume it back after the call gets ended. I need suggestions whether to use TelephonyManager with onstatechanged to pause and resume the audio (OR ) any other methods to pause and resume the application itself during Incoming calls. use onPause() and onResume() methods in your activity. When an incoming call comes, onPause() method is called. and onResume() is called when call is hung up. This will work even if the user clicks

How to get Operator Name for SIM in slave slot?

回眸只為那壹抹淺笑 提交于 2019-12-06 13:33:39
问题 For dual SIM device how to getNetworkOperatorName which is in slave slot. And my master SIM is deactivated. 回答1: I didn't find anything on android API to get all SIM operators details. Only we can get the name of the Current Network Operator or SIM operator TelephonyManager telephonyManager =((TelephonyManager) Context.getSystemService(Context.TELEPHONY_SERVICE)); String operatorName = telephonyManager.getNetworkOperatorName(); SIM operator can be retrieved by using: String operatorName =

Check if a sim card Network service is available or not

ⅰ亾dé卋堺 提交于 2019-12-06 11:54:09
问题 Hi I am developing an application that changes a button according to the SIM STATE I am using 1 for NO SIM and 5 for SIM READY In few case I have no service for example, if the SIM card is an international card , It doesn't work in other places. What is the SIM State for this type of condition. Please suggest how to check when there is a SIM card but no service. Thanks! 回答1: Hi Please can you try this code... ref link : https://stackoverflow.com/a/3982768/900338 TelephonyManager telMgr =