0

I was unable to locate any specific details about this question, so I'll just shoot it here: Is Android able to customize a push notification sound / vibration so that it will keep ringing/vibrating the phone until that push is opened (read) ? If it is possible, could you please give me a hint of how to make it work?

2
  • you are going to drain lots of Battery and your user's might not like it. Commented Aug 14, 2013 at 9:32
  • I can understand that, but I'm using this only for emergency, or very important push notifications, leaving user choice to enable it or not. Commented Aug 14, 2013 at 9:44

3 Answers 3

2

The device can light its LED, play ringtone and so on with configuration of your NoticationManager. They runs just after the push is coming.

NotificationCompat.Builder builder = new NotificationCompat.Builder(_context) .setWhen(System.currentTimeMillis()).setTicker("") .setAutoCancel(true).setSmallIcon(getSmallIconResId()).setLargeIcon(getLargeIconResId(_context)) .setContentIntent(null) .setContentTitle("").setContentText(""); builder.setVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 }); builder.setLights(Color.RED, 3000, 3000); builder.setSound(Uri.parse("")); return builder; 

If you wanna keep ringtone, your must play ringtone after the push.
http://developer.android.com/reference/android/media/Ringtone.html

Sign up to request clarification or add additional context in comments.

3 Comments

This looks like what I need, but the thing is: How can I set vibrating pattern to be repeated continuously, until the push notification gets clicked. I know that using Vibrator.vibrate the pattern can be repeated with a second int argument, but how to use it with Notifications?
@DoruAdryan You could vibrate your device just like playing ringtone after push came. technotalkative.com/android-vibrate-the-phone-programmatically
I finally managed to work with it. Thanks for your answer, TeeTraker.
1

First of all you must understand how the PushNotification works. It's a communication channel with client-server. Visually it's a notification like a sms on you're phone. However 2 you're question : Yes it's possible. You can set a vibrate,sound and other parameters of you're notification. You say how? I don't want to duplicate google search results. So google it.

Comments

0

Yes you can set the vibration and ringtone from the code below. for vibration, you have to add the premission in the manifest.

NotificationCompat.Builder builder = new NotificationCompat.Builder(_context) .setWhen(System.currentTimeMillis()).setTicker("") .setAutoCancel(true).setSmallIcon(getSmallIconResId()); builder.setVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 }); builder.setLights(Color.RED, 3000, 3000); builder.setSound(Uri.parse("")); return builder; 

2 Comments

how is this different from the upvoted accepted answer?
I didnt saw the above answer... I posted of my own.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.