Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to create android notifications that vibrate and appear

See original GitHub issue

I’ve got basic push notifications work on both IOS and Android (thanks!!). The IOS ones are much nicer though. I can’t seem to get android to vibrate or show the notification on screen without swiping down from the top of the home screen.

So far this payload is working in android:

notification: {"sound": "default", "icon": "new_message", "color": "#18d821"}
data: {... some other stuff}

It plays a sound and the color of the background of the icon is green. The icon doesn’t seem to display properly, but that might be something I did to the images.

I’d like to make the notification appear on screen, like in IOS. And I’d like it to vibrate. I’ve obviously read the docs but can’t find an answer. I’m wondering if this is something that has to be done natively and cannot be controlled from a notification.

Anyone managed to get Android notifications working in a similar way to IOS?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

npomfretcommented, Jun 7, 2016

Ok, got it working. Thanks for your help. To clarify, the push message looks like this:

  "to": "token",
  "data": {
    "message": "this message text",
    "sound": "default",
    "icon": "new_message",
    "color": "#18d821",
    "data": {
      "some-extra": "data"

I had to add some stuff to my android app that I found here. Specifically:

To app/build.gradle:

apply plugin: ''
compile ''

To android/build.gradle: classpath ''

To manifest.xml:

    <uses-permission android:name="" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
            android:value="@integer/google_play_services_version" />
npomfretcommented, Jun 3, 2016

Thanks for the reply. Your suggestion didn’t work for me though. No notification and the response I get back from wasn’t even well formed (just the text “to\n” !?).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vibrate and Sound defaults on notification - android
3. For the vibrate one, be sure to include the <uses-permission android:name="android.permission.VIBRATE" /> in your AndroidManifest.xml. – ...
Read more >
How to set custom notification vibration patterns on your ...
Tap each app on this list that you want to set up a custom notification vibration pattern for, then press the Pick Apps...
Read more >
Create a Notification - Android Developers
To get started, you need to set the notification's content and channel using a NotificationCompat.Builder object. The following example shows how to create...
Read more >
How do I add Vibrate and sound for Notification in Android?
Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create...
Read more >
Notifications - With Sound, Vibration, Open Activity - YouTube
Android Notification Example and Tutorial. How to show in statusbar, then open activity when clicked and pass the notification id.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found