My R&D World

All Things R&D

Category Archives: GSoC

User Guidelines for OI WebIntents

Hi there,

This blog presents a summary of user interface for current OI WebIntents. Now the app supports both tablets and handsets.

This is the main page with an introduction section, a service registration section, a service invocation section and a link to home page of webintents.org.

There are five action items in the action bar: backward, forward, reload, goHome and applicaiton management.

When a new application is found, a notification message is shown. The user can enter into application management interface by click on the notification or the menu item.

There are three tabs in the Web application management interface: New Found, My App and Trash, each with its own menu items. The sign “+” here means add the checked Web apps in New Found tab to My App, while “-” means removing them to trash. Since in current version, the agent no longer marked visited applications and ignore them in future visits, I put a trash tab here for recycling instead of deleting unused applications forever.

When entering the simple share web page on webintents.org and click on the share button, a chooser dialog appears (with or without web apps).

Now you can use Web application like Twitter or Android application like Gmail to complete your action.

When running the share sample app now, the chooser dialog appears in its own context now.

The interface for handsets is similar.

The biggest difference is displaying Web applications and their web intents. Still, in the intents detail interface, a user can make same menu operations as its parent. Since back button shows different results from in tablets, I added a navigation up support for the application icon to return to the home page.

GSoC 2012 Weekly Report on OI WebIntents Agent (July 23-29)

Hi there,

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:

  1. Make sure the latest version of OI WebIntents Agent has been installed.
  2.  Add the library webintents-helper.jar to the project build path.
  3. Create an WebIntentsHelper object.
  4. Call the method WebIntentsHelper.createChooserWithWebActivities() and send an intent to it.

For example:

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.

Fig1. Sample share app

Fig2. Selection list of Web apps and Android apps

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.

GSoC 2012 Weekly Report on OI WebIntents Agent (July 16-22)

Hi there,

Last week I added two URL shorten apps which now you can have an experience.

Since calling the new two apps will be blocked by the same-origin policy of Javascript, I added a new table named “local_service_domain” which is used for keeping and loading domains  for local services.

The onSuccess callback of startActivity specified in the Spec was implemented last week. Since the interface between WebView and Javascript is so limited, the implementation of this callback is tricky and may need to be revised in the future.  I am trying to keep the interfaces the same as specified in the Spec, so if you find some code a little weird, please let me know.

Currently you can feel the onSuccess callback by calling the Shorten with Goo.gl app. Following I will show some screenshots from my tablet.

Fig1. Shorten URL example

Fig 1 is the shorten example page from webintents.org. When you click and choose Shorten with Goo.gl, you can get this screenshot.

Fig 2. Shorten with Goo.gl

When you click the return button, you can return to the former page with change on the bottom line.

Fig 3. Result

Another issue:

When you share picture and calling the Web Intents Debugger, it may show like the following picture:

Fig 4. Share picture by the Web Intents Debugger

This is because Android uses content providers to locate and load files which no file extension can be found in the path. So the resulting data have no data type included. If you try to use the app in Chrome to share a image file with no extension or extension other than any image type like (.pdf, .doc, you can change it), the same thing will happen.

This week’s work

This week I will implement calling web intents from an Android app. The main idea now is to provide a customized Activity which any Android app can use to calling web intents.

 

GSoC 2012 Weekly Report on OI WebIntents Agent (June 25-July 1)

Hi there,

Happy Canada Day!

Last week I have done with the preliminary stage of integration work for Web Intents and Android Intents. The new code has been uploaded. Here I am presenting some instructions for how you can get a simple tour of such idea.

Because now it is only implemented for the action “http://webintents.org/share”, only two pages http://examples.webintents.org/intents/share/share.html and http://examples.webintents.org/usage/startActivity/index.html at webintents.org are working.

1. When you start the app, Fig 1 is shown.

Fig 1. Startup page

2. This page works. Still you can go to Fig 2 by clicking links Example -> Simple Share.

Simple Share

Fig 2. Simple Share

3. “Share an Image” is not taking effect yet because I am working on solving image data transfer between components. But you can click the link share button to get a feel.

Fig 3. Popup selection list

4. A popup selection list of both Web apps and Android apps is shown. (I suggest you install Gmail app at least which may not appear if you run the app in AVD). Then you can choose Twitter Web Intents service or Android apps to complete your action, as in Fig 4 and 5.

Fig 4. Share link to Twitter

Fig 5. Share link by Gmail

Some NOTES:

[1] Since now most of the existing Web Intents services are only effective in Chrome, I plan to modify some of them and attach to this app. So here you can see a local href value of the Web apps.

[2] If your connectivity is too slow, it may need more time to load the pages. So please be patient or try to test it in a better network.

Next Week:

I will implement the function for the registration of a Web intent. Hoping that I can finish it before the mid-term evaluation.

GSoC 2012 Weekly Report on OI WebIntents Agent (June 18-24)

Hi,

Last week I was trying to integrate Android apps for web intent invocations. The task is much harder than I thought, and it is only half-done now. Here I would like to share a screen shot for the button click event at http://examples.webintents.org/usage/startActivity/index.html.

