J'essaie de jouer un son, et de clignoter le rétro-éclairage du téléphone Android en utilisant le gestionnaire de notification. J'ai utilisé le code suivant. Toutes les autorisations requises sont présentes dans le fichier manifeste. Mais je ne suis pas sûr pourquoi cela ne donne aucune notification dans l'émulateur ou dans l'appareil (htc wildfire). Si vous connaissez une solution possible s'il vous plaît faites le moi savoirLa notification ne fonctionne pas (htc wildfire)
XYNotificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
int NOTFICATION_ID = 1331;
Notification notifyDetails = new Notification();
notifyDetails.icon = R.drawable.icon12;
notifyDetails.tickerText = "Message Received!!!";
notifyDetails.when = System.currentTimeMillis();
notifyDetails.vibrate = new long[] {0,1000,1000,1000,1000,1000,1000,1000}; //vibrate;
Intent notifyIntent = new Intent(this, XYReceiverAppActivity.class);
PendingIntent pIntent = PendingIntent.getActivity(this, 0,notifyIntent, android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
CharSequence contentTitle = "XYs Notification";
CharSequence contentText = "Get back to XY HOME screen by clicking me";
notifyDetails.setLatestEventInfo(this, contentTitle, contentText, pIntent);
Uri xysound = Uri.parse("android.resource://" + getPackageName() +"/"+ "soundxy");
notifyDetails.ledARGB = Color.BLUE;
notifyDetails.ledOnMS = 10000;
notifyDetails.ledOffMS = 1000;
notifyDetails.flags |= Notification.FLAG_SHOW_LIGHTS;
notifyDetails.sound = xysound;
XYNotificationManager.notify(NOTFICATION_ID, notifyDetails);
Le dispositif ne vibre pas non plus il n'y a aucune alerte sonore. La lumière LED est la même. comment envoyer la notification?
une icône persistante de la barre d'état. mais rien d'autre ... – drulabs