Closed simonsickle closed 3 years ago
Hi @simonsickle . Thanks for reaching out. This is on my engineering team's roadmap right now, and we're working on a solution. We've historically collected network type to make available as a targeting option for things like Surveys (e.g. show x Survey only to your customers that are on T-Mobile's network). We may have to change that moving forward.
Stay tuned and I'll update you as soon as we have a fix.
I have a pull request ready, https://github.com/apptentive/apptentive-android/pull/209, which fixes Android 11 and allows apps requiring the network type to still request it from the user.
Fixed in 5.5.4
Starting in Android SDK 30,
TelephonyManager.getNetworkType()
is depreciated and replaced byTelephonyManager.getDataNetworkType()
.To use
getDataNetworkType()
the application must have either carrier permissions (as in, be a cell phone carrier such as AT&T or Verizon Wireless) or requestREAD_PHONE_STATE
which is a dangerous permission requiring user approval.This only applies to apps built against SDK 30, which we currently have done in order to support APIs. This means as a workaround, if you can target SDK <= 29 for your build then you will not see this issue.
Expected AppTentive surveys and dialogs should be shown on Android 11 when the app consuming the library is targeting SDK 30.
Actual AppTentive surveys and dialogs are not shown due to exception while trying to access the network type when on an Android 11 device and the build targets SDK 30.
Fix Unless used elsewhere for functionality outside of analytics,
TelephonyManager.getNetworkType()
should be included in a try/catch to allow the library to continue working on newer devices. See https://github.com/apptentive/apptentive-android/blob/master/apptentive/src/main/java/com/apptentive/android/sdk/storage/DeviceManager.java#L73