telephonymanager

How to determine the number of minutes the user is being in a GSM call?

北慕城南 提交于 2019-12-11 13:56:48
问题 I'm trying to determine for how long a user has been in a GSM call. Is that possible using the TelephonyManager?Thank you. 回答1: You can set a listener on TelephonyManager. Try this. long startCallTime = 0; private void setTelephonyManagerCallListener(){ TelephonyManager tm = (TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE); tm.listen(phoneCallStateListener, PhoneStateListener.LISTEN_CALL_STATE); } private PhoneStateListener phoneCallStateListener = new PhoneStateListener(){

How to check Phone calling service is enable or not in android device?

橙三吉。 提交于 2019-12-11 11:42:23
问题 I want to know that how to check that phone call service is enable or not in different devices, i have Micromax Funbook(p300) Tablet(Android 4.0.3), in which there is no calling service, and i am using below code to check that TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); if (tm.getPhoneType() == TelephonyManager.PHONE_TYPE_NONE) { Log.v("TAG", "No calling service"); }else{ Log.v("TAG", "calling service"); } but this is not working. it always gives

knowing the network operator name

拜拜、爱过 提交于 2019-12-11 10:05:47
问题 I want to get my network operator name in my app. I am using fallowing methods in the TelephonyManager to get this: TelephonyManager mTeleManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE); mTeleManager.getSimOperatorName(); mTeleManager.getNetworkOperatorName(); mTeleManager.getSimOperator() But I am getting empty values from the "getSimOperatorName()" and "getNetworkOperatorName()".. I am getting numeric code from this "getSimOperator()" method, But I want know the alphabetic

TelephonyManager is not Providing Phone Number on Every Device

て烟熏妆下的殇ゞ 提交于 2019-12-11 08:36:17
问题 I need phone numbers while developing my application. So, I used TelephonyManager as seen below: TelephonyManager tmgr =(TelephonyManager)getApplicationContext().getSystemService(getApplicationContext().TELEPHONY_SERVICE); Log.d("Tag", tmgr.getLine1Number()); But when I tried application in different devices, somehow getLine1Number() not working. I mean returns NULL . Permission is okay. Finally, does getLine1Number() depend on other requirements ? Is it possible to learn phone number on

Incoming number is null after ending the call in android PIE 9

岁酱吖の 提交于 2019-12-11 06:10:52
问题 I have been working on this problem since weeks. I am making an app which picks the incoming number and shows it in a dialog box after the call is ended. Everything is working fine below android PIE 9.0. The number is always null in android PIE. I have given all permissions including READ_CALL_LOGS but same problem. The incoming number is null. So please anyone help me... Here is my manifest file : <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com

Getting phone type information form Telephony Manager

不羁的心 提交于 2019-12-11 06:06:50
问题 I want to know how do I access the phone type info [whether it is GSM or CDMA] from TelephonyManager . which function can I use for this: My code for this is : SubscriptionManager sm = SubscriptionManager.from(context); List<SubscriptionInfo> sil = sm.getActiveSubscriptionInfoList(); sim_value[0]= sil.get(0).getDisplayName().toString(); sim_value[1]= sil.get(0).getIccId().toString(); sim_value[2]= String.valueOf(sil.get(0).getSimSlotIndex()); sim_value[3]= sil.get(0).getCarrierName().toString

Android getAllCellInfo() returns null

試著忘記壹切 提交于 2019-12-11 04:44:03
问题 I'm new to android, and I work on a project that goes to collect all cells information that observed by phone. I have used TelephonyManager.getAllCellInfo() method, but it always returns null . My Code :: public class NetworkCoverageActivity extends AppCompatActivity { private String str; private TextView TV; private Button getCellsInfoBtn; private TelephonyManager TM; private List<CellInfo> cellInfoList; private PhoneStateListener PSL; private int event; @Override protected void onCreate

How to check for phone network on Android devices

时间秒杀一切 提交于 2019-12-11 04:18:51
问题 I know how to check if I have internet access (using the code from this post),but is it possible to check if a phone has telephone network access? For example someone might have access to the internet via Wifi but not have phone network access to send SMS or make calls. In my case, while using a real device (Samsung Galaxy S), I am able to turn of my 3G network (then the phone will detect I am not connected to the internet), but I am still able to make phone calls and send SMS. I guess I must

TelephonyManager crashing on android studio

我怕爱的太早我们不能终老 提交于 2019-12-11 03:28:48
问题 I have shifted my eclipse code to android studio and I tried executing the project on studio and it crashes on TelephonyManager. I have created the old code on Theme.Holo.Light . I have added permissions: <uses-permission android:name="android.permission.READ_PHONE_STATE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="com.google.android.providers.gsf.permission.READ

Get phone number of incoming call in all android versions

我只是一个虾纸丫 提交于 2019-12-11 02:41:54
问题 I am trying to fetch incoming number of incoming call. I searched and found this Retrieve incoming call's phone number in Android. My issue is that I am not able to "incoming number" in version above 4.0.3. Please guide me if I am doing anything wrong ,or how to get the incoming number in version above 4.0.3. Thanks in advance. Here is code : TelephonyManager telephony = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE); telephony.listen(new PhoneStateListener(){ public