David Jesus
David Jesus

Reputation: 2111

Custom vibration pattern in Codename One.

I tried modifying the vibration pattern with the build hint android.pushVibratePattern = 1000 and did not have any luck. Thank you all in advance!

Upvotes: 1

Views: 254

Answers (2)

Vucko
Vucko

Reputation: 7479

I've used this to make my custom vibration pattern when the notification arrives:

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

Where notificationBuilder is

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

You need to give it a pattern in the form of long[].

For this to work in Codename One the build hin needs to match the arguments to the long array as:

android.pushVibratePattern=1000, 1000, 1000

Which will translate to the exact same code above. Notice that you need to do this thru the GUI if you edit the codenameone_settings.properties file directly you will need to prefix hints with codename1.arg..

Upvotes: 2

akash kubavat
akash kubavat

Reputation: 847

as per Codename One tutorial its written

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

It seems instead of pattern you set only one value 1000

so in your build hint you should try with few values as 1000,500,1000,1500

Good luck.

Upvotes: 2

Related Questions