telephonymanager

Getting Tower GSM location lat lng

a 夏天 提交于 2019-11-29 23:26:37
问题 I would like to know a method or a way to find the location of the cell the mobile is connected to (GSM one) This is my class: package com.example.signal; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.sql.Date; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.LinkedList; import java.util.List; import android.location.Location; import android.location.LocationListener; import

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

旧巷老猫 提交于 2019-11-29 19:16:56
问题 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 boolean isAlive() { return !(this == IDLE || this == DISCONNECTED || this == DISCONNECTING); } public boolean isRinging() { return this == INCOMING || this == WAITING; } public boolean isDialing() { return this == DIALING || this == ALERTING; } } What does the

SMS Messages of a particular number not showing up on other devices Android

做~自己de王妃 提交于 2019-11-29 18:49:32
I am using the Telephony.Sms library to load in received and sent sms messages for the app I am working on. When I set the query selection to null (the third item in the query), it will show all the sent and received sms messages on the different types of phones I have been testing on. Cursor c = cr.query(Telephony.Sms.CONTENT_URI, null, null, null, null); But when I set it to a particular number, on the Samsung S9 phone running on API 27 it is not showing any sms messages. On the Nexus runnning on API 23, it will show the received messages but not the sent messages in the listview. On the

Checking if call being made is international

試著忘記壹切 提交于 2019-11-29 18:12:07
I'd like to check if a call being made is international or not. I have the SIM number which I obtain by using TelephonyManager.getLine1Number() and also the Country code ISO of the SIM Card which I obtain using TelephonyManager.getSimCountryIso(). Is there anyway I can find the country code of the number to which the call is being made? I don't think telephonyManager.getSimCountryIso() would help you determine 'to which country the call is being made' as it will return your country's ISO. Moreover, length of ISD codes vary across countries. For some countries it is 1, for some it's 2, for some

Broadcast Receiver not working when registered via manifest

两盒软妹~` 提交于 2019-11-29 15:22:04
Trying to setup a simple broadcast receiver in the manifest of an Android app, to detect when the phone is ringing and start a service. Its not receiving the broadcast when a call comes in, no log output, nada. I tried the android.intent.action.PHONE_STATE action and also the TelephonyManager.ACTION_PHONE_STATE_CHANGED in the manifest, neither did anything for me. <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <receiver android:name="com.berrmal.calllog.CallReceiver" android:enabled="true" >

Android dual SIM signal strength

可紊 提交于 2019-11-29 15:11:22
问题 I have been trying to get access to some features on my android dual sim phone (the brand is LKD). I have managed to get the functions for TelephonyManager and ITelephony through java reflection, and got them to run. However i want to get the signal strength for both of the sim cards and i cannot see a way to do this through the reflection. I can get the first sim card in slot 1 through having a PhoneStateListener with the function onSignalStrengthsChanged(). Does anyone have some tips for

Android : why PhoneCallListener still alive after activity finish?

余生长醉 提交于 2019-11-29 15:00:31
im using a phone call listener in my activity but after finishing my activity , afer user make a call, my phone call listener not dead and brig up activity again !! please help me. phoneListener = new PhoneCallListener(); telephonyManager = (TelephonyManager) TransferActivity.this.getSystemService(Context.TELEPHONY_SERVICE); telephonyManager.listen(phoneListener, PhoneStateListener.LISTEN_CALL_STATE); PhoneCallListener class : private class PhoneCallListener extends PhoneStateListener { boolean isPhoneCalling = false; @Override public void onCallStateChanged(int state, String incomingNumber) {

Android Handle phone call

限于喜欢 提交于 2019-11-29 14:24:54
问题 I have audio recording, when a phone call come I need to stop the recording, how can I do this? 回答1: You have to use the PhoneStateListener : TelephonyManager tm = (TelephonyManager)getSystemService(TELEPHONY_SERVICE); tm.listen(mPhoneListener, PhoneStateListener.LISTEN_CALL_STATE); // somewhere else private PhoneStateListener mPhoneListener = new PhoneStateListener() { public void onCallStateChanged(int state, String incomingNumber) { try { switch (state) { case TelephonyManager.CALL_STATE

How do i get the carrier name of an incoming number in android..?

流过昼夜 提交于 2019-11-29 08:45:22
I am able to get the carrier name using the following snippet : TelephonyManager telephonyManager = ((TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE)); String operatorName = telephonyManager.getNetworkOperatorName(); It works really fine. I am also able to get the incoming call number using the following snippet: private final PhoneStateListener phoneStateListener = new PhoneStateListener() { @Override public void onCallStateChanged(int state, String incomingNumber) { String callState = "UNKNOWN"; switch (state) { case TelephonyManager.CALL_STATE_RINGING: } } } I want to

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

。_饼干妹妹 提交于 2019-11-29 04:37:44
问题 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 searched the web about it, but couldn't find a way to figure this out. Is there any way to get SMS receiver's number? 回答1: I had some really hard time with this problem and finally I found a solution, although i tested it only above api level 22. You