Anyone played with AppMobi API's??

Discussion and feedback on Construct 2

Post » Wed Feb 08, 2012 9:11 pm

Hi guys, Has anyone managed to have a play with AppMobi API's using the call javascript plugin maybe?

I would quite like to implement them into my app but im not sure how
B
29
S
12
G
7
Posts: 740
Reputation: 7,849

Post » Wed Feb 08, 2012 11:33 pm

I played quite a lot with it, where's the problem?
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Thu Feb 09, 2012 7:20 am

@ranma, I just would like to know how you called them, using the calljs plugin?
B
29
S
12
G
7
Posts: 740
Reputation: 7,849

Post » Thu Feb 09, 2012 11:06 am

yes. and if I must, I read the execution return. if you just want to do a simple vibrate and don't need to read the sent back var, you don't have to use the call javascript, you can use browser plugin to go to url "javascript:AppMobi.notification.vibrate();"
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Thu Feb 09, 2012 11:18 am

@ranma, Thanks for the information! I will definitely use this now! .

If you wouldn't mind the bother a few more questions..

Have you tried any of the other API's that you could enlighten me with?

I understand programming languages, I'm just not the best with JavaScript. Even though its very similar to ActionScript, my Favorite programming language.

The CallJS plugin needs to call the function name,
So for example if I wanted to use this api:

document.addEventListener("appMobi.notification.push.enable",notificationsRegistered,false);
AppMobi.notification.addPushUser("userID","newpassword","newEmail@test.com");
var notificationsRegistered=function(event)
{
if(event.success===false)
    {
        if( !didcheckuser )
        {
            AppMobi.notification.checkPushUser(userID,"newpassword");
            didcheckuser = true;
        }
        else
        {
               alert("There was an error adding push notifications "+ event.message);
        }
        return;
    }
        alert("Notifications Enabled");
}

There is no function name for me to call is there?

thanks.

B
29
S
12
G
7
Posts: 740
Reputation: 7,849

Post » Thu Feb 09, 2012 12:35 pm

you have to have a variable that you read every few second from construct canvas:

[code]var foo;

document.addEventListener("appMobi.notification.push.enable",notificationsRegistered,false);

AppMobi.notification.addPushUser("userID","newpassword","newEmail@test.com");

var notificationsRegistered=function(event)
{
if(event.success===false)
    {
        if( !didcheckuser )
        {
            AppMobi.notification.checkPushUser(userID,"newpassword");
            didcheckuser = true;
        }
        else
        {
               foo = "There was an error adding push notifications "+ event.message;
        }
        return;
    }
        foo = "Notifications Enabled";
}
function returnFoo() {
return foo;
}
[/code]

and then in construct:
every 1 second call javascript "returnFoo();"
and set some text to javascript return value.
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Thu Feb 09, 2012 1:03 pm

Thanks! I get it now
B
29
S
12
G
7
Posts: 740
Reputation: 7,849

Post » Thu Feb 09, 2012 1:26 pm

no problem. cheers!
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Thu Feb 09, 2012 3:21 pm

We're hoping to add better integration in the near future so ideally CallJS will just be a temporary measure!
Scirra Founder
B
359
S
214
G
72
Posts: 22,951
Reputation: 178,578

Post » Thu Feb 09, 2012 3:26 pm

@Ashley, Thanks!

Do you think the timeframe is worth me putting my project on hold? I have a app that will really show the power of C2 on mobile devices!

The app is a image editor kinda thing, You can then save the image locally, and/or upload it to the shared gallery. Which you can view other people's work. I hope to be able to save it to the camera roll, which is possible with app mobi but I cannot figure out how to use there API to save it with the call js plugin.

This app feels very nice to use, Thanks to @Septeven for his iScroll plugin, and your native tokenat() expression!
B
29
S
12
G
7
Posts: 740
Reputation: 7,849

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 11 guests