How do I call c2_callFunction from android?

Get help using Construct 2

Post » Sat Sep 02, 2017 6:41 am

Using function plugin I created a function jstest() in constuct 2. Now I want to call this function from android code(the game is embedded in android webView). I tried various combinations as follows but nothing worked.

webView.evaluateJavascript("c2_callFunction(\"jstest\", []);", null);
webView.evaluateJavascript("c2_callFunction(\"jstest\", [])", null);

webView.evaluateJavascript("c2_callFunction('jstest', []);", null);
webView.evaluateJavascript("c2_callFunction('jstest', [])", null);

It seems more of java question rather than C2 but still can any one help me?
B
3
Posts: 4
Reputation: 183

Post » Sat Sep 02, 2017 10:18 am

Make sure you wait for the runtime to finish loading. That function won't exist on startup.
Scirra Founder
B
398
S
236
G
88
Posts: 24,439
Reputation: 194,647

Post » Sat Sep 02, 2017 10:40 am

yup....I'm calling that function much later.
B
3
Posts: 4
Reputation: 183


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, Jackriduk and 19 guests