B4A Library PhoneStateListener

bluejay

Active Member
Licensed User
Longtime User
I noticed the same issue with LISTEN_SIGNAL_STRENGTH and switched to the new LISTEN_SIGNAL_STRENGTHS. This seemed to work well for GSM but I am not sure about 3G.

Note that LISTEN_SIGNAL_STRENGTHS requires Android 2.1 and higher.

About the library code:

In ver 1.2 you used the following constructor
private final PhoneStateListener phoneStateListener = new PhoneStateListener()

But in ver 1.3 this became:
private final PhoneStateListener phoneStateListener = new PSL.1(this);

private final PhoneStateListener phoneStateListenerForEvent = new PSL.2(this);

The two 5 kbyte class files PSL$1.class and PSL$2.class seem to contain no classes so the one in v1.2 looks more correct to me.

My apologies if I seem to be getting pedantic, eventually I hope figure out how this library creation stuff works.

bluejay
 

zabec

New Member
Licensed User
Longtime User
Hi!
I'm new to all of this. It seem very interesting. From your link to android.telephony, if I understand right, you've implemented PhoneStateListener class (which is obvious from name). Is it a lot of work to do the same for ServiceState class?
I need application to easily/quickly change operator. I would have 2 operators from which I would choose and have them selected manually (no automatic operator selection).
Can you tell me, if this would be possible with ServiceState class?

Thank you.
 

flyingbag

Member
Licensed User
Longtime User
Hello,
The PSL.CellLocation gives me something like [504,33073604,-1]
What does this mean?
Thank you...
Flyingbag
 

wwzw

New Member
Licensed User
Longtime User
Hello,
The PSL.CellLocation gives me something like [504,33073604,-1]
What does this mean?
Thank you...
Flyingbag

I also like this!
The PSL.CellLocation Or PSL_onCellLocationChanged(Location As String) result like [35554,463586,1734846,14179,12]

I hope to longitude and latitude information!

Who can help me ! Thanks !
 

konisek

Member
Licensed User
Longtime User
Can I use this library when I want to read the signal strength just once? I mean:


B4X:
Dim PSL As PhoneStateListener
...
Sub button1_click
    Msgbox(PSL.CellLocation,"")
    Msgbox(PSL.GsmSignalStrength,"")
End Sub


The first Msg results in
[3812,242559177,-1]
but
the second Msg in:

An error has occured in
sub:mainbutton1_click
(java line:234)
java.lang.
NullPointerException
Continue?
 

sasidhar

Active Member
Licensed User
Longtime User



Hi,

In Listener service if I make StartAtBoot = True then the application if not working, I have created a new service and made it StartBoot = True,
and called the Listener service still the application is not working. Without manual intervention(start/stop service) the application should work.Any chance pls..

Thanks
Sasidhar.M
 

zs5cey

Member
Licensed User
Longtime User
I am running this library on a dual sim device. It only shows the information for the 2nd SIM. How do I tell the listener which SIM information I want?
 

Rusty

Well-Known Member
Licensed User
Longtime User
Does anyone know or have a table for the GSM signal strengths.
(i.e. indeterminate 99
Poor 1-5
Good 6-20
...
The GSM signal strengths I'm getting on a non LTE tablet (cellular) are ranges of positive integers (i.e. 10,7, 4, 5...etc.)
Thanks in advance.
Rusty
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…