1

通知から Android アプリを再開するにはどうすればよいですか? 完全な新しいインスタンスではなく、すべてのバインドされたサービスや設定などを使用して、インスタンスを元の場所から再開できるようにしたいと考えています。これは私のコードです:

String ns = Context.NOTIFICATION_SERVICE;
        mNotificationManager = (NotificationManager)
                                                    getSystemService(ns);

        Intent notificationIntent = new Intent(this, MeasurementsStarter.class);
        PendingIntent contentIntent = PendingIntent.getActivity(
                                                    this, 0, notificationIntent, 0);
        // the next two lines initialize the Notification, using the configurations
        // above
        notification = new Notification(R.drawable.ic_launcher, "Metingen draaien",System.currentTimeMillis());
        notification.setLatestEventInfo(getBaseContext(), "Metingen ManDown", "Metingen Mandown draaien nog",
                                                                    contentIntent);
        notification.flags = Notification.FLAG_ONGOING_EVENT | Notification.FLAG_NO_CLEAR;   
        notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        final int HELLO_ID = 1;
        mNotificationManager.notify(HELLO_ID, notification);
4

1 に答える 1