-
Notifications
You must be signed in to change notification settings - Fork 276
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
WIP: Fix for API 30 / Android 11 by removing deprecated API calls. #139
base: master
Are you sure you want to change the base?
Conversation
@shahdeep1989 This PR fixes the plugin so it builds with API 30 / Android 11 for the upcoming Google deadline and therefore requires If I have time, I'll update this PR with conditionality so it continues to work when building against older API verions. |
Thanks, this fixed it for me after upgrading to cordova-android@10 I had the crash when clicking anywhere on the page even after the toast disappeared |
is this going in @EddyVerbruggen ? |
Guys, |
@dpa99c In fact, I don't know why it appeared to work the other day, but I know encounter this issue at runtime :
|
Happy to merge this, but it's not entirely clear to me what the state is. Is it backward compatible and are the docs fine? Perhaps anyone want to test this PR? Cheers! |
TBH I haven't finished this PR off - just hacked out the deprecated API calls to make it compile under Android 11/API 30. it could do with conditionally supporting other options for older Android versions and the docs updating. Though toasts on Android 11 are so limited you may just want to replace this plugin with a web layer emulation of toast - I did |
UPDATE - ok, sadly it seems this is still crashing:
|
Maybe we can go with #140 first before this PR is ready? |
This PR definitely fixes the bug for Android 11, BUT the downside is, that you now will have crashes on all the older Android versions as @souly1 and @QuentinFarizon already stated before. The reason for the crashes is the use of Toast.Callback which was just added with API Level 30 -> https://developer.android.google.cn/reference/android/widget/Toast.Callback I fixed that problem by re-adding lines 107-193 and by adding some additional Android version checks. It still needs to be tested on older Android versions, but I didn't have any crashes yet.
|
I tried out the code above from @vorderpneu and it seems to work on both API 30 and lower (tested on android 11 emulator and android 5.1.1 device). |
Fix for Android 11 (taken from @vorderpneu at EddyVerbruggen#139)
@rastafan cool, but be careful and test this fix on different devices. In my case it looked crappy on Samsung devices. That's why I replaced this plugin with the ion-toast component in the end |
Resolves #136.
Docs need updating as
textColor
is now the only styling option supported by Android 11.Also
touch
event is never sent as it can't be calculated due to removal of deprecatedToast.getView()
.