title: Integrating Google Play services achievements and android notifications
body: <p>I am using Google Play services to set up achievements for an android game.</p>
  
  <p><strong>Goal:</strong>
  In my <code>onAchievmentUnlocked</code> callback I want to send a notification to the device that opens the achievement screen when the user touches the notification (from wherever they are).</p>
  
  <p><strong>What works</strong>:</p>
  
  <ul>
  <li>The notification gets sent properly and all the icons etc. are visible. Touching the notificatoin does nothing though.</li>
  <li>The achievement activity does work, since I have an Option Menu item to call it up in the app via this code: <code>activity.startActivityForResult(gameClient.getAchievementsIntent(), ACHIEVEMENTS_ID);</code></li>
  </ul>
  
  <p><strong>What's not working</strong>:
  Touching the notification has no apparent effect.</p>
  
  <p><strong>Notes</strong>:</p>
  
  <ul>
  <li>MinSDKVersion is 14</li>
  <li>TargetSDKVersion is 16</li>
  </ul>
  
  <p>Here's the code I have at present:</p>
  
  <pre><code>@Override
  public void onAchievementUnlocked(final String id) {
      final Achievement ac = mAchievementManager.getUnlockedAchievements().get(id);
      assert(ac!=null);
      Uri uri = ac.getUnlockedImageUri();
      final Context ctx = this;
      ImageManager.OnImageLoadedListener listener = new ImageManager.OnImageLoadedListener() {
          @Override
          public void onImageLoaded(Uri uri, Drawable drawable) {
              Bitmap bitmap = ((BitmapDrawable)drawable).getBitmap();
              Notification.Builder builder = new Notification.Builder(ctx)
                      .setContentTitle(APP_TITLE_STRING)
                      .setContentText(ac.getName() + " achievement unlocked")
                      .setLargeIcon(bitmap)
                      .setSmallIcon(R.drawable.ic_trophy);
                  Intent intent = mLoginFragment.getGamesClient().getAchievementsIntent();
                  PendingIntent pIntent = PendingIntent.getActivity(ctx, AchievementManager.REQUEST_ACHIEVEMENTS, intent, Intent.FLAG_ACTIVITY_NEW_TASK);
                  builder.setContentIntent(pIntent);
              Notification note;
              if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.JELLY_BEAN) note = builder.build();
              else note = builder.getNotification();
              NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
              mNotificationManager.notify(1, note);
          }
      };
      mImageManager.loadImage(listener,uri,R.drawable.ic_trophy);
  }
  </code></pre>