How do I make a notification started using startForeground () sync its notification with the wearable one?

I found that notifications triggered when using startForeground () function do not show up in wearable files,

t. for the code below,

Intent notIntent = new Intent(this, MainActivity.class);
        notIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        PendingIntent pendInt = PendingIntent.getActivity(this, 0,
                notIntent, PendingIntent.FLAG_UPDATE_CURRENT);

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

        builder.setContentIntent(pendInt)
        .setSmallIcon(R.drawable.play)
        .setTicker(songTitle)
        .setContentTitle("Playing")
        .setContentText(songTitle);
        Notification not = builder.build();
        startForeground(NOTIFY_ID, not);

      

but if i rewrite code like this,

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

        builder.setContentIntent(pendInt)
        .setSmallIcon(R.drawable.play)
        .setTicker(songTitle)
        .setContentTitle("Playing")
        .setContentText(songTitle);

    NotificationManagerCompat notificationManager =
            NotificationManagerCompat.from(MusicService.this);

    notificationManager.notify(NOTIFY_ID, builder.build());

      

wearbles will start displaying it.

So my conclusion is that startForeground () might not use the Compatibility version of the notification manager for notification. Is there a way that I can override the service and make the notification it produces also appear on the non-write wearable application?

PS I'm talking about a handheld app, there is no wearable app here, the topic of discussion is syncing a notification from a handheld app that is started using startforeground () in the handheld app service to automatically sync with the wearable.

+3
android service notifications wear-os


source to share


No one has answered this question yet

See similar questions:

12
Android Wear Notification is not displayed if FLAG_NO_CLEAR is used

or similar:

34
Android Wear Project Gradle Sync Crash
3
How can I open a notification dialog without closing the previous activity?
3
Android: app exit
2
GCM starts background operations (make messages to server) when notification is clicked
1
How to launch Android Watch Watch Face?
0
Google Cloud Messaging GCM for Android bug and push notifications
0
How to test Android Wear app with both devices
0
Any method to highlight which notification of the two in the status bar is clicked and start the main action
0
Suddenly Android Wearable no longer shows notification?
0
Limit the app available to receive mobile app notification?



All Articles
Loading...
X
Show
Funny
Dev
Pics