Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Combining custom <code>Parcelable</code>s and <code>PendingIntent</code>s is kind of iffy - but, as luck may have it, <code>Intent</code> is <code>Parcelable</code>, why not just pass the <code>Intent</code> you received as an extra to the <code>Intent</code> you are wrapping in the <code>PendingIntent</code> - allowing the receiving <code>Activity</code> or <code>Service</code> to do the processing?</p> <p><b>Edit</b>: As stated in this <a href="https://stackoverflow.com/a/2307764/967142">answer</a> from CW.</p> <p><b>Edit</b>: Example</p> <p>Your <code>ReceiverAlarm</code> class would work "sort of like this":</p> <pre><code>public class ReceiverAlarm extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); Intent intentNotif = new Intent(context, NotificationViewer.class); intentNotif.putExtra("intent", intent); PendingIntent contentIntent = PendingIntent.getActivity(context, 0, intentNotif, 0); Notification notification = new Notification(icon, text, when); notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent); notificationManager.notify(NOTIFICATION_ID, notification); } } </code></pre> <p>And in the <code>NotificationViewer</code> activity:</p> <pre><code>public class NotificationViewer extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Fetch the Intent you received in your BroadcastReceiver Intent broadcastIntent = getIntent().getParcelableExtra("intent"); if (broadcastIntent != null) { // Do processing previously done in the receiver here // and create your "Notify" objects. } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload