1

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?

Michael Donohue
  • 11,776
  • 5
  • 31
  • 44
Fabio
  • 145
  • 1
  • 11
  • 2
    BlackBerry and Android are completely different pieces of software. Separate questions is generally better – Casebash May 03 '10 at 06:53

3 Answers3

6

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>
Community
  • 1
  • 1
Intrications
  • 16,782
  • 9
  • 50
  • 50
1

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.

Anthony Rizk
  • 3,666
  • 20
  • 21
-3

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());
    }
}
AtariPete
  • 1,368
  • 6
  • 19
  • 29
  • FiXedd, you're right I overlooked the question details. Either way it was properly modded down... – AtariPete Jun 25 '09 at 20:51
  • If your answer is completely off, then you should either delete it or edit it to be relevant. That avoids more downvotes and losing more rep – Casebash May 03 '10 at 06:54