Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9171789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:12:40+00:00 2026-06-17T16:12:40+00:00

My Android app monitors cellular signal strengths. On CDMA devices, it works without any

  • 0

My Android app monitors cellular signal strengths. On CDMA devices, it works without any problems. On many GSM devices, it works without any problems. However, on some GSM devices, I am getting force closes with the following error message:

java.lang.ClassCastException: android.telephony.cdma.CdmaCellLocation cannot be cast to android.telephony.gsm.GsmCellLocation

I am fairly certain that this issue occurs on some Samsung devices in the US when they receive a 4G LTE signal; I believe it occurs on other devices and countries as well. I am still trying to determine the exact service providers and devices involved.

Here is the relevant snippet of code from MyService.java; I have marked the line referenced by the error message with //********:

public void onCreate() {
    tm = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
    ...
}

public int onStartCommand(Intent in, int flags, int startId) {
    signalStrengthListener = new SignalStrengthListener();
    ((TelephonyManager)getSystemService(TELEPHONY_SERVICE)).listen(signalStrengthListener, SignalStrengthListener.LISTEN_SIGNAL_STRENGTHS | SignalStrengthListener.LISTEN_SERVICE_STATE | SignalStrengthListener.LISTEN_DATA_CONNECTION_STATE | SignalStrengthListener.LISTEN_CELL_LOCATION);
    return START_STICKY;
    ...
}

public void onSignalStrengthsChanged(SignalStrength signalStrength) {
    isGSM = signalStrength.isGsm();
    if (isGSM == true) {
        GCellLoc = (GsmCellLocation)tm.getCellLocation();    //********
    ...
}

Not sure why is anything from android.telephony.cdma is appearing if this code should only be triggered when isGSM returns true. Perhaps when an LTE signal is detected, that puts the phone in some sort of dual CDMA/GSM mode as far as the Android API is concerned? I have not been able to find any documentation of similar behavior. How can I handle this in my code? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:12:41+00:00Added an answer on June 17, 2026 at 4:12 pm

    I cannot explain why it is happening. I have some theories, but you have similar ones.

    While you sort out the reason, you can deal with issue pragmatically. You know that sometimes even though you are getting a GSM SignalStrength in your callback, sometimes on some devices you get a CDMA CellLocation from TelephonyManager and write your code to handle that case using instanceOf instead of relying on .isGSM() from the SignalStrength.

    CellLocation cellLoc = tm.getCellLocation();
    if(cellLoc instanceof GsmCellLocation) {
       GCellLoc = (GsmCellLocation) cellLoc;
       // do work 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My Android app is displaying text in a TextView. Are there any tags or
Good Day! I am working on an android app which monitors user location. I
The android app reads from database but doesnt write anything to DB, the app
My android app leaks, what should I check? I gave a look at avoiding
My android app is taking more and more memory over time. I took a
My Android app looks great at 480x800 pixels resolution but it breaks at LDPI
My android app requires that the device has an SDcard and that SDcard is
my android app crash before load main.xml. This is the exception thrown java.lang.RuntimeException: Unable
My android app has a two word app name, and the 2nd word doesn't
My android app project need to add a new function of saving the click

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.