AlarmReceiver.java 2.5 KB
package com.arellomobile.android.push;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import com.arellomobile.android.push.utils.GeneralUtils;
import java.util.Calendar;

public class AlarmReceiver
  extends BroadcastReceiver
{
  private static int a = 0;
  
  public static void clearAlarm(Context paramContext)
  {
    int i = 0;
    while (i < 10)
    {
      PendingIntent localPendingIntent = PendingIntent.getBroadcast(paramContext, i, new Intent(paramContext, AlarmReceiver.class), 134217728);
      ((AlarmManager)paramContext.getSystemService("alarm")).cancel(localPendingIntent);
      i += 1;
    }
  }
  
  public static void setAlarm(Context paramContext, String paramString, Bundle paramBundle, int paramInt)
  {
    Calendar localCalendar = Calendar.getInstance();
    localCalendar.add(13, paramInt);
    Intent localIntent = new Intent(paramContext, AlarmReceiver.class);
    localIntent.putExtra("title", paramString);
    localIntent.putExtra("local", true);
    if (paramBundle != null) {
      localIntent.putExtras(paramBundle);
    }
    paramInt = a;
    a = paramInt + 1;
    paramString = PendingIntent.getBroadcast(paramContext, paramInt, localIntent, 134217728);
    if (a == 10) {
      a = 0;
    }
    ((AlarmManager)paramContext.getSystemService("alarm")).set(0, localCalendar.getTimeInMillis(), paramString);
  }
  
  public void onReceive(Context paramContext, Intent paramIntent)
  {
    Intent localIntent1;
    if (GeneralUtils.isAmazonDevice())
    {
      localIntent1 = new Intent(paramContext, PushAmazonIntentService.class);
      localIntent1.setAction("com.amazon.device.messaging.intent.RECEIVE");
    }
    for (;;)
    {
      localIntent1.putExtras(paramIntent.getExtras());
      paramContext.startService(localIntent1);
      return;
      try
      {
        localIntent1 = new Intent(paramContext, Class.forName(PushServiceHelper.getPushServiceClassName(paramContext)));
        localIntent1.setAction("com.google.android.c2dm.intent.RECEIVE");
      }
      catch (ClassNotFoundException localClassNotFoundException)
      {
        for (;;)
        {
          Intent localIntent2 = new Intent(paramContext, PushGCMIntentService.class);
        }
      }
    }
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/arellomobile/android/push/AlarmReceiver.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */