S spillermarco Member Licensed User Longtime User Jun 29, 2011 #1 Hello i'm Marco. i'm new user of this forum basic4android and beginners with java , i need write one library to read all RF information of the gsm or umts Cell (SC - CID - LAC - rxlevel - ic/io(umts) rxquality(gsm) neighbor(gsm/umts) etc). i begin with a simple code but the result is only -1. can you explain me where are the problem? Thanks in advance. Best Regards Marco package netmonitor; import anywheresoftware.b4a.BA.Author; import anywheresoftware.b4a.BA.ShortName; import anywheresoftware.b4a.BA.Version; import android.telephony.gsm.*; @ShortName("Netmonitor") @Version(1.0f) @Author("Marco") public class netmonitor { public int cell(){ GsmCellLocation result = new GsmCellLocation(); int cid = result.getCid(); return cid; } }
Hello i'm Marco. i'm new user of this forum basic4android and beginners with java , i need write one library to read all RF information of the gsm or umts Cell (SC - CID - LAC - rxlevel - ic/io(umts) rxquality(gsm) neighbor(gsm/umts) etc). i begin with a simple code but the result is only -1. can you explain me where are the problem? Thanks in advance. Best Regards Marco package netmonitor; import anywheresoftware.b4a.BA.Author; import anywheresoftware.b4a.BA.ShortName; import anywheresoftware.b4a.BA.Version; import android.telephony.gsm.*; @ShortName("Netmonitor") @Version(1.0f) @Author("Marco") public class netmonitor { public int cell(){ GsmCellLocation result = new GsmCellLocation(); int cid = result.getCid(); return cid; } }
agraham Expert Licensed User Longtime User Jun 29, 2011 #2 You don't need to write a new library to get some extra information. You can use the Reflection library like this. You get -1 in your library because the constructor of a GsmCellLocation sets the LAC and CID to -1. As you see in the link above you need to get a ready filled in GsmCellLocation from the system phone service TelephonyManager. A lot of the TelephonyManger data is available in the Phone object in the Phone library. Apart from the additional data available in GsmCellLocation and CdmaCellLocation getting the lower level information you want seems to be quite difficult on Android as the official telephony API doesn't seem to expose it. Look in android.telephony to see what is available there. Last edited: Jun 29, 2011
You don't need to write a new library to get some extra information. You can use the Reflection library like this. You get -1 in your library because the constructor of a GsmCellLocation sets the LAC and CID to -1. As you see in the link above you need to get a ready filled in GsmCellLocation from the system phone service TelephonyManager. A lot of the TelephonyManger data is available in the Phone object in the Phone library. Apart from the additional data available in GsmCellLocation and CdmaCellLocation getting the lower level information you want seems to be quite difficult on Android as the official telephony API doesn't seem to expose it. Look in android.telephony to see what is available there.
S spillermarco Member Licensed User Longtime User Jun 29, 2011 #3 thanks Agraham, but only LAC and CID works, i can use reflector for read other value? example signal strength GSM or UMTS, ECio ... thanks Marco
thanks Agraham, but only LAC and CID works, i can use reflector for read other value? example signal strength GSM or UMTS, ECio ... thanks Marco
agraham Expert Licensed User Longtime User Jun 30, 2011 #4 You can access the TelephonyManager methods easily with a Reflector object including NeighboringCellInfo. What you can't do is register a PhoneStateListener, for that you will need a library. A PhoneStateListener will give you access to SignalStrength and ServiceState. If the information you want isn't there then it is not available in the public APIs of the Radio Interface Layer.
You can access the TelephonyManager methods easily with a Reflector object including NeighboringCellInfo. What you can't do is register a PhoneStateListener, for that you will need a library. A PhoneStateListener will give you access to SignalStrength and ServiceState. If the information you want isn't there then it is not available in the public APIs of the Radio Interface Layer.
S spillermarco Member Licensed User Longtime User Jul 12, 2011 #5 Thanks for your answer, it is possible to see some example for read segnal strenght? may be with phone state listener thanks Regards Marco
Thanks for your answer, it is possible to see some example for read segnal strenght? may be with phone state listener thanks Regards Marco
agraham Expert Licensed User Longtime User Jul 12, 2011 #6 agraham said: What you can't do is register a PhoneStateListener, for that you will need a library. Click to expand... .
agraham said: What you can't do is register a PhoneStateListener, for that you will need a library. Click to expand... .
bluejay Active Member Licensed User Longtime User Oct 31, 2011 #7 hi agraham, The issue of getting signal strength have been around on this forum since at least April so it seems to be basic mobile function missing from Basic4Android. Is it possible to register a PhoneStateListener with the new Reflection library GetProxy function or does it still need a library? bluejay
hi agraham, The issue of getting signal strength have been around on this forum since at least April so it seems to be basic mobile function missing from Basic4Android. Is it possible to register a PhoneStateListener with the new Reflection library GetProxy function or does it still need a library? bluejay
bluejay Active Member Licensed User Longtime User Nov 20, 2011 #8 I have been doing further research on this. The good news is that XverhelstX have made a PhoneStateListener library which helps a lot with this. The bad news is Android is not providing all the information to user programs eg RSCP for 3G or RSRP for LTE. Android 'has' implemented all the 3gpp AT Commands which do provide this information internally (in RIL) but has not provided an API for user programs to access this. You can see this if you use a dos window: adb -s emulator-5554 shell logcat -b radio unfortunately no solution yet bluejay
I have been doing further research on this. The good news is that XverhelstX have made a PhoneStateListener library which helps a lot with this. The bad news is Android is not providing all the information to user programs eg RSCP for 3G or RSRP for LTE. Android 'has' implemented all the 3gpp AT Commands which do provide this information internally (in RIL) but has not provided an API for user programs to access this. You can see this if you use a dos window: adb -s emulator-5554 shell logcat -b radio unfortunately no solution yet bluejay
Erel B4X founder Staff member Licensed User Longtime User Nov 20, 2011 #9 Why not use Phone.LogCat: Basic4android - Phone With a little help of regular expressions it should be hard to parse the information.
Why not use Phone.LogCat: Basic4android - Phone With a little help of regular expressions it should be hard to parse the information.
bluejay Active Member Licensed User Longtime User Nov 29, 2011 #10 RIL is implemented by device vendor. The RIL used in the emulator is a reference implementation by google and has logging enabled. Unfortunately, most phone manufacturers seem to have removed this logging in real devices. At also seems that the lack of an API is an explicit Android design decision because the AT commands do not support multiple requestors ie would get confused if several programs issued AT commands. So only the one system program is allowed to issue AT commands. In Android most system programs run as user programs which can be replaced at anytime and hence no public API is given for AT commands. At least that is my interpretation. bluejay
RIL is implemented by device vendor. The RIL used in the emulator is a reference implementation by google and has logging enabled. Unfortunately, most phone manufacturers seem to have removed this logging in real devices. At also seems that the lack of an API is an explicit Android design decision because the AT commands do not support multiple requestors ie would get confused if several programs issued AT commands. So only the one system program is allowed to issue AT commands. In Android most system programs run as user programs which can be replaced at anytime and hence no public API is given for AT commands. At least that is my interpretation. bluejay