n76 / DejaVu

Yet another network location backend for the UnifiedNLP/microG project
GNU General Public License v3.0
100 stars 18 forks source link

Runtime version check missing before TelephonyManager.getNeighboringCellInfo() #38

Open DSOTM-pf opened 2 years ago

DSOTM-pf commented 2 years ago

Hi, there, I've found a version check is missing in version 1.1.12, which is downloaded from F-Droid.

Issue Description

The API getNeighboringCellInfo is added in Android API-level 25, so if the app is running on a device less than 25, it will crash.

Currently this API is called in a try-catch here https://github.com/n76/DejaVu/blob/aaa58cc0ca7b8138c485884b92d7ae8fd687aed6/app/src/main/java/org/fitchfamily/android/dejavu/BackendService.java#L590 I think a better choice is to explicitly check it, rather than suppress the warning by try-catch.

For example,

if (Build.VERSION.SDK_INT >= 25)
    // call the API
else
    // something else

@n76 Could you help me view this? Very thx!

n76 commented 2 years ago

I no longer even have an Android phone to check changes much less do development. If you know anyone who would like to take over this project, please refer them to me.

Helium314 commented 2 years ago

@wowhhh Where did you get this information? getNeighboringCellInfo has been removed in API 29, and, and has been deprecated for several years, see https://issuetracker.google.com/issues/128553845. Not sure when it was added, but definitely before API 17 (when its replacement getAllCellInfo was added)