Search code examples
cordovawindows-phone-8augmented-realityworklight-servermobilefirst-studio

Not getting a callback to native UserControl on cordova app WP8


I am creating a cordova application with a WP8 native page. I am calling the native page in the js file by making the call,

WL.NativePage.show(nativePageClassName, backFromNativePage, params);

The native page is a usercontrol (as mentioned in the documentation) and I have implemented augmented reality in the usercontrol. Code below:

<ARControls:ARDisplay x:Name="ARDisplay">

   <!-- Shows the content from camera-->
   <ARControls:VideoPreview x:Name="VideoPreview"/>
   .
   .
   .
</ARControls:ARDisplay>

The camera opens when this usercontrol is called. But once I do a forward navigation from this usercontrol and then clicks back button, the usercontrol is visible but the camera doesn't get opened and I do not get a callback to this usercontrol on backkeypress. How can this be handled? Any help would be much appreciated.


Solution

  • While this will not answer your direct question, I do think this is the path you should follow.

    WL.NativePage is an API that invokes a class provided by MobileFirst and you are limited in what you can do with it. What you should use instead is the SendAction API, which lets you can your own class giving you full control over what you want to do and how to do it, especially controlling the "Stack", the "native pages" that you navigate between before returning to the WebView.

    You can see an example of SendAction, here: Android: MobileFirst sending data from Native to cross page

    As well as read more about the feature, here: