telephony

Change mobile network mode (gsm, wcdma, auto)

≡放荡痞女 提交于 2019-11-27 01:54:48
问题 I want to change the preferred network mode ie. gsm or wcdma or auto, programmatically, from code, on Android. Is this possible, and if so how ? 回答1: Answer is NO We can open directly the settings app of mobile network settings to switch between "2G" and "allow 3G" networks.A direct switch is sadly not possible. We can develop something which will show current network and allow user short-cut from the app where they can switch network. 回答2: It is possible, I did it. For this to work, your app

How to end an incoming call programmatically on Android 8.0 Oreo

旧时模样 提交于 2019-11-26 22:24:41
问题 Up to Android 7.1 it was possible to end an incoming call by using the ITelephony.endCall() method and giving your app the permissions android.permission.CALL_PHONE and android.permission.READ_PHONE_STATE . When doing the same on Android 8.0 Oreo (API 26) , i get this error 12-09 18:11:25.195 16833-16833/li.doerf.leavemealone E/TelephonyServiceCallHangup: Missing permission MODIFY_PHONE_STATE, cannot hangup call Since MODIFY_PHONE_STATE is a protected permission, my app cannot get it. Is

How do I get state of a outgoing call in android phone?

浪子不回头ぞ 提交于 2019-11-26 21:54:52
问题 I noticed in the class TelephonyManager there are CALL_STATE_IDLE, CALL_STATE_OFFHOOK and CALL_STATE_RINGING. They seem to be used for incoming calls. What I actually want to do is to be notified when an outgoing call is made, is received, or timed out. How to do that? 回答1: From what I understand, you can detect that an outgoing call has been initiated because the phone state changes from idle to offhook. However, from there, knowing the state of that call- ie knowing if the call you are

How to get phone number from an incoming call?

坚强是说给别人听的谎言 提交于 2019-11-26 19:54:20
How do I get the phone number when there is an incoming call in Android? Azhar Shaikh Make a Broadcast receiver say ServiceReceiver assign its action in Manifest. <receiver android:name=".ServiceReceiver" > <intent-filter> <action android:name="android.intent.action.PHONE_STATE" /> </intent-filter> </receiver> Add a PhoneStateListener to your TelephonyManager, PhoneStateListener having override onCallStateChanged() with Incoming number parameter. Thats it. ServiceReceiver.Java public class ServiceReceiver extends BroadcastReceiver { @Override public void onReceive(final Context context, Intent

Sending DTMF tones over the uplink in-call

微笑、不失礼 提交于 2019-11-26 19:25:01
问题 I'm working on a project that requires my app to be able to send DTMF tones on the voice's uplink frequency during an active call. My 2 conditions are: We don't use a customized Android platform We don't need to root the phone I've spent several days doing my homework and am aware that in-call DTMF sending is not supported by the current SDK/standard APIs. However, by using the relevant classes in com.android.internal.telephony I am hoping to mimic how the native Phone app does this. I

how to resolve this error “com.android.internal.telephony cannot be resolved to a type” in android

谁都会走 提交于 2019-11-26 14:06:14
问题 i am creating simple call filter application which restrict unwanted calls. i use following code to restrict call but i am unable to resole problem of this line in below code " com.android.internal.telephony.ITelephony telephonyService = (ITelephony) m.invoke(tm); " it show the error message com.android.internal.telephony cannot be resolved to a type in android how to resolve this error . public class CallBlockReceiver extends BroadcastReceiver{ @Override public void onReceive(Context context

Get Signal Strength in Android

荒凉一梦 提交于 2019-11-26 13:03:35
问题 I want to get the Signal Strength of the Device at the point I hit the API call. I have searched on all the related threads and I am not successful yet. So I would like to get the signal strength like SignalStrength ss = null ; // some initialization int n = ss.getGsmSignalStrength(); But while using this, it is obvious that I will get null pointer exception since I have initialised SignalStrength as null. But I don\'t know how to initialise this. Also that I don\'t want to use

Detect if an outgoing call has been answered

这一生的挚爱 提交于 2019-11-26 12:20:26
Once ACTION_NEW_OUTGOING_CALL has been broadcasted, I need to capture the following event of the other party answer. Could you advice on how to achieve that please? I know it is possible as the android dialer app changes the green android icon to the person's photo excatly when they pick up. Thanks! UPDATED: I've had a look at the source of the app on Android handling the outgoing calls. I noticed the following method in ContactsUtils : /** * Kick off an intent to initiate a call. */ public static void initiateCall(Context context, CharSequence phoneNumber) { Intent intent = new Intent(Intent

end incoming call programmatically

安稳与你 提交于 2019-11-26 12:04:21
问题 This is a familiar question in SO. and what I need is to end call programmatically. I have searched a lot... http://androidsourcecode.blogspot.in/2010/10/blocking-incoming-call-android.html http://androiddesk.wordpress.com/2012/08/02/blocking-a-call-without-user-intervention-in-android/ Rejecting Incoming call in android How to programmatically answer/end a call in Android 4.1? http://www.emoticode.net/android-sdk/block-incoming-and-outgoing-phone-calls-programmatically.html How to block

How to detect when phone is answered or rejected

ぃ、小莉子 提交于 2019-11-26 11:47:59
I managed to prepare an activity when the phone is ringing. Now I need to know how to cancel this activity when I anwser the phone or I reject the call.Do I call EXTRA_STATE_IDLE?EXTRA_STATE_OFFHOOK? Any ideas? <receiver android:name=".IncomingBroadcastReceiver"> <intent-filter> <action android:name="android.intent.action.PHONE_STATE"/> </intent-filter> </receiver> public class IncomingBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE); // If an incoming call arrives