I’m using Trigger.io for an iOS / Android app and trying to get a list of all the emails in the phonebook.
I call
forge.contact.selectAll(selectAllSuccessCb, selectAllErrorCb);
And then iterating on each of the contacts returned to get the full contact details, and extract the email addresses:
forge.contact.selectById(contactRef.id, function (contact) {
// do stuff with contact email address(es) here
}
There are ~1400 contacts (should be identical – both signed into same Google account) on the two devices I’m testing on. Samsung Galaxy S Android 2.3.6 works fine.
Samsung Galaxy Nexus Android 4.1 fails on 8 of the contacts with the following error:
[WARNING] Error while executing API method: contact.selectById
[DEBUG] Returning: {"content":{"type":"UNEXPECTED_FAILURE","message":
"Forge Java error: NumberFormatException: Invalid int: \"null\"",
"full_error":"java.lang.NumberFormatException: Invalid int: \"null\"\n\tat
java.lang.Integer.invalidInt(Integer.java:138)\n\tat java.lang.Integer.parseInt(Integer.java:355)\n\tat
java.lang.Integer.parseInt(Integer.java:332)\n\tat
io.trigger.forge.android.modules.contact.Util.contactToJSON(Util.java:340)\n\tat
io.trigger.forge.android.modules.contact.API.contactIdToJSONObject(API.java:70)\n\tat
io.trigger.forge.android.modules.contact.API.selectById(API.java:80)\n\tat
java.lang.reflect.Method.invokeNative(Native Method)\n\tat java.lang.reflect.Method.invoke(Method.java:511)\n\tat
io.trigger.forge.android.core.ForgeApp.callJavaFromJavaScript(ForgeApp.java:194)\n\tat
io.trigger.forge.android.core.ForgeJSBridge.callJavaFromJavaScript(ForgeJSBridge.java:8)\n\tat
android.webkit.BrowserFrame.stringByEvaluatingJavaScriptFromString(Native Method)\n\tat
android.webkit.BrowserFrame.stringByEvaluatingJavaScriptFromString(Native Method)\n\tat
android.webkit.BrowserFrame.loadUrl(BrowserFrame.java:271)\n\tat
android.webkit.WebViewCore.loadUrl(WebViewCore.java:2029)\n\tat
android.webkit.WebViewCore.access$1900(WebViewCore.java:57)\n\tat
android.webkit.WebViewCore$EventHub$1.handleMessage(WebViewCore.java:1321)
android.os.Handler.dispatchMessage(Handler.java:99)\n\tat android.os.Looper.loop(Looper.java:137)
android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:827)
java.lang.Thread.run(Thread.java:856)\n"},"status":"error","callid":"B40384E4-62A1-4460-866D-924855F3930F"}
What is the problem here, and how can I fix this issue? Thanks
This was caused by email or phone entries in your contacts database which had a null type… not quite sure how that happened! But it’s fixed in v1.4.25 of the platform.
http://docs.trigger.io/en/v1.4/release-notes.html#v1-4-25