Flutter:如何检查设备中是否按下主页按钮和电源按钮
如何在Flutter应用程序中的Android/iOS设备中按下主页按钮或电源按钮。
有一个软件包 - https://pub.dev/packages/packages/hardware_buttons
颤动2.10。
错误 - “插件`hardware_buttons使用了Android嵌入的不弃用版本。”
我尝试使用它,但它表明它已弃用,因为它正在使用Android V1嵌入。
How to check if the home button or the power button are pressed in an android/ios device in Flutter App.
There is a package - https://pub.dev/packages/hardware_buttons
Now it is not compatible with Flutter 2.10.
Error - "The plugin `hardware_buttons` uses a deprecated version of the Android embedding."
I tried using it, but it is showing that it is deprecated, because it was using Android V1 Embedding.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不需要捕获家庭按钮。如果用户按HOME和其他一些活动出现在Foreground,则您的应用将在您的当前活动中调用背景()。
You do not need to catch Home button. If user press Home and some other Activity comes to foreground, your app goes to background and onPause() is called in your current Activity.override method
onpause()
and then do what you want.