小编Meh*_*har的帖子

Kotlin:将LongArray定义为Notification.Builder.setVibrate(LONG_ARRAY)

我正在使用Kotlin,并希望设置振动以进行通知。该.setVibrate()功能需要一个,LongArray但我不能为其定义。

var Builder = NotificationCompat.Builder(this,R.string.channel_name.toString())
        .setSmallIcon(R.mipmap.ic_launcher)
        .setContentTitle("my notification Title")
        .setContentText("somthing else for content")
        .setPriority(NotificationCompat.PRIORITY_DEFAULT)
        .setAutoCancel(true)
        .setVibrate(LONG_ARRAY)
Run Code Online (Sandbox Code Playgroud)

我在网上搜索,但只是找到Java解决方案。感谢您的帮助。

android android-notifications kotlin

1
推荐指数
1
解决办法
59
查看次数

标签 统计

android ×1

android-notifications ×1

kotlin ×1