question

chbernard avatar image
0 Votes"
chbernard asked RobCaplan edited

xamarin android MyPhoneStateListener how to understand the result ?

Hello,
in my app, i call telephonyManager for to get the signal strength of gsm

it's work fine, i obtain as a result a int value -> actually 16
I see on my phone i'm on network icon i'm on edge network (H next to the icon)


but this value -> 16 -> how to translate this ?
is it good or not good ?

I need for example if network is good i can start a Task who call a http ...

I would like to understand the result of the signal strength ...
16 it's mean ? Poor or ?

thanks for all

dotnet-xamarin
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

LeonLu-MSFT avatar image
0 Votes"
LeonLu-MSFT answered

Hello,​

Welcome to our Microsoft Q&A platform!

but this value -> 16 -> how to translate this ?
is it good or not good ?
16 it's mean ? Poor or ?

I test his api in my emulator like this screenshot.

103251-image.png

Based on my test 16 is not poor, 16 is Good.

I set the Signal strength to Great value is 30.

Signal strength to Moderate value is 12.

Signal strength to Poor value is 5.

Signal strength to None value is 0.

So, I use following code to judge it.

var signalSupport = signalStrength.GsmSignalStrength;

            if (signalSupport >= 30)
            {
              

                Toast.MakeText(mainActivity, "Signal GSM : Greate" + signalSupport, ToastLength.Short).Show();
            }
            else if (signalSupport > 30 && signalSupport <= 12)
            {


                Toast.MakeText(mainActivity, "Signal GSM : Good" + signalSupport, ToastLength.Short).Show();
            }
            else if (signalSupport < 12 && signalSupport > 5)
            {
                Toast.MakeText(mainActivity, "Signal GSM : Moderate" + signalSupport, ToastLength.Short).Show();


            }
            else if (signalSupport <= 5)
            {
                Toast.MakeText(mainActivity, "Signal GSM : poor" + signalSupport, ToastLength.Short).Show();


            }


Best Regards,

Leon Lu



If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



image.png (41.6 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

chbernard avatar image
0 Votes"
chbernard answered

@LeonLu-MSFT

thanks a lot for the time you spent here :)
great to find help here

thanks a lot

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.