I want to generate a notification sound after a certain event on Google Glass. This is what I have tried
NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.ic_action_done)
.setContentTitle("Message Receied")
.setContentText("New message received")
.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION));
//alert
NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
manager.notify(1, builder.build());
As well as this
Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Ringtone r = RingtoneManager.getRingtone(context, notification);
r.play();
The first code snippet doesn't return anything nor does it do anything. I'm unsure on how Glass handles notifications considering the lack of a notification center. The second code snippet throws the following error in logcat
06-02 15:05:30.248: D/MediaPlayer(32271): Couldn't open file on client side, trying server side
06-02 15:05:30.279: E/MediaPlayer(32271): Unable to create media player
06-02 15:05:30.279: D/Ringtone(32271): Problem opening; delegating to remote player
Does anyone have an idea on how to generate a sound?
Thank you