title: android: how to call activity by clicking foreground service notification
body: <p>I start a foreground service which shows a notification. If my activity is hidden I want it start by clicking on the notification.
  A function called in onStartCommand does this:</p>
  
  <pre><code>startForeground(noti_id, mNoti);
  </code></pre>
  
  <p>The notification appears and works but it doesn't reactivate my MainActivity:</p>
  
  <pre><code>notiIntent = new Intent(this, MainGate.class);
  notiPendingIntent = PendingIntent.getActivity(this, 0, notiIntent, PendingIntent.FLAG_UPDATE_CURRENT);
  </code></pre>
  
  <p>MainGate.class is the activity which starts the foreground service. It should appear when I click on the notification.</p>
  
  <p>EDIT:</p>
  
  <p>Actually, it worked when the notification was built in the man activity (MainGate.class). And it worked when notification was built in the service not being foreground service. Now I had to implement the foreground service and it stopped working.</p>