Answer the question
In order to leave comments, you need to log in
Unable to display notification in android wear based on own activity. What am I doing wrong?
I've been struggling with the problem for a week now and I can't find a solution anywhere. It seems that I am doing everything correctly as described in various articles on android wear programming, but maybe I'm missing some nuance.
I'm trying to display my notification in the clock (the usual notification is displayed without problems, but I'm not satisfied with its appearance). Data from the smartphone to the watch is transferred normally, but the notification is displayed empty (and, judging by the debug, in the activity that should be displayed, onCreate does not even work)
A piece of service code on the watch side:
Intent intent = new Intent(ListenerService.this, NotificationActivity .class);
intent.putExtra(NotificationActivity.EXTRA_TITLE, title);
intent.putExtra(NotificationActivity.EXTRA_BODY, body);
//intent.putExtra(NotificationActivity.EXTRA_IMAGE, asset);
PendingIntent pending = PendingIntent.getActivity(
ListenerService.this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
InputStream assetInputStream = Wearable.DataApi.getFdForAsset(
googleClient, asset).await().getInputStream();
// Create the ongoing notification
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.mipmap.ic_launcher)
.extend(new NotificationCompat.WearableExtender()
.setDisplayIntent(pending)
.setBackground(BitmapFactory.decodeStream(assetInputStream))
.setCustomSizePreset(NotificationCompat.WearableExtender.SIZE_MEDIUM));
// Build the notification and show it
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(ListenerService.this);
notificationManager.notify(NOTIFICATION_ID, notificationBuilder.build());
As a result of sending data from the phone, an empty notification is displayed on the watch
I tried both in the emulator and on a real clock, everything is clear in the logs and there are no errors.
What am I doing wrong? Where to dig?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question