Coding Guru
Intent
What is Intent?
Intent-->An Android Intent is an object carrying an intent i.e. message from one component to another component
within the application or outside the application
USAGE OF Intent
//intent with arguments
Intent intent = new Intent(Intent.ACTION_SYNC, null, this, DownloadService.class);
/* Send optional extras to Download IntentService */
intent.putExtra("url", url);
intent.putExtra("receiver", String.valueOf(mReceiver));
intent.putExtra("requestId", 101);
startActivity(intent);
//without arguments
Intent intent=new Intent(this,MyActivity.class);
startActivity(intent);
startActivity(new Intent(getBaseContext(), MyActivity.class));
Context.startActivity()-->The Intent object is passed to this method to launch a new activity or get an existing activity to do something new.
Context.startService()-->The Intent object is passed to this method to initiate a service or deliver new instructions to an ongoing service.
Context.sendBroadcast()-->The Intent object is passed to this method to deliver the message to all interested broadcast receivers.
Action on Intent :
-
ACTION_ALL_APPS -->List all the applications available on the device.
-
ACTION_ANSWER -->Handle an incoming phone call.
-
ACTION_ATTACH_DATA -->Used to indicate that some piece of data should be attached to some other place
-
ACTION_BATTERY_CHANGED -->This is a sticky broadcast containing the charging state, level, and other information about the battery.
-
ACTION_BATTERY_LOW -->This broadcast corresponds to the " Low battery warning " system dialog.
-
ACTION_BATTERY_OKAY -->This will be sent after ACTION_BATTERY_LOW once the battery has gone back up to an okay state.
-
ACTION_BOOT_COMPLETED -->This is broadcast once, after the system has finished booting.
-
ACTION_BUG_REPORT -->Show activity for reporting a bug.
-
ACTION_CALL -->Perform a call to someone specified by the data.
-
ACTION_CALL_BUTTON -->The user presses the “call " button to go to the dialer or other appropriate UI for placing a call.
-
ACTION_CAMERA_BUTTON -->The “Camera Button “was pressed.
-
ACTION_CHOOSER -->Display an activity chooser, allowing the user to pick what they want to do before proceeding.
-
ACTION_CONFIGURATION_CHANGED -->The current device Configuration (orientation, locale, etc) has changed.
-
ACTION_DATE_CHANGED -->The date has changed.
-
ACTION_DEFAULT-->A synonym for ACTION_VIEW, the “standard " action that is performed on a piece of data.
-
ACTION_DELETE -->Delete the given data from its container.
-
ACTION_DEVICE_STORAGE_LOW -->A sticky broadcast that indicates low memory condition on the device.
-
ACTION_DEVICE_STORAGE_OK -->Indicates low memory condition on the device no longer exists.
-
ACTION_DIAL -->Dial a number as specified by the data.
-
ACTION_DOCK_EVENT -->A sticky broadcast for changes in the physical docking state of the device.
-
ACTION_DREAMING_STARTED -->Sent after the system starts dreaming.
-
ACTION_DREAMING_STOPPED -->sent after the system stops dreaming.
-
ACTION_EDIT -->Provide explicit editable access to the given data.
-
ACTION_FACTORY_TEST -->Main entry point for factory tests.
-
ACTION_GET_CONTENT -->Allow the user to select a particular kind of data and return it.
-
ACTION_GTALK_SERVICE_CONNECTED -->A GTalk connection has been established.
-
ACTION_GTALK_SERVICE_DISCONNECTED -->A GTalk connection has been disconnected.
-
ACTION_HEADSET_PLUG -->Wired Headset plugged in or unplugged.
-
ACTION_INPUT_METHOD_CHANGED -->An input method has been changed.
-
ACTION_INSERT -->Insert an empty item into the given container.
-
ACTION_INSERT_OR_EDIT -->Pick an existing item, or insert a new item, and then edit it.
-
ACTION_INSTALL_PACKAGE -->Launch application installer.
-
ACTION_LOCALE_CHANGED -->The current device's locale has changed.
-
ACTION_MAIN -->Start as a main entry point, does not expect to receive data.
-
ACTION_MEDIA_BUTTON -->The “Media Button “was pressed.
-
ACTION_MEDIA_CHECKING -->External media is present, and being disk-checked.
-
ACTION_MEDIA_EJECT -->User has expressed the desire to remove the external storage media.
-
ACTION_MEDIA_REMOVED -->External media has been removed.
-
ACTION_NEW_OUTGOING_CALL -->An outgoing call is about to be placed.
-
ACTION_PASTE -->Create a new item in the given container, initializing it from the current contents of the clipboard.
-
ACTION_POWER_CONNECTED -->External power has been connected to the device.
-
ACTION_REBOOT -->Have the device reboot. This is only used by system code.
-
ACTION_RUN -->Run the data, whatever that means.
-
ACTION_SCREEN_OFF -->Sent after the screen turns off.
-
ACTION_SCREEN_ON-->Sent after the screen turns on.
-
ACTION_SEARCH -->Perform a search.
-
ACTION_SEND-->Deliver some data to someone else.
-
ACTION_SENDTO -->Send a message to someone specified by the data.
-
ACTION_SEND_MULTIPLE -->Deliver multiple data to someone else.
-
ACTION_SET_WALLPAPER -->Show settings for choosing wallpaper.
-
ACTION_SHUTDOWN -->Device is shutting down.
-
ACTION_SYNC -->Perform data synchronization.
-
ACTION_TIMEZONE_CHANGED-->The time zone has changed.
-
ACTION_TIME_CHANGED--> The time was set.
-
ACTION_VIEW -->Display the data to the user.
-
ACTION_VOICE_COMMAND-->Start Voice Command.
-
ACTION_WALLPAPER_CHANGED-->The current system wallpaper has changed.
-
ACTION_WEB_SEARCH -->Perform a web search.