8 Replies Latest reply on Dec 13, 2013 10:38 AM by Jon Tara

    Retrieve Wifi Signal Strength

    Amardeep Singh

      I am using RMS 4.0 for my application which is supported for iOS. One of the workflow require to know WIFI signal strength.

       

      I have used RMS 4.0 provided Signal Indicators module to get this information but it is returning "-1" instead of actual number on iPod 4th generation as well as 5th generation. 

       

      Code Used:

      var wlan_status = Rho.SignalIndicators.wlanStatus();

      var signal_strength = wlan_status.signalStrength;

       

      Return value: -1

       

      Build.yml changes:

       

      extensions: ["indicators"]

       

      Can you please let me know whether anything is missed.

        • Re: Retrieve Wifi Signal Strength
          BHAKTA RANJAN SATAPATHY

          HI,

           

          You need to handle this asynchronously by passing callback.

           

          Rho.SignalIndicators.wlanStatus(statusCallback)


          var statusCallback = function (args){

                var result = '';

                result += '<br/>signalStrength :- ' + JSON.stringify(args["signalStrength"]);

                result += '<br/>essid :- ' + JSON.stringify(args["essid"]);

                result += '<br/>macAddress :- ' + JSON.stringify(args["macAddress"]);

                result += '<br/>adapterName :- ' + JSON.stringify(args["adapterName"]);

                result += '<br/>dhcpServer :- ' + JSON.stringify(args["dhcpServer"]);

                result += '<br/>dhcpStatic :- ' + JSON.stringify(args["dhcpStatic"]);

                result += '<br/>gateway :- ' + JSON.stringify(args["gateway"]);

                result += '<br/>ipAddress :- ' + JSON.stringify(args["ipAddress"]);

                result += '<br/>rssi :- ' + JSON.stringify(args["rssi"]);

                result += '<br/>subnetMask :- ' + JSON.stringify(args["subnetMask"]);

                result += '<br/>wins :- ' + JSON.stringify(args["wins"]);

                alert("Output: " + result);

              }

           

          Thanks

          Bhakta

          • Re: Retrieve Wifi Signal Strength
            Jon Tara

            It's not possible on iOS without use of a private API. Apple doesn't permit access. They will not accept an app on the App Store that does this.

             

            (And I wouldn't bother trying to slip it past them - this would almost certainly be caught by automated tests for use of private APIs upon submission.)

             

            If you are not distributing through the App Store, you could try to create your own Rhodes extension to use the undocumented CTGetSignalStrength()

            1 of 1 people found this helpful
              • Re: Retrieve Wifi Signal Strength
                Amardeep Singh

                Thanks for your answer.

                 

                I have created Rhodes extension which uses CTGetSignalStrength() but it didnot work for iPod.

                 

                Code used:

                 

                int signalinformation_get_signal_strength() {

                 

                    void *libHandle = dlopen("/System/Library/Frameworks/CoreTelephony.framework/CoreTelephony", RTLD_LAZY);

                    int (*CTGetSignalStrength)();

                    CTGetSignalStrength = dlsym(libHandle, "CTGetSignalStrength");

                    if( CTGetSignalStrength == NULL) NSLog(@"Could not find CTGetSignalStrength");

                    int result = CTGetSignalStrength();

                    dlclose(libHandle);

                    return result;

                }

                 

                Is anything missing? Will it work for iPod also?

                  • Re: Retrieve Wifi Signal Strength
                    Jon Tara

                    Define "does not work". Was the API found on iPod? If not, then there is no solution. And, of course, you can't check the documentation, because there is none.

                      • Re: Retrieve Wifi Signal Strength
                        Amardeep Singh

                        Define "does not work".

                         

                        When we have created ipa file which includes the Rhodes extension that provides WIFI signal information code, the value which returned back from the above mentioned code is 0 and it is not returning the correct value back.

                         

                        Was the API found on iPod? If not, then there is no solution. And, of course, you can't check the documentation, because there is none.

                        Yes. CoreTelephony is found in the respective directory of iOS SDK.

                          • Re: Retrieve Wifi Signal Strength
                            Jon Tara

                            No, I meant is CTGetSignalStrength found on iPod? You have code above that tests for it's presence. So, is it found, or not? What does your log say?

                             

                            I don't think anybody can offer any more help. It's an undocumented API. Either it is there or not, and either it works or not. If your experience is that it doesn't work on some given device, then you have all the information that is available on the subject Given what you've said above, it seems it's not implemented on iPod. You know as much as anybody else. It might be different on different versions of iOS, and may or may not be available in the future.