Wiederaufnahme einer Tätigkeit beim anklicken auf eine Benachrichtigung

Ich habe eine app, die das verwalten der sms, die ich angelegt habe die Benachrichtigungen aber wenn ich diese anklicke startet es eine andere Tätigkeit, ich würde gerne wissen, wie Sie überprüfen, wenn eine Aktivität beendet wurde und wieder fortsetzen.

Hier ist der code verwendet, um das pendingintent:

private void createNotification(SmsMessage sms, Context context){

    final NotificationManager nm = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);

    String contentTitle = "";


    //construct the Notification object.
        final NotificationCompat.Builder  builder = new NotificationCompat.Builder(context)
        .setContentTitle(contentTitle)
         .setContentText(sms.getMessageBody())
         .setSmallIcon(R.drawable.ic_launcher)
         .setLargeIcon(getIconBitmap())
         .setNumber(nmessages);

        builder.setAutoCancel(true);

        //(R.drawable.stat_sample, tickerText,
          //     System.currentTimeMillis());

        //Set the info for the views that show in the notification panel.
        //notif.setLatestEventInfo(this, from, message, contentIntent);
        /*
        //On tablets, the ticker shows the sender, the first line of the message,
        //the photo of the person and the app icon.  For our sample, we just show
        //the same icon twice.  If there is no sender, just pass an array of 1 Bitmap.
        notif.tickerTitle = from;
        notif.tickerSubtitle = message;
        notif.tickerIcons = new Bitmap[2];
        notif.tickerIcons[0] = getIconBitmap();;
        notif.tickerIcons[1] = getIconBitmap();;
        */

     //Creates an explicit intent for an Activity in your app
        Intent resultIntent = new Intent(context, BasicActivity.class);

        resultIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        //Because clicking the notification opens a new ("special") activity, there's
        //no need to create an artificial back stack.
        PendingIntent resultPendingIntent =
            PendingIntent.getActivity(
            context,
            0,
            resultIntent,
            PendingIntent.FLAG_UPDATE_CURRENT
        );


       //Ritardo in millisecondi



     builder.setContentIntent(resultPendingIntent);

     nm.notify(R.drawable.ic_drawer, builder.build());
  • Zeigen Sie den code von Ihrem Vorsatz / PendingIntent.
  • Bitte erklären Sie im detail über das, was geschehen ist und was geschehen soll, statt. Ihre Frage ist nicht klar.
  • Ich löste es mit diesem : stackoverflow.com/questions/3305088/...
InformationsquelleAutor codareee | 2013-10-03
Schreibe einen Kommentar