Intents are awesome features loved by every android developer. It makes our work easier. Now RhoMobile 4.1+ wraps this feature and gives it as Intent API.
Before entering into RMS Intent, we should have some knowledge about Android Intent Concept.
What is intent?
Intent is a software mechanism in the Android Operating System. It is basically an object which allows android components to request an action from other Android components. It allows to communicate with application components in several ways :
- To start an activity
- To start a service
- To deliver a broadcast
Android supports two types of intents
- Explicit Intents
- Implicit Intents
For more details see these links :
Lots of documentation and blogs are available for Android Intent.
It’s great feature for RhoMobile developers. Using this API, We can communicate between two RhoMobile applications as well as between RhoMobile and a native application.
No need to include extension for Intent API which is in-built with “coreapi” extension.
RhoMobile offers three methods to play with Intent. They are –
Using this method, I tried a sample application and I’d like to share those code snippets,
By default, some common Intents are available to us, you can read about it at Common Intents
Let’s try to send email and message using Intent API method Intent.send()
“EXTRA_SUBJECT”:”Sample Subject !”,
“EXTRA_TEXT”:”Email body content !”}
intentType – Type of Intent to send
action – General action to be performed, such as ACTION_SEND, ACTION_VIEW, ACTION_EDIT, ACTION_MAIN, etc.
mimeType – What type of text to be supported
data – It is extra message which can be pass via Intent.
When we call this method, it will show available action to send email as shown,
We can choose any option and send email with detailed description using Intent. We can attach file with email as well.
Using “ACTION_VIEW”, we can open any file.
uri is the string used to open the application associated with the URI.
So, We can easily communicate with Android ecosystem using Intent.
RhoMobile has given a wonderful video about it RhoIntent API
I hope this will help you to start a RhoIntent API. Keep researching with RhoMobile + Intent API and Let us update you :-).