title: How to open specific Activity on Click of Push Notification
body: <p>I am developing an android app in which application i am adding notification service using GCM. The problem is that i want to open specific activity on click of notification. I don't Know how to do this task.I also want to change the changes on server side and client side. The activity name be provided by the server and then when i click on the notification the activity opens. please help me .</p>
  
  <p>I've tried this code.</p>
  
  <pre><code>protected void onMessage(Context context, Intent intent) {
          Log.i(TAG,
                  "Received message. Extras:*************************************************** "
                          + intent.getExtras());
          // String message = getString(R.string.gcm_message);
          // displayMessage(context, message);
          // notifies user
  
          String inAction = intent.getAction();
          ArrayList&lt;Notify&gt; notifyData = new ArrayList&lt;Notify&gt;();
          if (inAction.equals("com.google.android.c2dm.intent.RECEIVE")) {
  
              String json_info = intent.getExtras().getString("data");
              Notify notify = new Notify();
              if (json_info != null) {
                  try {
  
                      JSONObject jsonObj = new JSONObject(json_info);
                      notify.setdetail(jsonObj.get("Detail").toString());
                      notify.setappUpdate(jsonObj.get("App Update").toString());
                      notify.setcontentUpdate(jsonObj.get("Content Update")
                              .toString());
                      notify.setSpecial(jsonObj.get("Special Event").toString());
                      notify.setSpecialContent(jsonObj.get("splEvtDes")
                              .toString());
                      notifyData.add(notify);
                  } catch (JSONException e) {
                      // do nothing
                      return;
                  }
              } else {
  
                  notify.setdetail(intent.getStringExtra("Detail"));
                  notify.setappUpdate(intent.getStringExtra("App Update"));
                  notify.setcontentUpdate(intent.getStringExtra("Content Update"));
                  notify.setSpecial(intent.getStringExtra("Special Event"));
                  notify.setSpecialContent(intent.getStringExtra("splEvtDes"));
                  notifyData.add(notify);
              }
  
          }
          String message = null;
          if (notifyData.get(0).getappUpdate().equalsIgnoreCase("YES")) {
              createNotificationForAppUpdate();
          } else if (notifyData.get(0).getcontentUpdate().equalsIgnoreCase("YES")) {
              message = notifyData.get(0).getdetail();
  
              generateNotification(context, message);
          } else {
              System.out
                      .println("=-----------------------------inside else_________________________");
              message = notifyData.get(0).getSpecialContent();
              generateNotification(context, message);
  
          }
  
      }
  </code></pre>