I had a javascript interface working on Android, but not what I've moved the code to forms it doesn't appear to be working.
I set it up the same way as I did in Android in my android version of the Custom Render for the WebView:
nativeWebView.Settings.JavaScriptEnabled = true;
var javaScriptInterface = new JavaScriptInterface(Context);
nativeWebView.AddJavascriptInterface(javaScriptInterface, "androidInterface");
and my webpage contains the same javascript code that worked in the Android version:
<script type="text/javascript">
$('div[data-role="page"]').bind('pagecreate', function () {
androidInterface.TimedOut("@Model.URL");
});
</script>
and the interface class is exactly the same as the android version, and lives in the android specific section of the forms project:
namespace JMAS.Droid.Interfaces
{
public class JavaScriptInterface : Java.Lang.Object
{
private readonly Context _context;
public JavaScriptInterface(Context context)
{
_context = context;
}
[Export]
public void TimedOut(string redirectUrl)
{
JMAS.Interfaces.JavaScriptInterface.OnTimeOut();
}
When I test a break point in the TimedOut function is never hit. Am I missing something, or is this a bug?