您知道收到通知时出现的声音。我没有。这是我的代码
JSONArray json = new JSONArray(str);
for (int i = 0; i < json.length(); i++) {
JSONObject oneOffer = json.getJSONObject(i);
int offerID = oneOffer.getInt("ID");
String offerDescriptoin = oneOffer.getString("Description");
String endDate = oneOffer.getString("EndDate");
String startDate = oneOffer.getString("StartDate");
JSONObject restaurant = oneOffer.getJSONObject("Restaurant");
int restaruantID = restaurant.getInt("ID");
String restaurantName = restaurant.getString("Name");
Log.d("Offer", offerID + offerDescriptoin + endDate + startDate
+ restaruantID + restaurantName);
Intent intent = new Intent(this, NotificationReciever.class);
PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
this).setSmallIcon(R.drawable.ic_launcher)
.addAction(R.drawable.ic_launcher, "call", pIntent)
.addAction(R.drawable.ic_launcher, "more", pIntent)
.addAction(R.drawable.ic_launcher, "add more", pIntent)
.setContentTitle("The Eattel").setContentText("New Offer!");
// Creates an explicit intent for an Activity in your app
Intent resultIntent = new Intent(this, NotificationReciever.class);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
stackBuilder.addParentStack(NotificationReciever.class);
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0,
PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.setContentIntent(resultPendingIntent);
NotificationManager mNotificationManager = (NotificationManager) getSystemService(MainActivity.NOTIFICATION_SERVICE);
mNotificationManager.notify(100, mBuilder.build());
一切都很完美,我无法从服务器获取数据,我可以显示通知,我可以运行通知活动,但我听不到那个声音,请帮忙