Questions tagged [telephonymanager]

Telephony class for Android devices

A class that provides access to information about the telephony services on an Android device

781 questions
20
votes
3 answers

Unique Android Device ID after MarshMallow warning "get device identifiers is not recommended"?

I saw one of my best question Is there a unique Android device ID? Edited: I need a solution for Android 10 too. I used some following code to get Unique Id. public static String getDeviceId(Activity context) { PermissionsChecker checker = new…
Pratik Butani
  • 60,504
  • 58
  • 273
  • 437
20
votes
1 answer

How to know callee is answered the call (What is the phone state when he lift the call)

I am trying to know how to alert when the callee lifts the call. I have used PhoneStateListener along with BroadcastReceiver. Generally it has three states CALL_STATE_IDLE , CALL_STATE_OFFHOOK, CALL_STATE_RINGING. CALL_STATE_OFFHOOK state was…
Ramakrishna
  • 4,066
  • 16
  • 48
  • 72
17
votes
5 answers

GetNetworkType in Android 11

Following the changes posted here, the getNetworkType method is deprecated from Android R and onwards. When trying to use this method in a R compiled application, results in the following exception being thrown: java.lang.SecurityException:…
tomerpacific
  • 4,704
  • 13
  • 34
  • 52
15
votes
2 answers

SubscriptionInfo.getMnc() returns the same value for both the SIMs with different carriers

I was trying to get the MCC and MNC number (basically I want the IMSI number but these will also suffice) in Android 5.1 device having dual Sim (both active). As 5.1 supports dual Sim so I used the Subscription manager like this: SubscriptionManager…
14
votes
3 answers

TelephonyManager deprecated listen() CALL_STATE_RINGING on android 12

I'd like to listen if there's a phone call happening while my app is in the foreground. It was like this before but now listen() is deprecated: val tm = context.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager …
Orcun Sevsay
  • 1,310
  • 1
  • 14
  • 44
14
votes
9 answers

How to figure out which SIM received SMS in Dual SIM Android Device

I'm working on a project to sync sms received in a Android phone to a online database. I can get sender's number by calling getOriginatingAddress() method. But I can't find any solution to figure out which SIM in my device received the sms. I…
haider_kazal
  • 3,448
  • 2
  • 20
  • 42
13
votes
1 answer

Android: how to detect a private number programmatically

I use BroadcastReceiver to intercept incoming call on Android phone as below tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); Bundle bundle = intent.getExtras(); String number =…
Bao Le
  • 16,643
  • 9
  • 65
  • 68
13
votes
3 answers

Android, TelephonyManager, the joys of PhoneStateListener and incoming numbers

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…
ViRALiC
  • 1,419
  • 4
  • 18
  • 46
12
votes
4 answers

to get phone number programmatically in Android

I am using the code TelephonyManager tMgr =(TelephonyManager)mAppContext.getSystemService(Context.TELEPHONY_SERVICE); mPhoneNumber = tMgr.getLine1Number(); to get the phone no programatically in android . But this is working fine only for one…
Prabhu M
  • 3,534
  • 8
  • 48
  • 87
12
votes
2 answers

getLine1Number() Returns blank, not null

I want to get Mobile Number of Device. I have used following code reference by Alex Volovoy's This Link TelephonyManager tMgr = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); String mPhoneNumber = tMgr.getLine1Number(); Log.d("msg",…
Pratik Butani
  • 60,504
  • 58
  • 273
  • 437
10
votes
2 answers

What does the different Call states in the Android telephony stack represent?

The internal Android class com.android.internal.telephony.Call contains an enum called State and defined as follows: public enum State { IDLE, ACTIVE, HOLDING, DIALING, ALERTING, INCOMING, WAITING, DISCONNECTED, DISCONNECTING; public…
Bjarke Freund-Hansen
  • 28,728
  • 25
  • 92
  • 135
10
votes
2 answers

Incoming call listener sleeps after couple of hours

For the last couple of weeks I am facing an issue with telephony manager API in Android - listener for incoming call based on listener starting Recording and on end call stopping recording (The process working smooth) ISSUE The issue I am facing is…
Jhaman Das
  • 1,094
  • 13
  • 28
10
votes
1 answer

TelephonyManager returns null for IMEI number: what can cause this?

I'm working on an Android app and am getting null back for the IMEI number when using TelophonyManager. This is happening on several Huawei phones. (All of them are Ascend Y530s). The phones all have sim cards and otherwise seem to be operating…
Zach Smith
  • 8,458
  • 13
  • 59
  • 133
10
votes
3 answers

android.Settings.Secure.ANDROID_ID

I'm developing an android application and I'm going to use the LVL library to check google play licence. After reading the LVL documentation, I've read that I have to obtain the android.Settings.Secure.ANDROID_ID to obfuscate the google play…
Eduardo
  • 1,169
  • 5
  • 21
  • 56
10
votes
2 answers

How to modify incoming and outgoing call screen view in android

I want modify below screen according to my option. I don't know how to access this screen. and i need to modify this screen also Please help me to do this.
1
2
3
52 53