代号一中的自定义振动模式。

Custom vibration pattern in Codename One.

我尝试使用构建提示 android.pushVibratePattern = 1000 修改振动模式,但没有成功。 提前谢谢大家!

我用它来制作通知到达时的自定义振动模式:

notificationBuilder.setVibrate(new long[]{1000, 1000, 1000});

其中 notificationBuilder

NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this);

你需要以long[]的形式给它一个模式。

为了在代号一中工作,构建 hin 需要将参数与长数组匹配为:

android.pushVibratePattern=1000, 1000, 1000

这将转换为与上面完全相同的代码。请注意,如果您直接编辑 codenameone_settings.properties 文件,则需要通过 GUI 执行此操作,您需要在提示前加上 codename1.arg..

前缀

根据 Codename One 教程编写

android.pushVibratePattern - **Comma delimited long values** to describe the push pattern of vibrate used for the setVibrate native method

您似乎只设置了一个值 1000 而不是 pattern

所以在您的构建提示中,您应该尝试使用 1000,500,1000,1500 这样的几个值

祝你好运。