pata
pata

Reputation: 989

launch Blackberry app from link in mail

I can not be more clear with the title :D

Is it possible? to launch an application on a blackbeery just cliking on a "link" inside a mail? i read about taping a url and going to the application but this is much more specific.

thx in advance

Upvotes: 1

Views: 408

Answers (2)

bogdan
bogdan

Reputation: 338

Look in the RIM sample apps, more specifically HTTPFilterDemo.

You have to register a filter for the type of link you need the app to be triggered by (you'll need to put this code in the main method of you app):

HttpFilterRegistry.registerFilter("www.rim.com","com.rim.samples.device.httpfilterdemo.filter");

where "www.rim.com" is obviously the link that should open the app and the second parameter is the package that contains the "Protocol" class. The Protocol class has a callback method:

public Connection openFilter( String name, int mode, boolean timeouts ) throws IOException {

This method will be called each time the user clicks on a link that has the form specified by you. So, to open the app, in the "openFilter" method, do:

int modHandle = CodeModuleManager.getModuleHandle("YourAppModuleName");
        ApplicationDescriptor[] apDes = CodeModuleManager.getApplicationDescriptors(modHandle);
        try {
            ApplicationManager.getApplicationManager().runApplication(apDes[0]);
        } catch (ApplicationManagerException e) {
            e.printStackTrace();
        }

Upvotes: 0

Eugen Martynov
Eugen Martynov

Reputation: 20140

Actually you can listen incoming emails. You can implement menu item that will be available in mail app. But you can also implement content handler with specific URI to launch your app.

All examples are available in BB samples.

Upvotes: 1

Related Questions