On iPhone, an application can associate a new protocol name to itself so that if a user types in 'myapp://xxx' in a web browser it calls the application.
Is this possible with BlackBerry or Android?
On iPhone, an application can associate a new protocol name to itself so that if a user types in 'myapp://xxx' in a web browser it calls the application.
Is this possible with BlackBerry or Android?
For Android have a look at this question's answers:
Android Respond To URL in Intent
and also the following page especially in the section "Data Types" about android:scheme on this page:
http://developer.android.com/guide/topics/intents/intents-filters.html
For your app you would put something like the following in your AndroidManifest.xml:
<intent-filter><action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:scheme="myapp"></data>
</intent-filter>
For BlackBerry - yes, to an extent, look at the net.rim.device.api.browser.plugin package (JDE 4.0.0 and later). It allows you to specify a callback interface for a given MIME type & other parameters.
Basically you subclass BrowserContentProvider to indicate the MIME type(s) you want to receive, and register with BrowserContentProviderRegistery.
I don't have a lot of experience with this - but it looks like you may be limited to providing custom rendering functionality - that may be ok for you. I'm not sure how limited your ability to do anything else would be - you'd have to try things out.
For blackberry devices running 4.0 or later (all "trackball" devices and up run at least 4.2) the following code is all you need:
// Get the default sessionBrowserSession
net.rim.blackberry.api.browser.browserSession = Browser.getDefaultSession();
// now launch the URL
browserSession.displayPage("http://www.BlackBerry.com");
Since this is a pretty reusable code segment I recommend placing it the following function:
public static void loadURL(String url)
{
try{
net.rim.blackberry.api.browser.BrowserSession bSession = net.rim.blackberry.api.browser.Browser.getDefaultSession();
bSession.displayPage(url);
bSession.showBrowser();
}
catch (Exception ex){
System.out.println("Error loading url [" + url + "]: " + ex.getMessage());
}
}