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
CInnovat
Posts: 6
Registered: ‎07-16-2012
My Device: Torch 9860
My Carrier: Telus

Is it possible to make a call from custom java extension to JavaScript code?

Hi,

 

Is it possible to make a call from custom java extension to JavaScript code?

 

For example: I have some listener in a java extension code and want to call some method in a JavaScript code from this listener.

 

Thank you.

Please use plain text.
BlackBerry Development Advisor
twindsor
Posts: 792
Registered: ‎07-15-2008
My Device: Z10
My Carrier: Bell

Re: Is it possible to make a call from custom java extension to JavaScript code?

Take a look at the extension template in our github repository for an example of this: 

https://github.com/blackberry/WebWorks-Community-APIs/tree/master/Smartphone/TEMPLATE

Tim Windsor
Application Development Advisor II
Please use plain text.
Trusted Contributor
NitishSubudhi
Posts: 166
Registered: ‎12-09-2011
My Device: 9550,9300,9800,9700,9900,9850,9860

Re: Is it possible to make a call from custom java extension to JavaScript code?

There is direct code for Make Call for Webworks SmartPhone.

 

var args = new blackberry.invoke.PhoneArguments(PhoneNumber, true);
	args.view = blackberry.invoke.PhoneArguments.VIEW_CALL;
	blackberry.invoke.invoke(blackberry.invoke.APP_PHONE, args);

 I think this code will Help You...

Thanks & Regards,
Nitish Subudhi

Feel Free To Press The Like Button On The Right Side To Thank The User That Helped You.
Please Mark Posts As Solved If You Found a Solution.
Please use plain text.
New Contributor
CInnovat
Posts: 6
Registered: ‎07-16-2012
My Device: Torch 9860
My Carrier: Telus

Re: Is it possible to make a call from custom java extension to JavaScript code?

Not exactly.

 

Your example will start native app...

 

I want to call javascript function located in my javascript file from java code exention. Like you have a way to call native code from javascript using extentions right? I need backward call: from extention call javascript.

 

But thank you.

Please use plain text.
BlackBerry Development Advisor
twindsor
Posts: 792
Registered: ‎07-15-2008
My Device: Z10
My Carrier: Bell

Re: Is it possible to make a call from custom java extension to JavaScript code?

Check out the CallBack function in the Template. This use case is covered by the sample code. Really all you need to do is follow the instructions and input your own code.

Tim Windsor
Application Development Advisor II
Please use plain text.
Trusted Contributor
NitishSubudhi
Posts: 166
Registered: ‎12-09-2011
My Device: 9550,9300,9800,9700,9900,9850,9860

Re: Is it possible to make a call from custom java extension to JavaScript code?

Hi Clnnovat,
I also want such code in which I can perform backward call,
but I didn't find such code to implement in APS.
If you find such code Please Post here so that it can help full to others. 

Thanks & Regards,
Nitish Subudhi

Feel Free To Press The Like Button On The Right Side To Thank The User That Helped You.
Please Mark Posts As Solved If You Found a Solution.
Please use plain text.