Description
When sending a feature event on Android, if a key in the data object is a number an error will be thrown. The code works find on iOS and Windows
[WARN] W/System.err: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
[WARN] W/System.err: at org.appcelerator.titanium.util.TiConvert.toJSON(TiConvert.java:723)
[WARN] W/System.err: at ti.modules.titanium.analytics.AnalyticsModule.featureEvent(AnalyticsModule.java:98)
[WARN] W/System.err: at org.appcelerator.kroll.runtime.v8.V8Function.nativeInvoke(Native Method)
[WARN] W/System.err: at org.appcelerator.kroll.runtime.v8.V8Function.callSync(V8Function.java:57)
[WARN] W/System.err: at org.appcelerator.kroll.runtime.v8.V8Function.call(V8Function.java:43)
[WARN] W/System.err: at ti.modules.titanium.TitaniumModule$Timer.run(TitaniumModule.java:147)
[WARN] W/System.err: at android.os.Handler.handleCallback(Handler.java:739)
[WARN] W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
[WARN] W/System.err: at android.os.Looper.loop(Looper.java:145)
[WARN] W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5938)
[WARN] W/System.err: at java.lang.reflect.Method.invoke(Native Method)
[WARN] W/System.err: at java.lang.reflect.Method.invoke(Method.java:372)
[WARN] W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
[WARN] W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
var data = {'1':'d'}
var result = Ti.Analytics.featureEvent('levels', data);
Steps to reproduce
Add the above code to an existing app.js
Build for android
Actual result
An error will be thrown
Expected result
No error should be thrown
master: https://github.com/appcelerator/titanium_mobile/pull/8459 6_0_X: https://github.com/appcelerator/titanium_mobile/pull/8460
Verified the fix. Feature event with a number as a data object key is sent successfully. Closing. Environment: Appc Studio : 4.8.0.201610060953 Ti SDK : 6.0.0.v20161013072802, 6.1.0.v20161012092744 Ti CLI : 5.0.10 Alloy : 1.9.2 MAC El Capitan : 10.11.6 Appc NPM : 4.2.8-7 Appc CLI : 6.0.0-57 Node: 4.6.0 Nexus 6 - Android 6.0.1