0

通知を受信したときに表示されるその声を知っています。私はそれを持っていません。ここに私のコードがあります

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());

すべてが完璧に機能します。サーバーからデータを取得できません。通知を表示できます。通知アクティビティを実行できますが、その声が聞こえません。助けてください

4

0 に答える 0