phone-state-listener

TelephonyManager.CALL_STATE_RINGING calls twice while one call ringing

為{幸葍}努か 提交于 2019-12-11 01:28:49
问题 I use descendant - class of PhoneStateListener: class CallStateListener extends PhoneStateListener { @Override public void onCallStateChanged(int state, String incomingNumber) { switch (state) { case TelephonyManager.CALL_STATE_RINGING: if (incomingNumber!=null) { // code for incoming call handling } break; } super.onCallStateChanged(state, incomingNumber); } this is my BroadcastReceiver: class ServiceReceiver extends BroadcastReceiver { CallStateListener phoneListener; @Override public void

Using BroadcastReceiver with functionality of PhoneStateListener

五迷三道 提交于 2019-12-09 00:57:15
问题 I am trying to make a MissCall App which sends a message automatically when a miss call is received. I had completed my app and it worked fine ! Here is the complete scenario : Problem : The app was working fine but when i restarted the device the app didn't work ! . It only worked when i started my App atleast once after that it worked fine till it is switched off . Here is my code : package com.example.misscallapp; import android.content.Context; import android.content.Intent; import

Is there any way to know if an outgoing call is accepted?

回眸只為那壹抹淺笑 提交于 2019-12-08 09:31:30
问题 I'm doing an app that record call (both of them, incoming and outgoing calls). I've just resolved the problem of recording audio from incoming calls, but I've found some troubles with outgoing calls. My situation is next. I'd like to record audio only when the call is accepted, but I don't know how to do it. I've just tried using PhoneStateListener class, but the call state doesn't change when the call is accepted. I've next code: package com.call.record.listeners; import android.telephony

PhoneStateListener memory leak - android

纵饮孤独 提交于 2019-12-08 06:46:20
问题 I am having issue with memory after running many times my app. java.lang.OutOfMemoryError: bitmap size exceeds VM budget I figure I was leaking memory somehow so I did a DUMP HPROF file and used the MAT tool to figure out what was wrong. It turns out that after running like 5 times the app and quiting, I find 5 instances of my Activity and 5 instances of PhoneStateListener. If I remove the call to PhoneStateListener, I don't have that issue anymore and I see just 1 instance of my Activity.

How to get the outgoing call duration in real time?

左心房为你撑大大i 提交于 2019-12-07 22:21:02
问题 I have a activity which is brought in front whenever there are any outgoing call. I need the outgoing call duration in real time and show it in my activity textview. Is this possible to get the current duration if call is in offhook? 回答1: This can be done. You just have to Spy on Android Call Log Content Provider . To use a content provider, you just need to call the getContentResolver() method. Once you have a content resolver object, you can query it using SQL or any of the built in query

Read numbers from the PHONE_STATE intent action android 9 Not working

丶灬走出姿态 提交于 2019-12-07 02:28:33
问题 I was trying to retrieve the phone number from intent extra through onrecieve() method for the following broadcast receiver registered in manifest file. <intent-filter> <action android:name="android.intent.action.PHONE_STATE" /> <action android:name="android.intent.action.NEW_OUTGOING_CALL" /> </intent-filter> I can successfully able to read the phone number for all the version except android pie upgraded in my pixel 2 device. According to the documentation, app requires additional permission

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 =

Incoming number during a call in android?

北战南征 提交于 2019-12-06 10:09:04
问题 I am running following code, its compiling but I am not getting any result or toast displayed please help... CustomBroadcastReceiver.java this class will receive the action phone state change and will instantiate the customephonestatelistener public class CustomBroadcastReceiver extends BroadcastReceiver { TelephonyManager telephony = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE); CustomPhoneStateListener customPhoneListener = new CustomPhoneStateListener(context);

How to get the outgoing call duration in real time?

大城市里の小女人 提交于 2019-12-06 05:05:49
I have a activity which is brought in front whenever there are any outgoing call. I need the outgoing call duration in real time and show it in my activity textview. Is this possible to get the current duration if call is in offhook? The Dark Knight This can be done. You just have to Spy on Android Call Log Content Provider . To use a content provider, you just need to call the getContentResolver() method. Once you have a content resolver object, you can query it using SQL or any of the built in query functions. For example, in my Android App, I use a piece of code that looks like this: String

Incoming number during a call in android?

淺唱寂寞╮ 提交于 2019-12-04 17:41:23
I am running following code, its compiling but I am not getting any result or toast displayed please help... CustomBroadcastReceiver.java this class will receive the action phone state change and will instantiate the customephonestatelistener public class CustomBroadcastReceiver extends BroadcastReceiver { TelephonyManager telephony = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE); CustomPhoneStateListener customPhoneListener = new CustomPhoneStateListener(context); telephony.listen(customPhoneListener, PhoneStateListener.LISTEN_CALL_STATE); Bundle bundle = intent