【问题标题】:How do I show a Widget over lockscreen in Flutter?如何在 Flutter 中的锁屏上显示 Widget?
【发布时间】:2020-05-05 10:18:31
【问题描述】:

我正在 Flutter 中构建一个 VoIP 呼叫应用程序。我需要提醒用户并在屏幕上显示一个小部件,以便用户可以在不解锁手机的情况下接听或拒绝来电。所以基本上我需要this 的 Flutter 版本。

【问题讨论】:

  • 不确定是否可以在不使用 Flutter Platform Channel 进行本机调用的情况下做到这一点
  • 显示通知还不够?
  • 其实我需要类似于 WhatsApp 呼叫屏幕的东西。带有滑动按钮小部件。

标签: flutter lockscreen


【解决方案1】:

您可能需要通过您的 Flutter 应用使用 MethodChannel 来访问原生 android。在 android 中,您可以使用 setFullScreenIntent(..) 创建通知 官方文档提到,Only for use with extremely high-priority notifications demanding the user's immediate attention, such as an incoming phone call

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

【讨论】:

    猜你喜欢
    • 2021-03-26
    • 1970-01-01
    • 1970-01-01
    • 2020-07-15
    • 1970-01-01
    • 1970-01-01
    • 2019-07-19
    • 2022-06-15
    • 2016-07-06
    相关资源
    最近更新 更多