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

Native Development

Reply
New Developer
Posts: 13
Registered: ‎12-17-2012
My Device: Simulator
My Carrier: Telenor
Accepted Solution

Trigger native code from WebView - Invocation?

Hi,

 

I have a WebView inside my app and want to trigger native code on certain events in the WebView. In iOS or Android i would do a call to a URI (myapp://dothisfunction) and i have that URI regged to the app. But is that possible in BB 10? What is the alternative?

 

/Johan

Developer
Posts: 1,280
Registered: ‎03-03-2011
My Device: Playbook, Z10, Q10, Z30 with Files & Folders and Orbit of course
My Carrier: Vodafone

Re: Trigger native code from WebView - Invocation?

Just handle NavigationRequested in Cascades. Or call the native side from JS using navigator.cascades.postMessage() and handle it in messageReceived. No need for custom URL's or the Invoke framework.

Files & Folders, the unified file & cloud manager for PlayBook and BB10 with SkyDrive, SugarSync, Box, Dropbox, Google Drive, Google Docs. Free 3-day trial! - Jon Webb - Innovatology - Utrecht, Netherlands