question-mark
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.

No sound, no notification, only listed in notifications PT2

See original GitHub issue

Hi Eddy! Sorry for coming back on this issue, but unfortunately it seems to be back…

Although the issue here seems to be kinda “strange” I’ll try to provide as many details as I can:

Occurs on: Samsung Galaxy S5 [Android 6.0.1] Issue details: when the application receives a new notification, it just puts it in the notifications bar, as described in the #61. Even if the application is in foreground, no sound is played when the notification comes (and I’m talking about the default sound, no customizations made), and neither is shown the classic “notification dialog” at the top of the screen.

The notifications does arrive even when the app is killed, but still, with no sound and no visual dialog and even if the app is in background, but with the same parts missing.

Instead on my daily phone (OnePlus 5T) with [Android 8.1.0] works like a charm. Only when the app is in foreground

But if in background, or killed, no notifications are listed. And no sounds are played. Well… sometimes. That’s why I said that it was strange…

If it can help I list here my package json deps and versions of TNS:

{
    "nativescript": {
        "id": "com.tns.debug.app.debug",
        "tns-android": {
            "version": "5.1.0"
        },
        "tns-ios": {
            "version": "5.1.0"
        }
    },
    "description": "TNS Debug App",
    "license": "SEE LICENSE IN <your-license-filename>",
    "repository": "<fill-your-repository-here>",
    "dependencies": {
        "@angular/animations": "~7.1.0",
        "@angular/common": "~7.1.0",
        "@angular/compiler": "~7.1.0",
        "@angular/core": "~7.1.0",
        "@angular/forms": "~7.1.0",
        "@angular/http": "~7.1.0",
        "@angular/platform-browser": "~7.1.0",
        "@angular/platform-browser-dynamic": "~7.1.0",
        "@angular/router": "~7.1.0",
        "nativescript-angular": "~7.1.0",
        "nativescript-background-geolocation-lt": "^1.9.1",
        "nativescript-google-maps-sdk": "^2.6.1",
        "nativescript-local-notifications": "^3.1.0",
        "nativescript-plugin-firebase": "^7.6.1",
        "nativescript-theme-core": "~1.0.4",
        "nativescript-toast": "^1.4.6",
        "nativescript-uuid": "0.0.1",
        "randomstring": "^1.1.5",
        "reflect-metadata": "~0.1.8",
        "rxjs": "~6.3.0",
        "tns-core-modules": "~5.1.0",
        "zone.js": "^0.8.26"
    },
    "devDependencies": {
        "@angular/compiler-cli": "~7.1.0",
        "@nativescript/schematics": "~0.5.0",
        "@ngtools/webpack": "~7.1.0",
        "@types/randomstring": "^1.1.6",
        "nativescript-dev-typescript": "~0.7.0",
        "nativescript-dev-webpack": "~0.19.0"
    },
    "readme": "NativeScript Application"
}

Hope you can help me 😃

And by the way, as always, awesome work! We all greatly appreciate what you are doing ❤️

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
andipahlevycommented, Sep 5, 2020

Is this plugin can’t play custom mp3 audio? android

0reactions
caiusCitirigacommented, Jan 24, 2019

LOL this IS strange!

If you send in the notification message the following property:

{
    ...
    android:{
        notification:{
            sound: 'some-unexisting-sound.mp3'
        }
    }
    ...
}

Android will force play the default notification sound! 😂😂😂😂😂😂

Or a cleaner way:

console.log('============| SETTING UP NOTIFICATION AND RINGTONE |============');
        const ringtoneManager = android.media.RingtoneManager.getDefaultUri(android.media.RingtoneManager.TYPE_NOTIFICATION);
        setTimeout(() => {
            const notificationBuilder = new android.app.Notification.Builder(application.android.context);

            const notification = notificationBuilder
                .setSmallIcon(ad.resources.getDrawableId('icon'))
                .setContentTitle('Some test notification')
                .setContentText('Done with native builder')
                .setPriority(2)
                .setSound(ringtoneManager)
                .setVibrate([0, 550, 200, 500])
                .setLights(200, 500, 1000)
                .build();

            const notificationManager = application.android.context.getSystemService(android.content.Context.NOTIFICATION_SERVICE);

            console.log('============| SENDING NOTIFICATION |============');
            notificationManager.notify(0, notification);
        }, 5000);

Note that it will work only on Android 7 and below. For newer versions, you have to set up the notification channel too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix iPhone Notification Sound Not Working on iOS 16?
Part 2: Top 7 Ways to Fix iPhone App Notification Sounds Not Working · Open the iPhone Settings and tap on Sounds &...
Read more >
No notification sounds in ios15 be… | Apple Developer Forums
Is anyone else experiencing notifications appearing on iPhone but no sounds? I've checked all settings and they seem to be correct. This just...
Read more >
Fix iPhone Notification Sound But No Notification ... - YouTube
For more information, follow this guide:https://www.techy.how/tutorials/fix-iphone- notifications - no - sound -home-screenA short tutorial on how ...
Read more >
No notification sound for incoming message event ... - YouTube
No notification sound This video also answers some of the queries below: Why is my phone not notifying me when I get text...
Read more >
How to turn on/off sound notifications - Front Help Center
Set Notifications to On (if you would like sound enabled for Front; specifically, you will also want to turn on Play a sound...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found