简体   繁体   English

如何在 Flutter 中在锁屏上显示小部件?

[英]How do I show a Widget over lockscreen in Flutter?

I am building a VoIP calling app in Flutter.我正在 Flutter 中构建一个 VoIP 呼叫应用程序。 I need to alert the user and show a Widget on the screen so that the user can accept or reject incomming calls without unlocking the phone.我需要提醒用户并在屏幕上显示一个小部件,以便用户可以在不解锁手机的情况下接听或拒绝来电。 So basically I need a Flutter version for this .所以基本上我需要一扑版本

You may need to use MethodChannel via your flutter app for native android access.您可能需要通过 Flutter 应用程序使用 MethodChannel 进行本机 Android 访问。 In android, you can create a notification , with setFullScreenIntent(..) Official documentation mentions , Only for use with extremely high-priority notifications demanding the user's immediate attention, such as an incoming phone call在android中,你可以创建一个通知,使用 setFullScreenIntent(..) 官方文档提到, 只用于要求用户立即关注的极高优先级的通知,例如来电

NotificationCompat.Builder builder = new NotificationCompat.Builder(this,"methodId")
                .setContentText(" content ")
                .setContentTitle("Title..")
                .setFullScreenIntent(...)
                .setSmallIcon(R.drawable.launch_background)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM