SignalIndicators not working in 5.0.38

L Lisa Tassone 2 years 11 months ago
1 1 0

Hi there,

I currently have an app running Rhodes 5.0.38 and would like to implement the functionality that is offered in the SignalIndicators module yet I can't seem to get either the Ruby or Javascript version working. Upgrading Rhodes isn't an option at the moment, so I am after someone who can help with this version specifically as I can see structure of the extensions have change din later versions.

This is my code and errors I get when trying to use the module:

build.yml (extract)
app_type: "rhoelements"
extensions:
  - json
  - uri
  - indicators
capabilities:
  - gps
  - camera
  - signature
  - push
  - vibrate

RUBY - application_helper.rb (extract)
  def check_connection
    wlan_status = Rho::SignalIndicators.wlanStatus
    signal_strength = wlan_status["signalStrength"] # returns a value between 0 and 100
    puts "signal_strength #{signal_strength}"
    if signal_strength > 30
        # The network should be reliable enough for data transfer. We can trigger synchronization or download large files
        return true
    else
        # We may encounter some connectivity issues. It may not be a good time to start a large download now
        return false
    end
  end

Error:
const_missing: SignalIndicators
I 07/14/2016 16:12:21:646 00004c84                  APP| App error: uninitialized constant Rho::SignalIndicators
C:/MotorolaRhoMobileSuite5.0.38/ruby/lib/ruby/gems/1.9.1/gems/rhodes-5.0.38/lib/framework/rho/rho.rb:1236:in `const_missing'

JAVASCRIPT - layout.erb (extract - called on dom ready)

      function signal_status_sync(){
    signalValue = Rho.SignalIndicators.wlanStatus;
    console.log(signalValue);
    console.log("Signal Strength is: " + signalValue['signalStrength']);
  }

Console Output:
function () {
            return apiReq({
                instanceId: ('function' == typeof idFunc) ? idFunc.apply(this, []) : NOT_INSTANCE_ID,
                args: arguments,
                method: nativeName,
                persistentCallbackIndex: persistentCallbackIndex,
                valueCallbackIndex: valueCallbackIndex
            });
        } login:116
Signal Strength is: undefined

Any help would be greatly appreciated

Please register or login to post a reply

1 Replies

A Adel Sari

When adding a new extension, make sure to clean the project the rebuilt it. otherwise the build process will not generate the extension build, hence  this error: error: uninitialized constant Rho::SignalIndicators

CONTACT
Can’t find what you’re looking for?