Appcelerator and Urban Airship -
i trying out urban airship appcelerator having problems using it. code in app.js:
will "activated" when user opens app , register automatically urban airship?
urbanairship = require('ti.urbanairship'); ti.api.info("module => "+urbanairship); ti.include('common/urbanairship.js'); urbanairship.key='xxx'; urbanairship.secret ='xxx'; urbanairship.master_secret='xxx'; urbanairship.baseurl = 'https://go.urbanairship.com'; ti.network.registerforpushnotifications({ types: [ ti.network.notification_type_badge, ti.network.notification_type_alert, ti.network.notification_type_sound ], success:function(e){ var devicetoken = e.devicetoken; ti.api.info('successfully registered apple device token '+e.devicetoken); var params = { tags: ['version'+ti.app.getversion()], alias: 'testing' }; urbanairship.register(params, function(data) { ti.api.debug("registerurban success: " + json.stringify(data)); }, function(errorregistration) { ti.api.warn("couldn't register urban airship"); }); }, error:function(e) { ti.api.warn("push notifications disabled: "+e); }, callback:function(e) { var = ti.ui.createalertdialog({ title:'new message', message:e.data.alert }); a.show(); } });
the modules hit or miss me.
very have worked without lot of troubleshooting.
i've gone old-school route , has worked fine me - although did change urbanairship.js
add eventlisteners on windowfocus register/alias fields in final app.
but testing leave is. hope helps - http://wiki.appcelerator.org/display/guides/push+notifications
Comments
Post a Comment