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

Web and WebWorks Development

Reply
New Contributor
Posts: 8
Registered: ‎01-02-2013
My Device: blackberry torch
My Carrier: blackberry

Querying for installed apps using blackberry.invoke.query doesnt work

Hi All,

My requirement is to display a page in my app where there will be icons showing all the installed apps.I thought of using the invoke.query framework to query the device for apps doing specific functionality.But my app is for payment of water bill.Not getting what i will query the device with for my app.Is there some other way of acheiving this without using invoke.query.Can we check the device if the folder structure of the app is present or provide some id for the app and checking if that id is present.I am using phonegap project.

Highlighted
Retired
Posts: 245
Registered: ‎09-21-2012
My Device: Q10
My Carrier: Virgin

Re: Querying for installed apps using blackberry.invoke.query doesnt work

I'm not sure I totally understand your question. I'm going to re-phrase it could you then confim I have got it correct?

 

1. You would like to query the device for a list of applications.

2. The invoke.query is not sufficient since it returns the incorrect targets or you can't define the proper target type?

3. You would like to query the device directly?

 

If all you would like to do is invoke an app? Then you can just invoke it directly without using the query. You can see an example by using the "target" attribute here: https://developer.blackberry.com/html5/apis/blackberry.invoke.html#.invoke

 

For instance the browser:

 

// open web link in browser blackberry.invoke.invoke({ target: "sys.browser", uri: "http://www.blackberry.com" }, onInvokeSuccess, onInvokeError);

 

If I have mis-understood please clarify.

@erikjohnzon
erjohnson@blackberry.com
New Contributor
Posts: 8
Registered: ‎01-02-2013
My Device: blackberry torch
My Carrier: blackberry

Re: Querying for installed apps using blackberry.invoke.query doesnt work

Invoking the app from another app is not the issue which i am able to do with the  line of code
ApplicationManager.getApplicationManager().launch("HelloWorld");

 

The big issue which i am facing  is how will i know this particular app HelloWorld is installed on my device.This app HelloWorld  just helps user to pay bills online through creditcard.So even if i use invoke.query what will i query the device with.My app doesnt deal with opening of jpeg file or playing mp3 file etc.It just helps users to pay bills.Dont know what i will give in the type section of invoke.query

 

// open web link in browser blackberry.invoke.invoke({ target: "sys.browser", uri: "http://www.blackberry.com" }, onInvokeSuccess, onInvokeError);

 

If i am right the above piece of code which u mentioned  just opens the mentioned uri in browser and if successfully opened will go to onInvokeSuccess or else goes to onInvokeError function.What i want is something like this

blackberry.invoke.invokable({ uri: "URI for App" }, onInvokableSuccess, onInvokableError); I just want to check whether the app is invokable or not.If app is invokable i will provide icon for app in success function which is clickable.On click of icon will take me to the app using code(ApplicationManager.getApplicationManager().launch("HelloWorld");Is there some other way by which i can acheive this functionality.

 

New Contributor
Posts: 8
Registered: ‎01-02-2013
My Device: blackberry torch
My Carrier: blackberry

Re: Querying for installed apps using blackberry.invoke.query doesnt work

Hello Erik,

 

int[] handle = CodeModuleManager.getModuleHandles();

for(int i=0; i<handle.length; i++)

{

ApplicationDescriptor[] app_descriptors = CodeModuleManager.getApplicationDescriptors(handle[i]); if(app_descriptors != null)

{

for(int j=0; j< app_descriptors.length; j++)

{

String moduleName = app_descriptors[i].getModuleName();

String name = app_descriptors[i].getName(); //here the String variable name will give you all the app names installed on your devise. } } }

 

After some searching around i have come up with some native code to do this..Can you tell me is this the right way to go about.