3

I have made my own browser - now what I am trying to do is set my own browser as the default browser so that when a user clicks on the blackberry default browser, my brower will open.

Is it possible to do this?

Thanks in advance

skaffman
  • 398,947
  • 96
  • 818
  • 769
Neeraj
  • 31
  • 4

2 Answers2

3

Unfortunately, you can't replace the system browser with your own browser.

And polling in the background like the other answer says is bad idea for several reasons, including needless use of your battery charge.

Eric Giguere
  • 3,495
  • 15
  • 11
  • Polling that uses the radio (e.g.) api requests is a large drain, so is polling that wakes the display, but do you know how much drain getVisibleApplications() would use when it fails to match the browser case? – Ray Vahey Jan 27 '11 at 23:11
  • Here's an example http://supportforums.blackberry.com/t5/Java-Development/Create-a-Background-Application/ta-p/445226 what are the several reasons this is bad? – Ray Vahey Jan 27 '11 at 23:39
  • There's nothing wrong with background applications, I use them all the time on the BlackBerry. But your example is very bad because it's busy waiting, always running and checking whether the browser is in the foreground. Most background apps are idle most of the time. Also, as a user I would hate having that kind of dialog popup all the time. – Eric Giguere Jan 27 '11 at 23:47
  • I was hoping you had an answer to the drain on the battery question from that sort of background process. Other than it's bad. (5 seconds in the RIM example) I think I will put it to the test, I would like to know how much it shortens battery life. – Ray Vahey Jan 28 '11 at 00:11
  • I agree on the annoyance of the popup, I wouldn't like that either :) – Ray Vahey Jan 28 '11 at 00:17
  • Since I just don't so this kind of thing, I have never tried to quantify the drain. Also, you will be slowing down the device overall as it spends CPU time on this task. – Eric Giguere Jan 28 '11 at 01:04
  • Hold on a moment... Comparing a memory resident value every x seconds (which is essentially what we're talking about) is not going to be noticeable on a BlackBerry CPU :) – Ray Vahey Jan 28 '11 at 01:21
  • You said "at a fairly quick interval", not every few seconds... yes, if it was only every few seconds then it wouldn't be much of a drain. But it also wouldn't be very responsive. – Eric Giguere Jan 28 '11 at 01:48
  • To me in this case "at a fairly quick interval" is every few seconds. Sorry I wasn't specific. Yes there would be a variable delay between opening the browser and the detection. I did say it wasn't exactly as he wanted but it was the closet thing I could think of. – Ray Vahey Jan 28 '11 at 01:57
  • +1 for not being able to replace the system browser, I do believe that is correct. – Ray Vahey Jan 28 '11 at 02:46
2

Interesting question :)

I cannot think of a way to do it exactly as you've asked... but you could try something like poll from the background at a fairly quick interval using ApplicationManager.getApplicationManager().getVisibleApplications();

And if the web browser comes to the foreground your process launches your dialog. E.g. "Would you like to use my super-duper browser instead? [yes] [no]"

Cheers

Ray

Ray Vahey
  • 3,065
  • 1
  • 24
  • 25
  • By "fairly quick interval" I really meant around 5 seconds, also see http://supportforums.blackberry.com/t5/Java-Development/Create-a-Background-Application/ta-p/445226 for an example background app – Ray Vahey Jan 28 '11 at 02:01