code: public static PendingIntent getBroadcast(Context context, int requestCode, Intent intent, int flags) {
          PendingIntent.getBroadcast(context, requestCode, intent, flags).cancel();
          return PendingIntent.getBroadcast(context, requestCode, intent, flags);
      }
docs: Create a new {@link PendingIntent} clearing previously created {@link PendingIntent} that does not work properly due to application's re-installation.
  Bugfix utility for this issue: https://code.google.com/p/android/issues/detail?id=61850