All Things R&D
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.
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:
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.
Last week I added two URL shorten apps which now you can have an experience.
Currently you can feel the onSuccess callback by calling the Shorten with Goo.gl app. Following I will show some screenshots from my tablet.
Fig 1 is the shorten example page from webintents.org. When you click and choose Shorten with Goo.gl, you can get this screenshot.
When you click the return button, you can return to the former page with change on the bottom line.
When you share picture and calling the Web Intents Debugger, it may show like the following picture:
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.
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.
2. This page works. Still you can go to Fig 2 by clicking links Example -> 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.
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.
 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.
 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.
I will implement the function for the registration of a Web intent. Hoping that I can finish it before the mid-term evaluation.
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:
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.
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.
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.
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.
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.
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.
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.
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:
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.