zhitaocai / toastcompat_deprecated Goto Github PK
View Code? Open in Web Editor NEW【Deprecated】兼容小米MIUI系统上,后台应用没法弹出Toast的问题
【Deprecated】兼容小米MIUI系统上,后台应用没法弹出Toast的问题
在魅族手机上无权限时,弹不出toast
自定制的Toast还没有显示出来立即关闭当前页面会无法显示,和你的handleHide()方法中的弹栈位置有关
Well Done!
Hi,原来代码里是否使用自定义Toast,是根据MIUI系统判断的。实际上在 Android 的设置里关闭应用通知,就不能弹出Toast。
Android Support v4 24.0.0 包里提供了是否允许通知的检测(Android 4.4 以上能使用)。考虑到现在小米、魅族、华为的系统基本都是 4.4 以上了。 用这个判断兼容范围更广泛。
另外发现,MIUI 8开发版,如果禁用通知, TYPE_TOAST 会提示没有权限,然后崩溃(不知道小米什么时候会变更)。所以在 show 和 hide 的时候都 Try 一下,防止崩溃。
具体的修改在这里。
ongakuer@cbc111d
如果需要,我可以Pull Request
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.