Intent
- Since:
- Version 1.8 (API level 9)
Members
-
readonly, nullable action :string
-
The general action to be performed. This property is
null
if this intent has no action set.- Since:
- Version 1.8 (API level 9)
-
readonly categories :Array.<string>
-
Additional category information about the action to execute. This property is an empty array if this intent has no categories set.
- Since:
- Version 1.8 (API level 9)
-
readonly, nullable component :string
-
The explicit name of a component class to use for the intent. This property is
null
if this intent has no explicit component set.- Since:
- Version 1.8 (API level 9)
-
readonly, nullable data :mobicontrol.android.Uri
-
The data to operate on. This property is
null
if this intent has no data set.- Since:
- Version 1.8 (API level 9)
-
readonly, nullable extras :mobicontrol.android.Bundle
-
The additional information provided to the component. This property is
null
if this intent has no extras set. Note: Direct mutation of this property will not affect this intent.- Since:
- Version 1.8 (API level 9)
-
readonly flags :number
-
Flags controlling how this intent is handled. This property has default value
0
if this intent has no flags set.- Since:
- Version 1.8 (API level 9)
-
readonly, nullable identifier :string
-
An arbitrary identity of the intent to distinguish it from other intents. This property is
null
if this intent has no explicit identifier set.- Since:
- Version 1.8 (API level 9)
-
readonly, nullable selector :mobicontrol.android.Intent
-
The selector of this Intent. This is a modification to the kinds of things the intent will match. This property is
null
if this intent has no explicit selector set.- Since:
- Version 1.8 (API level 9)
-
readonly, nullable sourceBounds :mobicontrol.android.Rect
-
The bounds of the sender of this intent, in screen coordinates. This property is
null
if this intent has no explicit source bounds set.- Since:
- Version 1.8 (API level 9)
-
readonly, nullable type :string
-
The explicit MIME type of the intent data. This property is
null
if this intent has no explicit type set.- Since:
- Version 1.8 (API level 9)
Methods
-
withAction(action) → {mobicontrol.android.Intent}
-
Set action for the intent. Example actions include android.intent.action.VIEW, android.intent.action.EDIT, android.intent.action.MAIN, etc. See android.content.Intent.
Parameters:
Name Type Description action
string The general action to be performed. Returns:
mobicontrol.android.Intent - This intent.- Since:
- Version 1.8 (API level 9)
Example
// Start a camera app in still image mode, see https://developer.android.com/guide/components/intents-common#CameraStill var intent = mobicontrol.android.createIntent().withAction("android.media.action.STILL_IMAGE_CAMERA"); mobicontrol.android.startActivity(intent);
-
withCategories(categories) → {mobicontrol.android.Intent}
-
Set categories for the intent. See android.content.Intent.
Parameters:
Name Type Description categories
Array.<string> Additional information about the action to execute. Returns:
mobicontrol.android.Intent - This intent.- Since:
- Version 1.8 (API level 9)
Example
var intent = mobicontrol.android.createIntent() .withAction("android.intent.action.MAIN") .withCategories(["android.intent.category.HOME"]); mobicontrol.android.startActivity(intent);
-
withComponent(component) → {mobicontrol.android.Intent}
-
Set component for the intent. Specifies an explicit name of a component class to use for the intent, in a format defined by android.content.ComponentName.unflattenFromString. See android.content.Intent. Note: If parameter doesn't follow the correct format, component might be set to
null
.Parameters:
Name Type Description component
string The explicit name of a component class to use for the intent. Returns:
mobicontrol.android.Intent - This intent.- Since:
- Version 1.8 (API level 9)
Example
const COMPONENT = "com.example.app/.MainActivity"; var intent = mobicontrol.android.createIntent() .withComponent(COMPONENT) mobicontrol.android.startActivity(intent);
-
withData(uri) → {mobicontrol.android.Intent}
-
Set data for the intent. For example, the data might be a person record in the contacts database, expressed as URI. See android.content.Intent.
Parameters:
Name Type Description uri
mobicontrol.android.Uri The data to operate on, expressed as URI. Returns:
mobicontrol.android.Intent - This intent.- Since:
- Version 1.8 (API level 9)
Example
const ACTION_DIAL = "android.intent.action.DIAL"; const URI_DIAL_NUMBER = "tel:2125551212"; var intent = mobicontrol.android.createIntent() .withAction(ACTION_DIAL) .withData(URI_DIAL_NUMBER); mobicontrol.android.startActivity(intent);
-
withExtras(extras) → {mobicontrol.android.Intent}
-
Set the additional information provided to the component. For example, to search a contact in the address book, the extras might include a name, email, etc. See android.content.Intent.
Parameters:
Name Type Description extras
mobicontrol.android.Bundle The additional information provided to the component. Returns:
mobicontrol.android.Intent - This intent.- Since:
- Version 1.8 (API level 9)
Example
// Launch Google quick search, performing a search for "Android intent" keywords var extras = mobicontrol.android.createBundle().withString("query", "Android intent"); var intent = mobicontrol.android.createIntent(). withAction("com.google.android.googlequicksearchbox.GOOGLE_SEARCH"). withExtras(extras); mobicontrol.android.startActivity(intent);
-
withFlags(flags) → {mobicontrol.android.Intent}
-
Set flags for the intent. The flags should generally depend on the type of component being executed by the Intent, specifically the android.content.Intent.FLAG_ACTIVITY_* flags are all for use with mobicontrol.intent.startActivity() and the android.content.Intent.FLAG_RECEIVER_* flags are all for use with mobicontrol.intent.sendBroadcast(). See the Tasks and Back Stack documentation for important information on how some of these options impact the behavior of your application. The flags can be combined together using bitwise operations.
Parameters:
Name Type Description flags
number Flags controlling how this intent is handled. Returns:
mobicontrol.android.Intent - This intent.- Since:
- Version 1.8 (API level 9)
Example
const FLAG_ACTIVITY_CLEAR_TASK = 0x00008000; const FLAG_ACTIVITY_NO_HISTORY = 0x40000000; var intent = mobicontrol.android.createIntent() .withAction("android.settings.SETTINGS") .withFlags(FLAG_ACTIVITY_CLEAR_TASK | FLAG_ACTIVITY_NO_HISTORY); mobicontrol.android.startActivity(intent);
-
withIdentifier(identifier) → {mobicontrol.android.Intent}
-
Set identifier for the intent. An arbitrary identity of the intent to distinguish it from other intents.
Parameters:
Name Type Description identifier
string Identifier for this intent. Returns:
mobicontrol.android.Intent - This intent.- Since:
- Version 1.8 (API level 9)
-
withSelector(selectornullable) → {mobicontrol.android.Intent}
-
Set selector for this intent. If the selector is set, it will be used when trying to find entities that can handle the intent, instead of the main contents of the intent.
Parameters:
Name Type Attributes Description selector
mobicontrol.android.Intent <nullable>
The selector for this intent. Returns:
mobicontrol.android.Intent - This intent.- Since:
- Version 1.8 (API level 9)
-
withSourceBounds(rectnullable) → {mobicontrol.android.Intent}
-
Set the bounds of the sender of this intent, in screen coordinates. This can be used as a hint to the receiver for animations and the like.
Parameters:
Name Type Attributes Description rect
mobicontrol.android.Rect <nullable>
The bounds of the sender of this intent, in screen coordinates. Returns:
mobicontrol.android.Intent - This intent.- Since:
- Version 1.8 (API level 9)
-
withType(type) → {mobicontrol.android.Intent}
-
Set MIME type for the intent. Specifies an explicit MIME type of the intent data. Normally the type is inferred from the data itself. See android.content.Intent.
Parameters:
Name Type Description type
string The explicit MIME type of the intent data. Returns:
mobicontrol.android.Intent - This intent.- Since:
- Version 1.8 (API level 9)
Example
var intent = mobicontrol.android.createIntent() .withAction("android.intent.action.VIEW") .withData("file:///sdcard/Download/www/Email.wmv") .withType("video/x-ms-wmv"); mobicontrol.android.startActivity(intent);