Android Question Java Lang Object - Access android.telephony.CellSignalStrength

Discussion in 'Android Questions' started by Derek Johnson, Jul 16, 2015.

  1. Derek Johnson

    Derek Johnson Active Member Licensed User

    I'm trying to use the Android Documentation in conjunction with the Java Language object to get the value of some properties.

    This is the code that I am trying

    Dim jo,jo2 As JavaObject
    Dim ASU As String
        jo2 = jo.InitializeStatic(
    log("Got Signal Strength object OK")
    Log("ASU= " & ASU)
    Log("Java Error: " & LastException.Message)
    End Try
    The first part worked Ok and the jo2 object was initialised.
    However I get this error when I try to get the ASU info:

    Where am I going wrong with this? If I can sort this out I'll be well on my way to being able to make better use of the Android Documentation and Methods,
  2. Roycefer

    Roycefer Well-Known Member Licensed User

    Have you tried the other Initialize methods? Maybe you shouldn't try to create it as static. Try InitializeInstance. Also, looking at the documentation, android.telephony.CellSignalStrength is an abstract base class. Maybe you should try instantiating one of its subclasses like CellSignalStrengthCdma.
    Derek Johnson likes this.
  3. Roycefer

    Roycefer Well-Known Member Licensed User

  4. Derek Johnson

    Derek Johnson Active Member Licensed User

    Roycefer , Thanks for the info and links.

    This code below now compiles OK and runs.

    Dim css,jo As JavaObject
    Dim result As String

        css = jo.InitializeNewInstance(
    Log("Object Test result:"  & css)
        result= css.RunMethod(
    Log("Is GSM:"  & result)
        result= css.RunMethod(
    Log("ToString:"  & result)

        result= css.RunMethod(
    Log("hashCode:"  & result)

        result= css.RunMethod(
    Log("Signal Strength:"  & result)
        result= css.RunMethod(
    Log("OEM Signal Strength:"  & result)
        result= css.RunMethod(
    Log("Bit error rate:"  & result)
        result= css.RunMethod(
    Log("getAsuLevel:"  & result)
    This only gives the initial values however, it does not read anything from the phone.

    How do I make this code get a new set of values? DO I need to use Events to do this?

    (I was hoping to be able to find some further information about the 2nd Sim Signal Info by using some of the methods in the android.telephony.SignalStrength object.)
  5. Roycefer

    Roycefer Well-Known Member Licensed User

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice