telephonymanager

Answer phone call

偶尔善良 提交于 2019-12-06 11:45:58
问题 I need to accept automatically phone calls (depending on source phone number). At this time, I can end incoming calls, but can't accept'em. I've found several examples and this is what I have at this moment. Add to AndroidManifest: <permission android:name="android.permission.MODIFY_PHONE_STATE" /> <uses-permission android:name="android.permission.MODIFY_PHONE_STATE" /> <uses-permission android:name="android.permission.CALL_PHONE" /> ... <receiver android:name=".panic.IncomingCallReceiver">

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

佐手、 提交于 2019-12-06 07:45:56
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 App can send a USSD Request, and then read the response given. I am currently exploring that option and

outgoing call detect in PhoneStateListener

╄→гoц情女王★ 提交于 2019-12-06 04:35:37
I want to detect outgoing call in android application . Actually I can detect outgoing calls but it is also working for incoming too and I don't want that. I need it to work only for outgoing. here is my code.... boolean ringing = false; boolean offhook = false; public void onCallStateChanged(int state, String incomingNumber) { switch (state) { case TelephonyManager.CALL_STATE_IDLE: if((!ringing)&& offhook){ ///incomming call } break; case TelephonyManager.CALL_STATE_RINGING: callerPhoneNumber = incomingNumber; Log.d(TAG, "RINGING"); ringing = true; offhook = false; break; case

ending call in android using telephonyserivce.endcall()

好久不见. 提交于 2019-12-06 02:27:16
I am working on app where i want to end outgoing call. this is the main class import android.app.Activity; import android.content.ActivityNotFoundException; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.util.Log; public class phonecalls extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); call(); } private void call() { try { Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri

Why is getNetworkOperator not reliable for CDMA?

折月煮酒 提交于 2019-12-05 16:08:50
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 ? I know this is an old question, but maybe is useful to other people. I don't know what returns from some CDMA

getAllCellInfo() returns an empty list in Huawei Honor 7

假装没事ソ 提交于 2019-12-05 12:09:13
I am having an android application that fetches information of cell towers. I use this getAllCellInfo() to fetch info of a primary cell and neighbour cells. I included the ACCESS_COARSE_LOCATION permission to manifest.xml and make a request for the permission in runtime. It works in other phones but in Huawei Honor 7, the function returns an empty list. My code: Catlog: I have checked other people questions: getAllCellInfo returns null in android 4.2.1 and Android getAllCellInfo() returns null . From a question, I thought for Huawei phones, they don't support getAllCellInfo() until I installed

setRingerMode during incoming call - RINGING

孤者浪人 提交于 2019-12-05 09:59:47
问题 I have a task - change the ringer volume immediately when phone ringing. For example: After detecting, that there is incoming call I need to set ringer volume to 0 (mute) and vibrator also should be disabled (if it not disabled already). Then there is delay when I need to perform another code (startComputing();). After that ringer volume should be changed to certain value (f.e.7) and vibrator should be activated. Here is my code: public class IncomingCallReceiver extends BroadcastReceiver {

How to get Operator Name for SIM in slave slot?

蓝咒 提交于 2019-12-04 19:37:26
For dual SIM device how to getNetworkOperatorName which is in slave slot. And my master SIM is deactivated. Sunil Kumar Sahoo 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 = telephonyManager.getSimOperatorName(); You need to use SubscriptionManager 's

get last Call on CallLog using a Service

血红的双手。 提交于 2019-12-04 18:24:23
I'm doing a program to send the CallLog to a Server, I created a Service that makes a poll of the telephone status with the following method. This method is called onCreate. private void pollForCallStatus() { timer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { Log.d("Poll", Integer.toString(telephonyManager.getCallState())); switch (telephonyManager.getCallState()){ case TelephonyManager.CALL_STATE_RINGING: Log.d("CallService", "ringing"); break; case TelephonyManager.CALL_STATE_OFFHOOK: callStart(); break; case TelephonyManager.CALL_STATE_IDLE: callEnd(); break; } } }, 0

Android signal strength

做~自己de王妃 提交于 2019-12-04 18:11:06
Is there any method to get signal strength on both sim cards. I search a lot but I couldn't find any solution. Maybe is there any method to register receiver on second sim card ? I'm working on Android 5.0 and I know that on this version Android officially does not support dual sim solutions. I found only this which nearly fits to me: Check whether the phone is dual SIM Android dual SIM signal strength Second link presents some way but I cannot use it because method TelephonyManager.listenGemini is not available Any help ? Please note : the following is specific to some Android 5.0 devices. It