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
8
Posts: 15
Reputation: 330

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
405
S
239
G
91
Posts: 24,760
Reputation: 197,314

Post » Sat Sep 02, 2017 10:40 am

yup....I'm calling that function much later.
B
8
Posts: 15
Reputation: 330


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 44 guests