telephonymanager

Interrupt incoming call in android

雨燕双飞 提交于 2019-11-30 18:49:25
问题 How to open a custom UI on incoming call with answer and reject button on it,I want to show custom UI instead of default dialer. I am using below code but dialer is open and my activity is not opened: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.callintruptdemo" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="17" /> <uses-permission android

Detect target phone number on incoming call [duplicate]

青春壹個敷衍的年華 提交于 2019-11-30 18:04:03
问题 This question already has answers here : Detect target phone number on incoming call is it for SIM 1 or for SIM 2? (3 answers) Closed 18 days ago . I have an Android phone with 2 SIM card and I want to detect the target of the incoming call — is it for SIM 1 or for SIM 2. Is it possible to get the target number from call info? 回答1: Your question dosent have answers in the documentations... But I found out some links that may help you out: Checking for dual sim. Question regarding ui. 来源:

What does the different Call states in the Android telephony stack represent?

本秂侑毒 提交于 2019-11-30 13:40:16
The internal Android class com.android.internal.telephony.Call contains an enum called State and defined as follows: public enum State { IDLE, ACTIVE, HOLDING, DIALING, ALERTING, INCOMING, WAITING, DISCONNECTED, DISCONNECTING; public boolean isAlive() { return !(this == IDLE || this == DISCONNECTED || this == DISCONNECTING); } public boolean isRinging() { return this == INCOMING || this == WAITING; } public boolean isDialing() { return this == DIALING || this == ALERTING; } } What does the different states represent? Okay, this is my own attempt at answering the question: /** Call is idle. */

Disable mobile network programmatically

ε祈祈猫儿з 提交于 2019-11-30 13:33:26
问题 I'm developing an app in which user can enable/disable mobile network on button click. I googled regarding this, but I get the solution of Airplane mode only. In airplane mode, WI-FI and Bluetooth are also disabled. I don't want them to disable by using airplane mode concept. I want only mobile network to be disabled. What are the possible way to implement it pro-grammatically? 回答1: Mobile data is a Global setting (formerly Secure setting). According to the documentation Global system

Android Handle phone call

别来无恙 提交于 2019-11-30 09:26:05
I have audio recording, when a phone call come I need to stop the recording, how can I do this? You have to use the PhoneStateListener : TelephonyManager tm = (TelephonyManager)getSystemService(TELEPHONY_SERVICE); tm.listen(mPhoneListener, PhoneStateListener.LISTEN_CALL_STATE); // somewhere else private PhoneStateListener mPhoneListener = new PhoneStateListener() { public void onCallStateChanged(int state, String incomingNumber) { try { switch (state) { case TelephonyManager.CALL_STATE_RINGING: // do something... break; case TelephonyManager.CALL_STATE_OFFHOOK: // do something... break; case

Broadcast Receiver not working when registered via manifest

穿精又带淫゛_ 提交于 2019-11-30 09:25:14
问题 Trying to setup a simple broadcast receiver in the manifest of an Android app, to detect when the phone is ringing and start a service. Its not receiving the broadcast when a call comes in, no log output, nada. I tried the android.intent.action.PHONE_STATE action and also the TelephonyManager.ACTION_PHONE_STATE_CHANGED in the manifest, neither did anything for me. <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="

How do i get the carrier name of an incoming number in android..?

为君一笑 提交于 2019-11-30 08:55:35
问题 I am able to get the carrier name using the following snippet : TelephonyManager telephonyManager = ((TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE)); String operatorName = telephonyManager.getNetworkOperatorName(); It works really fine. I am also able to get the incoming call number using the following snippet: private final PhoneStateListener phoneStateListener = new PhoneStateListener() { @Override public void onCallStateChanged(int state, String incomingNumber) {

Disable mobile network programmatically

流过昼夜 提交于 2019-11-30 07:46:32
I'm developing an app in which user can enable/disable mobile network on button click. I googled regarding this, but I get the solution of Airplane mode only. In airplane mode, WI-FI and Bluetooth are also disabled. I don't want them to disable by using airplane mode concept. I want only mobile network to be disabled. What are the possible way to implement it pro-grammatically? Mobile data is a Global setting (formerly Secure setting). According to the documentation Global system settings, containing preferences that always apply identically to all defined users. Applications can read these

How to track the messages in Android?

末鹿安然 提交于 2019-11-30 05:41:48
I want to develop an app which tracks the sent/received SMSs. I mean, when a user sends a message from its device, the message detail should be saved to a table provided by me. Similarly, when the device receives any SMS, then that also should be saved into a table provided by me. Note that the user uses the default message application of Android to send message. I mean I am not integrating my application with the default message application. I just need to keep track of all messages sent from that application as Android keeps track of all sent messages in Sent Message folder of its Message

TelephonyManager returns null for IMEI number: what can cause this?

我们两清 提交于 2019-11-30 03:26:37
问题 I'm working on an Android app and am getting null back for the IMEI number when using TelophonyManager . This is happening on several Huawei phones. (All of them are Ascend Y530s). The phones all have sim cards and otherwise seem to be operating normally. I was under the impression that only a broken phone would return null IMEI. Clearly this is not the case.. Questions. What exactly is this IMEI number - i.e where is it stored on the device? And what does it mean when a seemingly fine phone