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
Posts: 20
Registered: ‎08-26-2009
My Device: Not Specified

Can a third party app find out about the permissions required by other third party app

Hello,

 

I understand that an app on blackberry platoform has no access to other vendors applications. However, am curious to know that is it possible for one application to find out the permissions needed by other applications.

 

Any thoughts or suggestions will be really helpful.

Developer
Posts: 159
Registered: ‎08-19-2008
My Device: Not Specified

Re: Can a third party app find out about the permissions required by other third party app

No , as per my knowledge you can only invoke applications ........cannot retreive obtain any permission of other application

Developer
Posts: 77
Registered: ‎01-27-2010
My Device: Bold 9000
My Carrier: AT&T

Re: Can a third party app find out about the permissions required by other third party app

[ Edited ]

As far as I know there's no way to directly get it but you could use IPC and ask for the other program's permissions.  Here's how I would do it. 

  1. Have the requesting application post a global event asking for the permissions. 
  2. The other application would listen for that event and when it receives it would put its ApplicationPermissions object into either the RuntimeStore or the PersistentStore.  Then have this application post another global event.
  3. When the original application receives that global event it pulls out the ApplicationPermissions object and does whatever it needs to do.
New Developer
Posts: 20
Registered: ‎08-26-2009
My Device: Not Specified

Re: Can a third party app find out about the permissions required by other third party app

Thanks Adam. It seems plausible from your response. Can you kindly elaborate more from the code writing point of view.
Developer
Posts: 77
Registered: ‎01-27-2010
My Device: Bold 9000
My Carrier: AT&T

Re: Can a third party app find out about the permissions required by other third party app

Okay so we've got a program A and a program B.  Program A is the one asking B for its permissions.

 

Both programs will need a class that implements the GlobalEventListener interface. They should both register this listener with the addGlobalEventListener method in the Application class. 

 

When program A wants B's permissions it calls the method postGlobalEvent in the ApplicationManager class. To call this method it needs a GUID which is just a long. Program B should also have this same GUID.  After calling the postGlobalEvent method program A should call the waitFor method in the RuntimeStore class like this

 

 

ApplicationPermissions appPermissions = RuntimeStore.waitFor(PERMISSIONS_STORE_ID);

 

 

 

Program B is notified of this request when the eventOccurred method (defined in the GlobalEventListener interface) is called.  Program B must check to make sure that the GUID is correct because this method will be called when any global event is posted.

 

Now get the ApplicationPermissions object and put it in the RuntimeStore.  So eventOccurred method in program B will look something like this (this is just an example, I haven't compiled it so there could be errors)

 

eventOccurred(long guid, int data0, int data1, Object object0, Object object1) 
{
   if(guid == EXPECTED_GUID)
   {
      ApplicationPermissionsManager permManager = ApplicationPermissionsManager.getInstance();
      ApplicationPermissions appPermissions = permManager.ApplicationPermissions();
      RuntimeStore.put(PERMISSIONS_STORE_ID, appPermissions);
   }
}

 

Note: that I haven't compiled this code much less tested it so this is just my first attempt, there could very easily be a problem I haven't foreseen.  Also, this explanation is slightly different from my original explanation.  In this post I call the waitFor method in RuntimeStore and wait to get the other program's permissions.  In my first post I was going to post another global event once those permissions have been put in the runtime store.  Either way should work it just depends on how you want to do it.

 

If you've got any more specific questions just post them.

 

 

New Developer
Posts: 20
Registered: ‎08-26-2009
My Device: Not Specified

Re: Can a third party app find out about the permissions required by other third party app

Thanks Adam for your response. It does answer my doubt. HOwever I am keen to know that can a application, which I code find out the permissions used by any third party app installed on BlackBerry device.

 

 

 

Developer
Posts: 77
Registered: ‎01-27-2010
My Device: Bold 9000
My Carrier: AT&T

Re: Can a third party app find out about the permissions required by other third party app

Well in the solution I've provided both apps must know how to communicate.  There is no way that I know of to find out the permissions of a third party application.

Highlighted
New Developer
Posts: 20
Registered: ‎08-26-2009
My Device: Not Specified

Re: Can a third party app find out about the permissions required by other third party app

Thanks Adam. I appreciate your help.