Closed yhanssens closed 8 years ago
It's working fine for me on iOS but on Android the app crashes on splash screen using the following code:
I'm using version 1.1.0 of the module.
var pushnotifications = require('com.pushwoosh.module'); Ti.API.info("module is => " + pushnotifications); pushnotifications.pushNotificationsRegister({ "pw_appid": Alloy.Globals.appCode, "gcm_projectid": Alloy.Globals.projectNumber, success:function(e) { setTimeout(function() { Ti.API.info('JS registration success event: ' + e.registrationId); }, 0); }, error:function(e) { setTimeout(function() { Ti.API.error("Error during registration: "+e.error); }, 0); }, callback:function(e) // called when a push notification is received { setTimeout(function() { //push notifications title: e.data.title Ti.API.info('JS message event: ' + JSON.stringify(e.data)); }, 0); } });
And the log... [INFO] : Pushwoosh: Log level: NOISE [INFO] : Pushwoosh: [PushManager] App ID: {appid} [INFO] : Pushwoosh: [PushManager] Project ID: {projectid} [INFO] : Pushwoosh: [PushManager] This is android device [WARN] : Pushwoosh: [RequestManager] Try To sent: registerUser [INFO] : dalvikvm: Could not find method com.google.android.gms.iid.InstanceID.getInstance, referenced from method com.pushwoosh.GCMRegistrationService.register [WARN] : dalvikvm: VFY: unable to resolve static method 30105: Lcom/google/android/gms/iid/InstanceID;.getInstance (Landroid/content/Context;)Lcom/google/android/gms/iid/InstanceID; [INFO] : dalvikvm: Could not find method com.google.android.gms.iid.InstanceID.getInstance, referenced from method com.pushwoosh.GCMRegistrationService.unregister [WARN] : dalvikvm: VFY: unable to resolve static method 30105: Lcom/google/android/gms/iid/InstanceID;.getInstance (Landroid/content/Context;)Lcom/google/android/gms/iid/InstanceID; [WARN] : dalvikvm: threadid=19: thread exiting with uncaught exception (group=0x41a98700) [ERROR] : TiApplication: (IntentService[com.pushwoosh.GCMRegistrationService]) [6,2114] Sending event: exception on thread: IntentService[com.pushwoosh.GCMRegistrationService] msg:java.lang.NoClassDefFoundError: com.google.android.gms.iid.InstanceID; Titanium 5.0.2,2015/09/30 12:07,92c2265 [ERROR] : TiApplication: java.lang.NoClassDefFoundError: com.google.android.gms.iid.InstanceID [ERROR] : TiApplication: at com.pushwoosh.GCMRegistrationService.register(Unknown Source) [ERROR] : TiApplication: at com.pushwoosh.GCMRegistrationService.onHandleIntent(Unknown Source) [ERROR] : TiApplication: at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) [ERROR] : TiApplication: at android.os.Handler.dispatchMessage(Handler.java:99) [ERROR] : TiApplication: at android.os.Looper.loop(Looper.java:176) [ERROR] : TiApplication: at android.os.HandlerThread.run(HandlerThread.java:61) [WARN] : Pushwoosh: [RequestManager] Pushwoosh Request: {"request":{"hwid":"{hwid}","v":"3.0.1.529","application":"{appid}","userId":"{userid}"}} [WARN] : Pushwoosh: [RequestManager] Pushwoosh Request To: https://cp.pushwoosh.com/json/1.3/registerUser [ERROR] : Pushwoosh: [RequestManager] ERROR: Unable to resolve host "cp.pushwoosh.com": No address associated with hostname. Response = null [INFO] : prompt triggered [WARN] : Pushwoosh: [RequestManager] Try To sent: applicationOpen [WARN] : Pushwoosh: [RequestManager] Pushwoosh Request: {"request":{"hwid":"{hwid}","v":"3.0.1.529","application":"{appid}","userId":"{userid}"}} [WARN] : Pushwoosh: [RequestManager] Pushwoosh Request To: https://cp.pushwoosh.com/json/1.3/applicationOpen [ERROR] : Pushwoosh: [RequestManager] ERROR: Unable to resolve host "cp.pushwoosh.com": No address associated with hostname. Response = null [WARN] : Pushwoosh: [RequestManager] Try To sent: registerUser [WARN] : Pushwoosh: [RequestManager] Pushwoosh Request: {"request":{"hwid":"{hwid}","v":"3.0.1.529","application":"{appid}","userId":"{userid}"}} [WARN] : Pushwoosh: [RequestManager] Pushwoosh Request To: https://cp.pushwoosh.com/json/1.3/registerUser [ERROR] : Pushwoosh: [RequestManager] ERROR: Unable to resolve host "cp.pushwoosh.com": No address associated with hostname. Response = null [WARN] : Pushwoosh: [RequestManager] Try To sent: registerUser [WARN] : Pushwoosh: [RequestManager] Pushwoosh Request: {"request":{"hwid":"{hwid}","v":"3.0.1.529","application":"{appid}","userId":"{userid}"}} [WARN] : Pushwoosh: [RequestManager] Pushwoosh Request To: https://cp.pushwoosh.com/json/1.3/registerUser [WARN] : Pushwoosh: [RequestManager] Pushwoosh Result: {"status_code": 200, "status_message": "OK","response":null} [WARN] : Pushwoosh: [RequestManager] registerUser response success [ERROR] : TiUIDialog: (main) [218,10602] Unable to find an activity for dialog. [ERROR] : TiUIDialog: (main) [1,10603] Unable to find an activity for dialog. [WARN] : dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41a98700) [ERROR] : TiApplication: (main) [1,10604] Sending event: exception on thread: main msg:java.lang.NullPointerException; Titanium 5.0.2,2015/09/30 12:07,92c2265 [ERROR] : TiApplication: java.lang.NullPointerException [ERROR] : TiApplication: at ti.modules.titanium.ui.widget.TiUIDialog.processProperties(TiUIDialog.java:80) [ERROR] : TiApplication: at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:1209) [ERROR] : TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:502) [ERROR] : TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:493) [ERROR] : TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:471) [ERROR] : TiApplication: at ti.modules.titanium.ui.AlertDialogProxy$1.run(AlertDialogProxy.java:72) [ERROR] : TiApplication: at android.os.Handler.handleCallback(Handler.java:730) [ERROR] : TiApplication: at android.os.Handler.dispatchMessage(Handler.java:92) [ERROR] : TiApplication: at android.os.Looper.loop(Looper.java:176) [ERROR] : TiApplication: at android.app.ActivityThread.main(ActivityThread.java:5419) [ERROR] : TiApplication: at java.lang.reflect.Method.invokeNative(Native Method) [ERROR] : TiApplication: at java.lang.reflect.Method.invoke(Method.java:525) [ERROR] : TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046) [ERROR] : TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862) [ERROR] : TiApplication: at dalvik.system.NativeStart.main(Native Method) [INFO] : Process: Sending signal. PID: 30734 SIG: 9
Am I doing something wrong here?
Never mind this issue, I fixed my problem. There seem to be a conflicting jar file that was already included in another module I use. Removing the specific jar file from one of the conflicting modules fixed it.
It's working fine for me on iOS but on Android the app crashes on splash screen using the following code:
I'm using version 1.1.0 of the module.
And the log... [INFO] : Pushwoosh: Log level: NOISE [INFO] : Pushwoosh: [PushManager] App ID: {appid} [INFO] : Pushwoosh: [PushManager] Project ID: {projectid} [INFO] : Pushwoosh: [PushManager] This is android device [WARN] : Pushwoosh: [RequestManager] Try To sent: registerUser [INFO] : dalvikvm: Could not find method com.google.android.gms.iid.InstanceID.getInstance, referenced from method com.pushwoosh.GCMRegistrationService.register [WARN] : dalvikvm: VFY: unable to resolve static method 30105: Lcom/google/android/gms/iid/InstanceID;.getInstance (Landroid/content/Context;)Lcom/google/android/gms/iid/InstanceID; [INFO] : dalvikvm: Could not find method com.google.android.gms.iid.InstanceID.getInstance, referenced from method com.pushwoosh.GCMRegistrationService.unregister [WARN] : dalvikvm: VFY: unable to resolve static method 30105: Lcom/google/android/gms/iid/InstanceID;.getInstance (Landroid/content/Context;)Lcom/google/android/gms/iid/InstanceID; [WARN] : dalvikvm: threadid=19: thread exiting with uncaught exception (group=0x41a98700) [ERROR] : TiApplication: (IntentService[com.pushwoosh.GCMRegistrationService]) [6,2114] Sending event: exception on thread: IntentService[com.pushwoosh.GCMRegistrationService] msg:java.lang.NoClassDefFoundError: com.google.android.gms.iid.InstanceID; Titanium 5.0.2,2015/09/30 12:07,92c2265 [ERROR] : TiApplication: java.lang.NoClassDefFoundError: com.google.android.gms.iid.InstanceID [ERROR] : TiApplication: at com.pushwoosh.GCMRegistrationService.register(Unknown Source) [ERROR] : TiApplication: at com.pushwoosh.GCMRegistrationService.onHandleIntent(Unknown Source) [ERROR] : TiApplication: at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) [ERROR] : TiApplication: at android.os.Handler.dispatchMessage(Handler.java:99) [ERROR] : TiApplication: at android.os.Looper.loop(Looper.java:176) [ERROR] : TiApplication: at android.os.HandlerThread.run(HandlerThread.java:61) [WARN] : Pushwoosh: [RequestManager] Pushwoosh Request: {"request":{"hwid":"{hwid}","v":"3.0.1.529","application":"{appid}","userId":"{userid}"}} [WARN] : Pushwoosh: [RequestManager] Pushwoosh Request To: https://cp.pushwoosh.com/json/1.3/registerUser [ERROR] : Pushwoosh: [RequestManager] ERROR: Unable to resolve host "cp.pushwoosh.com": No address associated with hostname. Response = null [INFO] : prompt triggered [WARN] : Pushwoosh: [RequestManager] Try To sent: applicationOpen [WARN] : Pushwoosh: [RequestManager] Pushwoosh Request: {"request":{"hwid":"{hwid}","v":"3.0.1.529","application":"{appid}","userId":"{userid}"}} [WARN] : Pushwoosh: [RequestManager] Pushwoosh Request To: https://cp.pushwoosh.com/json/1.3/applicationOpen [ERROR] : Pushwoosh: [RequestManager] ERROR: Unable to resolve host "cp.pushwoosh.com": No address associated with hostname. Response = null [WARN] : Pushwoosh: [RequestManager] Try To sent: registerUser [WARN] : Pushwoosh: [RequestManager] Pushwoosh Request: {"request":{"hwid":"{hwid}","v":"3.0.1.529","application":"{appid}","userId":"{userid}"}} [WARN] : Pushwoosh: [RequestManager] Pushwoosh Request To: https://cp.pushwoosh.com/json/1.3/registerUser [ERROR] : Pushwoosh: [RequestManager] ERROR: Unable to resolve host "cp.pushwoosh.com": No address associated with hostname. Response = null [WARN] : Pushwoosh: [RequestManager] Try To sent: registerUser [WARN] : Pushwoosh: [RequestManager] Pushwoosh Request: {"request":{"hwid":"{hwid}","v":"3.0.1.529","application":"{appid}","userId":"{userid}"}} [WARN] : Pushwoosh: [RequestManager] Pushwoosh Request To: https://cp.pushwoosh.com/json/1.3/registerUser [WARN] : Pushwoosh: [RequestManager] Pushwoosh Result: {"status_code": 200, "status_message": "OK","response":null} [WARN] : Pushwoosh: [RequestManager] registerUser response success [ERROR] : TiUIDialog: (main) [218,10602] Unable to find an activity for dialog. [ERROR] : TiUIDialog: (main) [1,10603] Unable to find an activity for dialog. [WARN] : dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41a98700) [ERROR] : TiApplication: (main) [1,10604] Sending event: exception on thread: main msg:java.lang.NullPointerException; Titanium 5.0.2,2015/09/30 12:07,92c2265 [ERROR] : TiApplication: java.lang.NullPointerException [ERROR] : TiApplication: at ti.modules.titanium.ui.widget.TiUIDialog.processProperties(TiUIDialog.java:80) [ERROR] : TiApplication: at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:1209) [ERROR] : TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:502) [ERROR] : TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:493) [ERROR] : TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:471) [ERROR] : TiApplication: at ti.modules.titanium.ui.AlertDialogProxy$1.run(AlertDialogProxy.java:72) [ERROR] : TiApplication: at android.os.Handler.handleCallback(Handler.java:730) [ERROR] : TiApplication: at android.os.Handler.dispatchMessage(Handler.java:92) [ERROR] : TiApplication: at android.os.Looper.loop(Looper.java:176) [ERROR] : TiApplication: at android.app.ActivityThread.main(ActivityThread.java:5419) [ERROR] : TiApplication: at java.lang.reflect.Method.invokeNative(Native Method) [ERROR] : TiApplication: at java.lang.reflect.Method.invoke(Method.java:525) [ERROR] : TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046) [ERROR] : TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862) [ERROR] : TiApplication: at dalvik.system.NativeStart.main(Native Method) [INFO] : Process: Sending signal. PID: 30734 SIG: 9
Am I doing something wrong here?