You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following exception is thrown when starting the foreground service:
java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Integer
at android.os.BaseBundle.getInt(BaseBundle.java:1041)
at android.os.BaseBundle.getInt(BaseBundle.java:1023)
at com.voximplant.foregroundservice.NotificationHelper.buildNotification(NotificationHelper.java:99)
at com.voximplant.foregroundservice.VIForegroundService.onStartCommand(VIForegroundService.java:31)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4087)
at android.app.ActivityThread.access$1800(ActivityThread.java:219)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1891)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
At line 99 of NotificationHelper.java:
int priorityInt = notificationConfig.containsKey("priority") ? notificationConfig.getInt("priority"): Notification.PRIORITY_HIGH;
The exception is thrown because there must be explicit cast to int when downcasting from double.
The proposed fix is to replace line 99 with the following:
int priorityInt = notificationConfig.containsKey("priority") ? (int)notificationConfig.getDouble("priority"): Notification.PRIORITY_HIGH;
I am submitting a PR with the above proposed fix.
Thank you,
The text was updated successfully, but these errors were encountered:
gmccobb
added a commit
to gmccobb/foreground-service-library-test
that referenced
this issue
Jan 14, 2020
…ava.lang.Double cannot be cast to java.lang.Integer
This is the proposed fix for issue voximplant#20, java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Integer. Line #99 of NotificationHelper.java is replaced by: int priorityInt = notificationConfig.containsKey("priority") ? (int)notificationConfig.getDouble("priority"): Notification.PRIORITY_HIGH;
The following exception is thrown when starting the foreground service:
java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Integer
at android.os.BaseBundle.getInt(BaseBundle.java:1041)
at android.os.BaseBundle.getInt(BaseBundle.java:1023)
at com.voximplant.foregroundservice.NotificationHelper.buildNotification(NotificationHelper.java:99)
at com.voximplant.foregroundservice.VIForegroundService.onStartCommand(VIForegroundService.java:31)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4087)
at android.app.ActivityThread.access$1800(ActivityThread.java:219)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1891)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
At line 99 of NotificationHelper.java:
int priorityInt = notificationConfig.containsKey("priority") ? notificationConfig.getInt("priority"): Notification.PRIORITY_HIGH;
The exception is thrown because there must be explicit cast to int when downcasting from double.
The proposed fix is to replace line 99 with the following:
int priorityInt = notificationConfig.containsKey("priority") ? (int)notificationConfig.getDouble("priority"): Notification.PRIORITY_HIGH;
I am submitting a PR with the above proposed fix.
Thank you,
The text was updated successfully, but these errors were encountered: