These code examples were ranked by Codota’s semantic indexing as the best open source examples for Intent filterEquals method.
@Override public void onReceive(Context context, Intent intent) { Log.w("DirectoryUpdateReceiver", "Initiating scheduled directory update..."); try { SignalingSocket signalingSocket = new SignalingSocket(context); DirectoryResponse response = signalingSocket.getNumberFilter(); if (response != null) { NumberFilter filter = new NumberFilter(response.getFilter(), response.getHashCount()); filter.serializeToFile(context); } } catch (SignalingException se) { Log.w("DirectoryUpdateReceiver", se); } catch (Exception e) { Log.w("DirectoryUpdateReceiver", e); return; } scheduleDirectoryUpdate(context);
", error = " + error + ", removed = " + removed); } if (removed != null) { // Remember we are unregistered C2DMessaging.clearRegistrationId(context); onUnregistered(context); return; } else if (error != null) { // we are not registered, can try again C2DMessaging.clearRegistrationId(context); // Registration failed Log.e(TAG, "Registration error " + error); onError(context, error); if ("SERVICE_NOT_AVAILABLE".equals(error)) { long backoffTimeMs = C2DMessaging.getBackoff(context); Log.d(TAG, "Scheduling registration retry, backoff = " + backoffTimeMs); Intent retryIntent = new Intent(C2DM_RETRY); PendingIntent retryPIntent = PendingIntent.getBroadcast(context,
public IdleMaintenanceService(Context context, BatteryService batteryService) { mContext = context; mBatteryService = batteryService; mAlarmService = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, LOG_TAG); mHandler = new Handler(mContext.getMainLooper()); Intent intent = new Intent(ACTION_UPDATE_IDLE_MAINTENANCE_STATE); intent.setFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); mUpdateIdleMaintenanceStatePendingIntent = PendingIntent.getBroadcast(mContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); register(mContext.getMainLooper()); }
*/ public void onRegistered(Context context, String registrationId) throws IOException { // registrationId will also be saved } /** * Called when the device has been unregistered. */ public void onUnregistered(Context context) { } @Override public final void onHandleIntent(Intent intent) { try { Context context = getApplicationContext(); if (intent.getAction().equals(REGISTRATION_CALLBACK_INTENT)) { handleRegistration(context, intent); } else if (intent.getAction().equals(C2DM_INTENT)) { onMessage(context, intent);
{ @Override public void onReceive(Context context, Intent intent) { NotificationManager manger = (NotificationManager) context .getSystemService(context.NOTIFICATION_SERVICE); Intent mainIntent = new Intent("ti.intent.action.calendar.ALARM"); Notification notification = new Notification(0x7f020000, "", System.currentTimeMillis()); PendingIntent contentIntent = PendingIntent.getActivity(context, 0, mainIntent, 0); //TEST notification.setLatestEventInfo(context,"Payment Reminder","Send me to jhaynie@appcelerator.com",contentIntent); manger.notify(1, notification); } }
Toast.makeText(context, context.getString(R.string.start_fetch_msg), Toast.LENGTH_SHORT).show(); } } public static void stopAlarm(Context context, boolean clearNotification) { AlarmManager alarm = (AlarmManager) context.getSystemService( Context.ALARM_SERVICE); Intent intent = new Intent(context, FetchNewMsgService.class); PendingIntent sender = PendingIntent.getService(context, REQUEST_CODE, intent, PendingIntent.FLAG_CANCEL_CURRENT); alarm.cancel(sender); if (clearNotification) { NotificationManager notificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.cancel(Long.valueOf(GlobalContext.getInstance().getCurrentAccountId()).intValue()); } } }
scheduleAlarms(listener, ctxt, true); } public static void scheduleAlarms(AlarmListener listener, Context ctxt, boolean force) { SharedPreferences prefs=ctxt.getSharedPreferences(NAME, 0); long lastAlarm=prefs.getLong(LAST_ALARM, 0); if (lastAlarm == 0 || force || (System.currentTimeMillis() > lastAlarm && System.currentTimeMillis() - lastAlarm > listener.getMaxAge())) { AlarmManager mgr= (AlarmManager)ctxt.getSystemService(Context.ALARM_SERVICE); Intent i=new Intent(ctxt, AlarmReceiver.class); PendingIntent pi=PendingIntent.getBroadcast(ctxt, 0, i, 0); listener.scheduleAlarms(mgr, pi, ctxt); } }
public class OnBootReceiver extends BroadcastReceiver { private static final int PERIOD=300000; // 5 minutes @Override public void onReceive(Context context, Intent intent) { AlarmManager mgr=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE); Intent i=new Intent(context, OnAlarmReceiver.class); PendingIntent pi=PendingIntent.getBroadcast(context, 0, i, 0); mgr.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime()+60000, PERIOD, pi); } }
public static final String PREF_REENGAGEMENT_COUNT = "pref_reengagement_count"; //$NON-NLS-1$ public static final String BROADCAST_SHOW_REENGAGEMENT = Constants.PACKAGE + ".SHOW_REENGAGEMENT"; //$NON-NLS-1$ public static void scheduleReengagementAlarm(Context context) { AlarmManager am = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(BROADCAST_SHOW_REENGAGEMENT); PendingIntent pendingIntent = PendingIntent.getBroadcast(context, REQUEST_CODE, intent, 0); am.cancel(pendingIntent); long time = getNextReminderTime(); am.set(AlarmManager.RTC_WAKEUP, time, pendingIntent); } private static long getNextReminderTime() { int reengagementReminders = Preferences.getInt(PREF_REENGAGEMENT_COUNT, 1); int days; if (DateUtilities.now() - Preferences.getLong(AstridPreferences.P_FIRST_LAUNCH, 0) > DateUtilities.ONE_DAY * 30) { // Installed longer than 30 days // Sequence: every 6, 8, 10 days days = Math.min(10, 4 + 2 * reengagementReminders);
{ @Override public void onReceive(Context context, Intent intent) { NotificationManager manger = (NotificationManager) context .getSystemService(context.NOTIFICATION_SERVICE); Intent mainIntent = new Intent("ti.intent.action.calendar.ALARM"); Notification notification = new Notification(0x7f020000, "", System.currentTimeMillis()); PendingIntent contentIntent = PendingIntent.getActivity(context, 0, mainIntent, 0); //TEST notification.setLatestEventInfo(context,"Payment Reminder","Send me to jhaynie@appcelerator.com",contentIntent); manger.notify(1, notification); } }