-
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
null pointer exceptions in android 11 #136
null pointer exceptions in android 11 #136
Comments
I am with problem with the plugin. It close my apps after display the message. What is the solution? Just in devices using android 11. |
Toast.java
This is a temporary fix to prevent crashing, though it prevents styling from being applied to toasts on Android 11+. @EddyVerbruggen what is the recommended approach for styling toasts going forward? The Toast docs mention using Snackbar— is this something you think would be within the scope of this plugin? This seems like an important issue to resolve since Android 11 is gaining marketshare quickly. |
I got the same issue for my users, Crashlytics reports a lot of crashes recently because of this: @EddyVerbruggen I think this is critical |
@EddyVerbruggen what do you think about a new version of this plugin? |
Oh dear! Happy to merge a PR (I might have missed one?) |
Would love to see this merged :) |
Is there a workaround for this? I don't need any styling, but just calling
|
@zommerfelds at this point, I think the only workaround for this is just giving up Cordova and go flutter, Cordova is dying Anyways, seriously, I think the only way now is just to fork and solve the issue and install the plugin from your repo, you can merge any PR you want as these PRs are already sent. |
@zommerfelds We just started to show the toast alerts with javascript instead of through cordova for Android. There are many toast like javascript packages on npm, but it is also fairly simple to create your own. @almothafar I'm also following flutter, but since it cannot be (reliably) used on the web I see it as a different tool, not perse a substitute for Cordova/ionic. But that's a different discussion ;) |
@gabn88 I'm using Ionic toast as well https://ionicframework.com/docs/api/toast instead of native toast, I removed the native one from my side because of this issue. |
The solution @dpa99c works. and if (Build.VERSION.SDK_INT >= 30) {
} tested = api 31, 30 ,29, 28, 27 ... 23 |
Would be great to update the plugin for Android 11 |
Since Android 11, custom toasts/ toast modifications are deprecated, according to Google to "protect users". Hence why your app in Android 30 is not able to display custom toasts.
From Android Developers documentation:
Custom toast views are deprecated. Apps can create a standard text toast with the makeText(android.content.Context, java.lang.CharSequence, int)
The text was updated successfully, but these errors were encountered: