Reputation: 1
I am making a basic notification app and just want to integrate a chronometer to it. I have the basic notification ready.
How to add chronometer using: setUsesChronometer();
And also how do I use setVibrate() method for the same?
Upvotes: 0
Views: 1686
Reputation: 7070
Wherever you are creating your notification, you add below lines to add Chronometer data to your notification.
long elapsedTime = SystemClock.elapsedRealtime() - mChronometer.getBase();
notification.setWhen(System.currentTimeMillis()- elapsedTime);
notification.setUsesChronometer(true);
For vibration, you need to define the vibration pattern -
.setVibrate(new long[]{500,1000}) //vibrates at 5000 ms and 1 second.
Upvotes: 1