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
9
Posts: 17
Reputation: 359

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
414
S
245
G
92
Posts: 25,198
Reputation: 200,327

Post » Sat Sep 02, 2017 10:40 am

yup....I'm calling that function much later.
B
9
Posts: 17
Reputation: 359


Return to How do I....?

Who is online

Users browsing this forum: Taz and 4 guests