title: Android raise Notification when app goes to background (not single activity)
body: <p>I have an Android app made of 3 activities A, B and C:</p>
  
  <ul>
  <li>A is the application itself (a regular Activity)</li>
  <li>B is the settings screen (made with PreferenceActivity)</li>
  <li>C is the about screen (a regular Activity)</li>
  </ul>
  
  <p>The relationship between the activities is as follows:</p>
  
  <ul>
  <li>A is the main activity</li>
  <li>B's parent is A</li>
  <li>C's parent is B</li>
  </ul>
  
  <p>Activity A raises a notification when going to background, this is accomplished by calling NotificationManager's notify() inside A's onStop() method.</p>
  
  <p>When the user launches the app it starts from activity A, then if the user presses the home button the notification will be raised as soon as the home screen is shown. Clicking on the notification will get the user back to the app.</p>
  
  <p>Everything seems to work but now there's a behaviour I tend not to like:
  When the user launches the app and then goes to settings (therefore showing activity A and then B) the notification is also raised (because A has gone to background in order to show B). </p>
  
  <p>This is not desired: The notification should be raised only when the application goes to background regardless of the activity the user was looking at.</p>
  
  <p>How to implement this proper behaviour?</p>
  
  <p>Thanks in advance,
  Marco</p>