Now at least two problems are in the way:

  1. How to map a Web intent to its corresponding Android intents
  2. How to transfer data of types other than ’text/*‘

I am afraid I may not solve the two perfectly at current stage but I will try every effort.

Next week I will continue with the remaining integration work. If it is done, I will start with developing the management interfaces of the intents registry.

I would appreciate very much if you have any feedback.

Cheers

GSoC 2012 Weekly Report on OI WebIntents Agent (June 11-17)

Hi there,

In the last week, I solved the login issue of Twitter. It’s a problem of cookie management during HTTP transactions. I’ve written an article on how to make cookie set-get operations when making HTTP request-response by your self. The github code has been updated. It should be much better than the last version.

Another big change is that I created a CustomWebView class and overrode its loadUrl method instead of the previous shouldOverrideUrlLoading of the default WebView class. It’s my fault for past detours. I should have used this method earlier.

Another activity class named “org.openintents.wiagent.ui.WebIntentsAgentActivity” was created for naming reasons, it was to substitute for the work of WIAgentWebView which will be disposed of in the future. As for all the class changes which relate to the design part, I will update the design report before middle-term evaluation.

Some one told me the fire of “DOMContentLoaded” is much faster than “onload”. I spent one afternoon in testing their performance. For mobile devices, DOMContentLoaded is indeed faster than onload (around 60 seconds, so slow for onload). But it still be not enough for this project (I think it might be a result of the Webkit two pass layout for mobile versions, i.e. rendering first, others later). So I think the method of Javascript injection which I used in applying will be abandoned in this project.

I couldn’t make it to add local apps to the suggested application list last week. That continues to be on my schedule for this week.

Cheers

GSoC 2012 Weekly Report on OI WebIntents Agent (June 3-10)

Hi there,

Eventually, I escaped the annoying and frustrating realm surrounded by GFW and made it to have access to Twitter and all the websites I need.

This week, I implemented the simple share activity, though still with some bugs. The app starts with a local html file including links online. When you click the link, it will redirect you to the onlne “startActivity” page from webintent.org. The reason for this is that I need to change the page code before it is loaded into the WebView.  The button of the page will start an “http://webintents.org/share” activity. Then our agent  will suggest you with related registered apps, Twitter now.

The function is now very simple and buggy. The main cause is the limited api of android.webkit. It seems sometimes “shouldOverrideUrlLoading” does not get called as I want. I think I should discuss with others on this problem.

Next step, I plan to let the suggested apps having local Android apps on the list which is one of the goals of this project.

The latest code has been published. Because of my skills, I believe they are not very good. Any feedbacks are welcome.

Thanks

GSoC 2012 Weekly Report on OI WebIntents Agent (May 22-June 2)

Hi,

Sorry for the currently slow development.

Since my blog at wordpress.com is blocked by GFW, I have submit this week’s report here. Next week I will go back to Canada and everything will be back to normal.

The current published version of the agent runs far less reliable on intent invocation grab of some examples at http://examples.webintents.org/, especially for those in iframes. The reason is because a bug from Javascript same orgin policy being created after the website had been updated.

My former idea was to insert Javascript code before WebView loading corresponding pages which let the Java code on Android grab intent invocations. I was trying to insert the code in the method “onPagefinished” of WebViewClient. But after many tests, I found the solution is unreliable. Because the connection speed of mobile devices is far less than a desktop computer, the moment when this method get called is slow and uncertain. The user may often have to wait several minutes for my inserted scripts to execute. This problem also happens to the “onload” event.

Now I am overriding the method “shouldOverrideUrlLoading” of WebViewClient by getting Http response in my own code, modifying the data and loading it into WebView. The initial development goes smoothly and I have succeed in grabbing the intents invocation at http://examples.webintents.org/usage/startActivity/index.html.

A problem is when “shouldOverrideUrlLoading” gets called. I’ve tested some conditions and it only didn’t get called when loading url in “onCreate” method of Activity. I can work around this as long as the first shown page of the app not containing any intents invocation.

In the next week, I will focus on this new solution to get it working on web twitter.

GSoC 2012 Pre-coding Report (May 7-21)

Cheers for the beginning of coding period of GSoC.

Since I am now in China with limited Internet access (I didn’t expect so many web sites are
blocked by GFW), the present development is significantly affected.
The current status of OI WebIntents Agent is as follows:
1. I’ve changed the design of UI, replacing the previous control buttons with
action items in the action bar which makes the look and feel better.
2. I added a menu item named ‘Registered applications’, though very simple now,
where the user can do some management executions on his registered
applications. Twitter is a prepopulated application now for future test.

Parsing and executing js scripts by WebView of Android seems to be very slow
and buggy. So grabbing web intents related js function execution by Java does
not work always good and I am thinking about better solutions to fix it.

I’ve uploaded the project onto GitHub at
https://github.com/openintents/webintents-agent’ so that anyone can make
suggestions on my coding. Any feedbacks are welcome.

It is difficult for me to publish this report because wordpress.com is on the
blacklist of GFW. I think my next report will also come in two weeks,
immediately after I come back to Canada.

GSoC 2012 Pre-coding Report (April 30-May 6)

Hi there,

The second bonding week for GSoC 2012. This week openintents moved its code repositories onto Github.

To be consistent I had a plan on changing the name of my project to “OI WebIntents Agent” and using “org.openintents.wiagent” as the package name of the promising app. Another big plan is that I was thinking about using a content provider instead of former pure SQLite database access because I found it has more benefits for future maintenance including test and update.

Here I would like to share a similar work from phonegap.

The work I did last week:

  • Create a WebIntentsProvider. The work is just half-done.
  • Populate the WebIntentsProvider with the SHARE intent.
  • Reading the source code of other projects from openintents to be familiar with its code style.
  • Cleaning up the demo code used for application. The work is almost done.
  • Bonding period work of GSoC and openintents.

The next report will come in two weeks. That is the last pre-coding report before the coding work formally starts. I hope I can make a very initial demo at the moment.