I am currently developing an app for iOS and Android. It incorporates push notifications using the ti.cloud and ti.cloudpush modules. Currently, the iOS version allows users to subscribe to the channel without any issues, but whenever the user tries to subscribe to the notifications with an Android phone the app crashes.
This is the error report:
[ERROR] : KrollProxy: (KrollRuntimeThread) [31795,71270] Error creating proxy [ERROR] : KrollProxy: java.lang.IllegalArgumentException: Invalid argument passed to securityManager property. Does not conform to SecurityManagerProtocol [ERROR] : KrollProxy: at ti.modules.titanium.network.HTTPClientProxy.handleCreationDict(HTTPClientProxy.java:63) [ERROR] : KrollProxy: at org.appcelerator.kroll.KrollProxy.handleCreationArgs(KrollProxy.java:227) [ERROR] : KrollProxy: at org.appcelerator.kroll.KrollProxy.setupProxy(KrollProxy.java:135) [ERROR] : KrollProxy: at org.appcelerator.kroll.KrollProxy.createProxy(KrollProxy.java:143) [ERROR] : KrollProxy: at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method) [ERROR] : KrollProxy: at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62) [ERROR] : KrollProxy: at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:908) [ERROR] : KrollProxy: at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1131) [ERROR] : KrollProxy: at android.os.Handler.dispatchMessage(Handler.java:95) [ERROR] : KrollProxy: at android.os.Looper.loop(Looper.java:155) [ERROR] : KrollProxy: at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112)
Here is the relevant code:
Alloy.Globals.subscribeToChannel = function(channel, callbackSuccess, callbackFailure){
var localRetryCount = 0;
function localSubscribe()
{
// Specify the push type as either 'android' for Android or 'ios' for iOS
Cloud.PushNotifications.subscribeToken({
device_token: Ti.App.Properties.getString('deviceToken'),
channel: channel,
type: Alloy.Globals.isAndroid ? 'android' : 'ios'
}, function (e) {
if (e.success) {
Ti.API.info('Subscribed to channel ['+ channel + ']');
if(callbackSuccess) {
callbackSuccess();
}
}
else {
Ti.API.error("Error " + e.message);
if (e.code == 503 && localRetryCount < 5){
Ti.API.error("503 Error. Retrying.");
localRetryCount++;
localSubscribe();
}
else {
Ti.API.error("Push Notification Subscription Error (" + e.code + ") " + e.message);
alert("Push Notification Subscription Error (" + e.code + ") " + e.message);
if(callbackFailure) {
callbackFailure();
}
}
}
});
}
localSubscribe();
};