All Things R&D
GSoC 2012 Weekly Report on OI WebIntents Agent (July 23-29)
July 30, 2012Posted by on
Last week, I implemented the function of invoking web intents from an Android app. Any Android app developer can invoke web intents through the following steps:
- Make sure the latest version of OI WebIntents Agent has been installed.
- Add the library webintents-helper.jar to the project build path.
- Create an WebIntentsHelper object.
- Call the method WebIntentsHelper.createChooserWithWebActivities() and send an intent to it.
Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setType("text/uri-list"); intent.putExtra(android.content.Intent.EXTRA_TEXT, "http://www.openintents.org"); WebIntentsHelper helper = new WebIntentsHelper(YourActivity.this); helper.createChooserWithWebActivities(intent);
The intent object here is the same as what you usually do in Android apps.
I’ve created a sample app and uploaded it to github. The following are some screenshots.
For different Android intents, data may be placed in different fields. Some are located by uri while others placed in the extra fields of an intent object. However, for web intents, data is universally placed in the “data” field. Now I’ve created a table which is used for processing such issue. Yet not fully completed. This is one of which I need to do next week.
I am going to add comments and adapt the format of code to make it comply with openintents code style.
Any feedback and suggestions are welcome.