Android examples for Intent:Open App
Creates pending intent to fire OnEventStartReceiver when it's time to change the ring volume
import android.app.AlarmManager; import android.app.PendingIntent; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.database.Cursor; import android.media.AudioManager; import android.util.Log; public class Main{ public static String EXTRA_VOLUME_ID = "edu.mines.csci498.shutup.volume_id"; /**/*from w w w .j ava2 s .c o m*/ * Creates pending intent to fire OnEventStartReceiver when it's time to change the ring volume * @param context - context under which the AlarmHelper operates * @param eventId - eventId for event to change volume for * @param volumeId - volumeId to change to * @return */ private static PendingIntent getPendingIntent(Context context, int eventId, int volumeId) { Intent i = new Intent(context, OnEventStartReceiver.class); i.putExtra(EXTRA_VOLUME_ID, volumeId); return PendingIntent.getBroadcast(context, eventId, i, PendingIntent.FLAG_UPDATE_CURRENT); } }