Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
gReebok
Posts: 12
Registered: ‎11-27-2008
My Device: Not Specified

Open file and wait until file is closed

Hello everyone !!!

 

I need to implement the following solution:

1. Open file using default associated application

2. Determine the time file is closed.

 

The most simple approach is to open file in browser. But this approach does not allow to determine the time file is closed because of:

1. "Browser" process is always opened on device, so you cant determine the close event using the process id/name

2. When you start Browser application using cod file name and new descriptor new browser instance is not created.

3. There is no way to get any information about file currently showed in browser.

4. No page/file changed events are available

 

Also you can't use net_rim_bb_file_explorer OR "Media->Explorer" because there is no way to pass file to be opened as parameter or argument to this application.

 

I've tried  to use  BrowserField  API to open file,  but it seems to be impossible to open jar/jad files because of some security reasons.

 

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=10231#M10231

 

I need jar/jad file support to initiate Application Installation dialog and after it finished report success status (possible there is another solution to do so, but I don't know).

 

Any suggestions?

THX!!

Please use plain text.
Developer
raksat
Posts: 40
Registered: ‎08-21-2008
My Device: Not Specified

Re: Open file and wait until file is closed

You wrote: I need jar/jad file support to initiate Application Installation dialog and after it finished report success status.

 

---------------

 

But how can you going to stop BB device to reboot after installation of application because device will reboot after installation.??

Raks
Please use plain text.
New Developer
gReebok
Posts: 12
Registered: ‎11-27-2008
My Device: Not Specified

Re: Open file and wait until file is closed

It is ok. I don't need to stop device reboot if occured. I only need to wait while application is being installed. And after that check up whether application has been successfully installed or not (by app name, time and other properties). So I can check up application installation status after device reboot.

 

The problem is that I can't always wait for device reboot to test installation success status because sometimes installation does not require reboot.

Please use plain text.
New Developer
LeonMax
Posts: 15
Registered: ‎11-26-2008
My Device: Not Specified

Re: Open file and wait until file is closed

You can use Invocation Api to open and get result of the file that available from the JDE4.3.

 

try
{
  String url = "file:///SDCard/Test.txt";
  Invocation invoc = new Invocation(url);
  invoc.setAction(ContentHandler.ACTION_OPEN);
  //invoc.setArgs(new String[] {"debug"});
  if (Registry.getRegistry("packagename.classname").invoke(invoc))
  {
    // App must exit before invoked application can run
  }
  else
  {
    // Application does not need to exit

    Invocation ret = Registry.getRegistry("packagename.classname").getResponse(true);
   
    //This you can use  ret.getStatus() for getting result
  }
}
catch (IOException ex)
{
 

 

As for me I should to support JDE 4.2 and I don't understand
why approach with Browser Field doesn't work on real device and there are no
comments on this topic in RIM KB. Maybe, RIM decided for some security reason to
block rendering of the jar/jad files on real devices, but why they didn’t point
out about this. Instead of this when we try to get content of jar.jad files
Rendering Exception are thrown with null message. WTF.

Please use plain text.
Developer
marchywka
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: Open file and wait until file is closed

I've got a custom browser that can launch the RIM browser if needed- hardly elegant but it seems to work

and probably tolerable for those cases where a user sometimes wants to install something.

 

I've also got a custom installed app skeleton which also works but can't AFAIK programatically reboot

( although on my 7130 it seems that any attempt to call Graphic.fillEllipse() generates a reboot... ).

 

Please use plain text.
New Developer
gReebok
Posts: 12
Registered: ‎11-27-2008
My Device: Not Specified

Re: Open file and wait until file is closed

Thank you a lot, marchywka

 

Does the browser solution, you were talking about, allow to run second BB Browser instance? My application can't change default browser app.

 

Does the file installation solution use standard BB dialogs or just silently install application using special CodFileManger API? How it works? Does it support jar format?

 

PS. Graphic.fillEllipse() - great trick, I want to check it out for other devices.

 

THX!!!

Please use plain text.
Developer
marchywka
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: Open file and wait until file is closed

You should be able to find the RIM example that goes through the service book and finds

all the possible things to launch but I just use the default browser session.

 

The installer app too was based on something someone else posted- and it works fine

except for reboot problem.

 

It would be odd if no one had noticed the fillEllipse problem before- I would have to guess it

is just something with my phone. I've also got a wierd problem with int values after calling

some String.indexOf() methods ( almost looks like memory corruption but I can't otherwise see

how it is my code's problem as of yet).

 

 

 

 

 

Please use plain text.
New Developer
gReebok
Posts: 12
Registered: ‎11-27-2008
My Device: Not Specified

Re: Open file and wait until file is closed

Could you please post the link where I can get/see your broswer and app installation solutions (or any special words to google for).

 

Appreciate.

Please use plain text.
New Developer
LeonMax
Posts: 15
Registered: ‎11-26-2008
My Device: Not Specified

Re: Open file and wait until file is closed

I want to know does it support jar format or it just implements it is own UI like default, parses jad file and installs application using CodeModuleManager, CodeModuleGroup, CodeModuleGroupMananager classes?

 

Thanks.

Please use plain text.
Developer
marchywka
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: Open file and wait until file is closed

Essentially all of this stuff is developmental and not really published. I do, as advertized, develop

OTA and just about everything I mention is in fact available if you know where to look but

I'm not sure I'd want to make it public yet. Happy to post code snippets to but again all

I'd hoped to accomplish in this case was reaffirm that stuff others had posted seems to work

to some extent.

 

 

I would be curious to see if there is interest in publishing developmental  apps for test and comment.

I'm also trying to replicate the GOOG cell tower

database by getting a lot of people to use a developmental browser with a GPS enabled device

and send me back log entries with GPS and cell tower info.

 

 

 

 

 

 

 

Please use plain text.