PlugIn Development - Javascript Functions Scope

For developers using the Construct 2 Javascript SDK

Post » Wed Mar 25, 2015 3:20 pm

irina wrote:@vairen
Hi, are you willing to share your latest version?
tnx!



Of course Inina, I have no problem sharing it.

The thing is that I updated C2 to r200 and my plugin stop working!!!

It is driving me crazy, I can not fire conditions with: this.runtime.trigger(cr.plugins_.pushNotifications.prototype.cnds.OnPushMessageReceived, this);

My condition is defined in edittime.js like this:
AddCondition(0, cf_trigger, "On Push Message received", "Events API", "On push notification received", "Triggered when a push notification message is received.", "OnPushMessageReceived");

And in runtime.js like this:
Cnds.prototype.OnPushMessageReceived = function()
{
return true;
};

I do not know if there is something wrong with my code (I haven't change anything), or if there is some compatibility issue with the latest version.

I just put the trigger code line at the top of "instanceProto.onCreate" function and nothing happen. I even commented all the rest of my code.

Maybe @Ashley could help on clarify if there was some change on this.
B
3
Posts: 9
Reputation: 193

Post » Wed Mar 25, 2015 3:44 pm

@vairen

Looking forward for that plugin...
I have one question... how does app handles recieved notifications if its minimised?

thanx!
B
26
S
11
G
2
Posts: 669
Reputation: 5,038

Post » Wed Mar 25, 2015 4:15 pm

irina wrote:@vairen

Looking forward for that plugin...
I have one question... how does app handles recieved notifications if its minimised?

thanx!


I have tested only on Android OS, and is the OS itself that gets the notification from Google AGCM Service.

You need to register with Google in order to be authorized to send AGCM messages, and you need to implement your own server side application that gets tue registration and using the sender ID that google provides you, sneds the message trough google AGCM service.

For that you need to have apache cordova with this plugin installed: https://github.com/phonegap-build/PushPlugin

And then my plugin register an event listener that talks with it. Once the device gets a push notification message, the OS sends it to the app and my plugin captures that and fire a C2 condition. And then you can do whatever you want with it.

I can also provide you with my PHP code, so the only thing you need to do is register with google and put all pieces in place.

I hope I can solve this soon and I will share it with you. I think there is a timing problem. when the plugin initializes. If I wait a few seconds to fire the conditions it works fine.

I hope @Ashley could be able to clarify that.

Cheers
B
3
Posts: 9
Reputation: 193

Post » Tue Jul 28, 2015 4:25 am

Any updates on this?
B
30
S
8
Posts: 62
Reputation: 1,953

Previous

Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 1 guest