I have been working on this all day and can't figure out where the disconnect is. Please find below my wear app method in which I call the notification request from a broadcast receiver:
private void createWearNotification(final String notificationString, final String name, final String extensionRequested) {
// Wear 2.0 allows for in-line actions, which will be used for "reply".
NotificationCompat.Action.WearableExtender inlineNotification =
new NotificationCompat.Action.WearableExtender()
.setHintDisplayActionInline(true)
.setHintLaunchesActivity(true);
//Create View Message Intent
Intent intent = new Intent(this, ViewMessageActivity.class);
PendingIntent replyIntent = PendingIntent.getActivity(this, notificationId, intent, PendingIntent.FLAG_UPDATE_CURRENT);
// Add an action to allow replies.
NotificationCompat.Action replyAction =
new NotificationCompat.Action.Builder(
R.drawable.ic_curved_arrow_right,
getString(R.string.reply_action),
replyIntent)
.extend(inlineNotification)
.build();
int notificationId = 001;
// The channel ID of the notification.
String id = "my_channel_01";
NotificationCompat.Builder builder =
new NotificationCompat.Builder(getApplicationContext())
.setSmallIcon(R.drawable.ic_email)
.setContentTitle("")
.setDefaults(NotificationCompat.DEFAULT_VIBRATE)
.setContentText(notificationString)
.addAction(replyAction)
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
.setContentIntent(replyIntent);
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
notificationManager.notify(notificationId, builder.build());
}
I have the below declaration in my androidmanifext.xml doc:
<meta-data
android:name="com.google.android.wearable.standalone"
android:value="true" />
Here are my build.gradle dependencies for the wear app:
- implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation 'com.google.android.support:wearable:2.3.0'
- implementation 'com.google.android.gms:play-services-wearable:15.0.1'
- implementation 'com.android.support:percent:27.1.1'
- implementation 'com.android.support:support-v4:27.1.1'
- implementation 'com.android.support:recyclerview-v7:27.1.1'
- implementation 'com.android.support:wear:27.1.1'
- compileOnly 'com.google.android.wearable:wearable:2.3.0'
- implementation 'com.android.support:appcompat-v7:27.1.1'
- implementation 'com.android.support.constraint:constraint-layout:1.1.1'
- implementation 'com.android.support:cardview-v7:27.1.1'
- implementation 'com.android.support:support-compat:27.1.1'
- implementation 'com.android.support:support-core-utils:27.1.1'
- implementation 'com.android.support:support-core-ui:27.1.1'
I also get a lot of these weird comments in my Logcat file:
- I/vndksupport: sphal namespace is not configured for this process. Loading /vendor/lib/hw/gralloc.mt2601.so from the current namespace instead.
I have tried everything - the funny thing is that when I run this from the main phone app as a regular notification it works. I am able to open up apps that I use layouts for - this only happens for notifications? What am I missing?
- Is one of my library references conflicting with another one?
- Is there a rule that prohibits us from being able to open up a notification from a wear app as opposed to a regular android app?
- Is there some way to make sure that the notification bar at the bottom of the interface is enabled?
Any thoughts and suggestions are greatly appreciated!