-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix a crash on newer android OS due to a depreacted API usage #492
Conversation
Can we use hasCarrierPrivledges to avoid the potential exception in the try/catch block? |
That doesn't avoid potential exceptions in the try catch block, see docs on getNetworkType
The only way to avoid that exception is correctly integration of runtime permissions check. Given that this isn't possible with telemetry setup (no hook in the hosting activity), try-catch is the only thing we can do this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code LGTM but will defer the actual review to someone else :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Instrumented unit test on this would be great!
Codecov Report
@@ Coverage Diff @@
## master #492 +/- ##
============================================
+ Coverage 68.33% 68.48% +0.14%
- Complexity 406 408 +2
============================================
Files 70 70
Lines 2214 2221 +7
Branches 180 181 +1
============================================
+ Hits 1513 1521 +8
+ Misses 596 595 -1
Partials 105 105 |
TelephonyManager.getNetworkType() is deprecated in API level 30, so using getDataNetworkType() to get the current data network type on newer android OS. Co-authored-by: Tobrun Van Nuland <[email protected]>
config property of the location schema is not yet added to the Android SDK, so ignoring it to make the schema test pass.
@alfwatt Unfortunately, we do not have a step by step guild for the test app in this project. But fortunately, it is very straightforward in the main screen. We have leveraged the test app in the past to regression test the location, turnstile events and look for memory leaks. In addition, to test the differences in cross version API's, we used to create necessary build variants in the existing example app for android. |
So what are the consequences if Android apps using the Mapbox SDK do not have READ_PHONE_STATE permission? Will this library still function correctly? |
@prfarlow1 yes, in that case the value of data network will be network type unknown |
TelephonyManager.getNetworkType() is deprecated in API level 30, so
using getDataNetworkType() to get the current data network type on
newer android OS.
Co-authored-by: Tobrun Van Nuland [email protected]