telephonymanager

Since Android 6.0 listening to the PhoneStateListener.LISTEN_DATA_CONNECTION_STATE changes seems to no longer require READ_PHONE_STATE permission

点点圈 提交于 2020-02-26 14:37:42
问题 I'm applying Android 6.0 runtime permissions into an app which listens to carrier data connection state changes. I first tried to just remove the READ_PHONE_STATE from the manifest to check where the app requires the permission. To my surprise the app didn't crash at all. After this I've tried the same installation on two pre 6.0 devices which did actually crash on it. To me it seems like Android 6.0 does no longer require the permission. Is there any way to confirm this? The line below is

How to find target sim for an incoming call in dual sim android phone?

断了今生、忘了曾经 提交于 2020-01-24 17:24:31
问题 I am creating an android application in which I need to detect the target sim for an incoming call in dual sim phone. The Android API provides the access of only one SIM. I did googling about this but couldn't find the solution, All I found is that we can not detect the target SIM because this is depend upon the device manufactures. Is there any API available to detect the target SIM ? 回答1: in lollipop 22+ public class MessageReceiver extends BroadcastReceiver { @Override public void

TelephonyManager's PhoneStateListener is not called on Nougat

只愿长相守 提交于 2020-01-23 11:11:48
问题 I have made a sample app and the PhoneStateListener TelephonyManager telephony = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); //TelephonyManager object telephony.listen(new PhoneStateListener() { @Override public void onCallStateChanged(int state, String incomingNumber) { Log.i("brian", "call state = " + state + " incoming number " + incomingNumber); switch (state) { case TelephonyManager.CALL_STATE_IDLE: break; case TelephonyManager.CALL_STATE_RINGING: break; case

TelephonyManager's PhoneStateListener is not called on Nougat

江枫思渺然 提交于 2020-01-23 11:10:48
问题 I have made a sample app and the PhoneStateListener TelephonyManager telephony = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); //TelephonyManager object telephony.listen(new PhoneStateListener() { @Override public void onCallStateChanged(int state, String incomingNumber) { Log.i("brian", "call state = " + state + " incoming number " + incomingNumber); switch (state) { case TelephonyManager.CALL_STATE_IDLE: break; case TelephonyManager.CALL_STATE_RINGING: break; case

TelephonyManager's PhoneStateListener is not called on Nougat

空扰寡人 提交于 2020-01-23 11:09:04
问题 I have made a sample app and the PhoneStateListener TelephonyManager telephony = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); //TelephonyManager object telephony.listen(new PhoneStateListener() { @Override public void onCallStateChanged(int state, String incomingNumber) { Log.i("brian", "call state = " + state + " incoming number " + incomingNumber); switch (state) { case TelephonyManager.CALL_STATE_IDLE: break; case TelephonyManager.CALL_STATE_RINGING: break; case

How to distinguish the screen on/off status while incoming call?

喜夏-厌秋 提交于 2020-01-13 11:35:10
问题 My app uses the TelephonyManager.ACTION_PHONE_STATE_CHANGED for some actions. But I want a different action while the phone rang when the user was present (screen was on) and different action when the user was not present (screen was off). I tried the isScreenOn() method just in the beginning of onReceive (because when screen is off and there is incoming call, the screen stays off for a short while). No luck however - sometimes it works, sometimes not. The broadcast is asynchronous with the

get both simcard operator name in dual SIM mobile

∥☆過路亽.° 提交于 2020-01-13 05:36:11
问题 I want to know Both sim card's operator name when mobile is dual sim.In single SIM I got operator name programmatically But For duel SIM I can't although after so many search and try. If I run My app in dual sim phone than I can get both sim card operator name in my app For example : Idea,Vodafone. EDIT: Is anyone know How to get sim operator name of IMEI no then I have IMEI no. Code: public class MainActivity extends Activity { Button btnOne, btnTwo; TextView tvInfo; Context context;

Android: get CellID and RSS for Base Station and Neigboring Cells

南楼画角 提交于 2020-01-12 07:55:24
问题 I'm trying to get the following data: Base station: CellID and RSS (recognition which one is the base station) For all neigbouring stations: CellID and RSS There are various APIs and it looks like i'd have to use different APIs telephonyManager and PhoneStateListener. I'm a littlebit confused, as I think this should be available in one interface. Also I think that it should be possible to poll the CellID of the current Base Station instead of having to listen to State Changes to determine int

Trouble with reading phone state

瘦欲@ 提交于 2020-01-11 09:58:21
问题 I want to perform some operation (Pause game) in my application when a call came. But reading the phone state is not working. I have given permission(READ_PHONE_STATE) in the manifest. Nothing is happen when a call came. Thanks. TelephonyManager telephonyManager; PhoneStateListener listener; telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); * * * listener = new PhoneStateListener() { @Override public void onCallStateChanged(int state, String incomingNumber) {

Android Nougat PhoneStateListener is not triggered

旧城冷巷雨未停 提交于 2020-01-11 05:26:07
问题 In Android (target 25) I have a background service and in onCreate function I have initialized a phone state listener. It works fine on Android versions that are before Nougat but in Nougat it doesn't work, even though the permissions are granted. public class Service extends IntentService { class PhoneListener extends PhoneStateListener { String TAG = getClass().getName(); @Override public void onCallStateChanged(int state, String incomingNumber) { super.onCallStateChanged(state,