0
알림이있는 텍스트를 얻을 수 있습니다. 알림이있을 때 나는 소리를 듣고 싶다.알림이있는 소리를들을 수 없습니다.
안드로이드 코드 :
private static void generateNotification(Context context, String message) {
long when = System.currentTimeMillis();
NotificationManager notificationManager = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.ic_launcher,
message, when);
notification.defaults|= Notification.DEFAULT_SOUND;
String title = context.getString(R.string.app_name);
Intent notificationIntent = new Intent(context,
GCM.class);
// set intent so it does not start a new activity
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
| Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent intent = PendingIntent.getActivity(context, 0,
notificationIntent, 0);
notification.setLatestEventInfo(context, title, message, intent);
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(0, notification);
}
체크 기본값을 작동 바랍니다 .. –