I've created a simple application which listens to notification events from other applications. I received StatusBarNotification object and got WearableExtender out of it. Then I got the remoteInputs that the extender was having.
Then used this code to fill remoteinput with my own text and sent the pendingIntent:
RemoteInput[] remoteInputs = new RemoteInput[notificationWear.remoteInputs.size()];
Intent localIntent = new Intent();
localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Bundle localBundle = notificationWear.bundle;
int i = 0;
for(RemoteInput remoteIn : notificationWear.remoteInputs){ getDetailsOfNotification(remoteIn);
remoteInputs[i] = remoteIn;
localBundle.putCharSequence(remoteInputs[i].getResultKey(), "Our answer"); //This work, apart from Hangouts as probably they need additional parameter (notification_tag?)
i++;
}
RemoteInput.addResultsToIntent(remoteInputs, localIntent, localBundle);
try {
notificationWear.pendingIntent.send(MainActivity.this, 0, localIntent);
} catch (PendingIntent.CanceledException e)
{
Log.e(TAG, "replyToLastNotification error: " + e.getLocalizedMessage());
}
However the source claims this code should work, I'm only able to open the specific application and specific conversation, but not able to send a reply. I've tried it with Facebook, WhatsApp, and other apps. Same goes for other applications as well.