/// <summary> /// Notify when a push is received. </summary> /// <param name="extras"> push parameters. </param> public virtual void onPushReceived(Bundle extras) { /* Relay push to listeners if its an azme push */ if (extras.containsKey(INTENT_EXTRA_AZME)) { Intent intent = new Intent(INTENT_ACTION_MESSAGE); intent.Package = mContext.PackageName; extras.putString(INTENT_EXTRA_TYPE, INTENT_EXTRA_TYPE_PUSH); intent.putExtras(extras); mContext.sendBroadcast(intent); } }
public override void onReceive(android.content.Context context, android.content.Intent intent) { // BEGIN_INCLUDE(onReceive) // Protect against rogue update broadcasts (not really a security issue, // just filter bad broacasts out so subclasses are less likely to crash). string action = intent.getAction(); if (android.appwidget.AppWidgetManager.ACTION_APPWIDGET_UPDATE.Equals(action)) { android.os.Bundle extras = intent.getExtras(); if (extras != null) { int[] appWidgetIds = extras.getIntArray(android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_IDS ); if (appWidgetIds != null && appWidgetIds.Length > 0) { this.onUpdate(context, android.appwidget.AppWidgetManager.getInstance(context), appWidgetIds ); } } } else { if (android.appwidget.AppWidgetManager.ACTION_APPWIDGET_DELETED.Equals(action)) { android.os.Bundle extras = intent.getExtras(); if (extras != null && extras.containsKey(android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_ID )) { int appWidgetId = extras.getInt(android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_ID ); this.onDeleted(context, new int[] { appWidgetId }); } } else { if (android.appwidget.AppWidgetManager.ACTION_APPWIDGET_ENABLED.Equals(action)) { this.onEnabled(context); } else { if (android.appwidget.AppWidgetManager.ACTION_APPWIDGET_DISABLED.Equals(action)) { this.onDisabled(context); } } } } }