title: Android push notification: Get data, store and display on new activity on click of notification
body: <p>I am developing an application which is having push notification functionality. I followed the following link as <a href="http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/" rel="noreferrer">Android Push Notification</a></p>
  
  <p>I tried and successfully send URL and open the web page on click of notification by doing the following change in code of generateNotification().</p>
  
  <pre><code>/**
   * Issues a notification to inform the user that server has sent a message.
   */
  private static void generateNotification(Context context, String message) {
      NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
      Notification notification = new Notification(R.drawable.ic_launcher, "Message received", System.currentTimeMillis());
      // Hide the notification after its selected
      notification.flags |= Notification.FLAG_AUTO_CANCEL;
  
      //adding LED lights to notification
      notification.defaults |= Notification.DEFAULT_LIGHTS;
  
      Intent intent = new Intent(Intent.ACTION_VIEW);
      intent.setData(Uri.parse(message));
      //startActivity(browserIntent);
  
      //PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, Intent.FLAG_ACTIVITY_NEW_TASK);
      PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
      notification.setLatestEventInfo(context, "Message", "New message received", pendingIntent);
      notificationManager.notify(0, notification);
  </code></pre>
  
  <p>I am able to send the data with the help of push notification from the server.
  Now i <strong>want to perform</strong> following tasks:</p>
  
  <ol>
  <li><p>Send JSON data via push notification.</p></li>
  <li><p>Save the data into SQLite database.</p></li>
  <li><p>Open new activity on click of push notification.</p></li>
  <li><p>Display data coming from push notification of new activity.</p></li>
  <li><p>If the application is closed so after click on notification the app get started.</p></li>
  </ol>
  
  <p>So please guide me what steps should i follow to perform the above task.</p>