telephonymanager

Android, TelephonyManager, the joys of PhoneStateListener and incoming numbers

笑着哭i 提交于 2019-12-22 02:02:09
问题 I've very newly gotten into Android development, and decided that my first conquest on this fresh field would be to grasp how the phone reacted to incoming calls. A little googling later led me to http://www.compiletimeerror.com/2013/08/android-call-state-listener-example.html#.Vi3Ren4vfwM (so my code shares a striking resemblance to his/hers). My main (and only) activity looks like this: import android.app.Activity; import android.content.Context; import android.os.Bundle; import android

get last Call on CallLog using a Service

假如想象 提交于 2019-12-22 01:17: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

Get the number I am calling in Android

百般思念 提交于 2019-12-22 00:35:13
问题 I need to get the number that I am calling from my Android device programmatically. What I'm doing now is the following: I listen for android.intent.action.PHONE_STATE being broadcasted which means that either I am being called or am calling (or receiving an SMS etc). In a BroadcastReceiver I retrieve the extra incoming_number from the intent. Sadly I cannot get the number which is being called if I initiate the call though. How can I do this? 回答1: You need to use the Intent android.intent

How to track the messages in Android?

夙愿已清 提交于 2019-12-20 10:49:35
问题 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

MNC and MCC of a secondary SIM

旧街凉风 提交于 2019-12-20 04:12:17
问题 I know that using TelephonyManager we can get MNC and MCC of our network provider, TelephonyManager tel = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); String networkOperator = tel.getNetworkOperator(); if (networkOperator != null) { int mcc = Integer.parseInt(networkOperator.substring(0, 3)); int mnc = Integer.parseInt(networkOperator.substring(3)); } But I was able to get MNC and MCC data of only primary sim. I would like to know is there a way to fetch mnc,mcc,lac and

MNC and MCC of a secondary SIM

家住魔仙堡 提交于 2019-12-20 04:12:04
问题 I know that using TelephonyManager we can get MNC and MCC of our network provider, TelephonyManager tel = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); String networkOperator = tel.getNetworkOperator(); if (networkOperator != null) { int mcc = Integer.parseInt(networkOperator.substring(0, 3)); int mnc = Integer.parseInt(networkOperator.substring(3)); } But I was able to get MNC and MCC data of only primary sim. I would like to know is there a way to fetch mnc,mcc,lac and

How to detect a call Drop in android

南笙酒味 提交于 2019-12-20 01:49:07
问题 I'm writing an app that runs on background during a telephone conversation and logs the coordinates to a file after the conversation has end,I know Android telephony API can detect a call manual disconnect by user*(correct me,if I'm wrong)*, But what I want is to know whether the service disconnection have caused due to call drop,is there a way or an API I can use to achieve this, All what I need is to programmatically differentiate a disconnected call and a dropped call. Please help. 回答1:

How to send fake call broadcast on android

拜拜、爱过 提交于 2019-12-19 04:21:47
问题 I am trying to send a broadcast to simulate an incoming call. I added the permission in AndroidManifest.xml file, <uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission> When I try to run the program, the phone reboots.(Emulator too). Intent intent = new Intent(); intent.setAction("android.intent.action.PHONE_STATE"); intent.putExtra(TelephonyManager.EXTRA_STATE, TelephonyManager.CALL_STATE_RINGING); intent.putExtra("EXTRA_INCOMING_NUMBER", "923982398"); intent

How to send fake call broadcast on android

纵饮孤独 提交于 2019-12-19 04:21:10
问题 I am trying to send a broadcast to simulate an incoming call. I added the permission in AndroidManifest.xml file, <uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission> When I try to run the program, the phone reboots.(Emulator too). Intent intent = new Intent(); intent.setAction("android.intent.action.PHONE_STATE"); intent.putExtra(TelephonyManager.EXTRA_STATE, TelephonyManager.CALL_STATE_RINGING); intent.putExtra("EXTRA_INCOMING_NUMBER", "923982398"); intent

Get RSRP from CellSignalStrengthLte for Android app API 17+

我与影子孤独终老i 提交于 2019-12-19 04:12:46
问题 A few people over the past decade have asked similar questions but none have ANY answers. I need to write an android app that collects and stores RSRP, RSRQ, CINR, and Cell ID. The answers need to be as accurate as the phones hardware allows (I am testing on Samsung Galaxy S5) because I need to do post processing statistics with those values. Does anyone know how to use telephonyManager or CellSignalStrengthLte to get RSRP? Or is there another, perhaps better way to get RSRP? So far the best