Java Question new GSM library

spillermarco

Member
Licensed User
Longtime User
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
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:

spillermarco

Member
Licensed User
Longtime User
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

spillermarco

Member
Licensed User
Longtime User
Thanks for your answer, it is possible to see some example for read segnal strenght?
may be with phone state listener

thanks

Regards

Marco
 

bluejay

Active Member
Licensed User
Longtime User
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
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
 

bluejay

Active Member
Licensed User
Longtime User
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
 
Top