radiocells-nlp-android icon indicating copy to clipboard operation
radiocells-nlp-android copied to clipboard

Missing version check for API getNeighboringCellInfo

Open DSOTM-pf opened this issue 2 years ago • 0 comments

Hi, there, I've found a version check is missing in version 0.2.9, the app is downloaded from F-Droid.

It is related to the following call chain:

org.openbmap.unifiedNlp.services.RadiocellsLocationService$2.run()void
 org.openbmap.unifiedNlp.services.RadiocellsLocationService.access$300(org.openbmap.unifiedNlp.services.RadiocellsLocationService,java.util.List)void
  org.openbmap.unifiedNlp.services.RadiocellsLocationService.getLocationFromWifisAndCells(java.util.List)void
   org.openbmap.unifiedNlp.services.RadiocellsLocationService.getCells()java.util.List
    android.telephony.TelephonyManager.getNeighboringCellInfo()java.util.List

The API getNeighboringCellInfo is added in Android API-level 25, if it is called in under 25 device, the app will crash. It may be better if we can check for the runtime version before calling it, such as:

if (Build.VERSION.SDK_INT >= 25)
    List list = getNeighboringCellInfo()
else
   // something else

@wish7code Can you help me review this? Very thanks!

DSOTM-pf avatar Aug 01 '21 12:08 DSOTM-pf