BranchMetrics / phonegap-plugin

PhoneGap/Cordova plugin for Tune
https://developers.tune.com/sdk/phonegap-quick-start/
MIT License
8 stars 16 forks source link

Tracker was null #1

Closed ripcurlx closed 10 years ago

ripcurlx commented 10 years ago

Hi all, I tried to integrate version 3.3.3 within our application, but somehow the async calls don't work. It looks like as if the tracker property is not available in the MeasureActionThread, although it was set in the InitThread on startup. Is this a known problem? The synchronous calls work without any problems. Also the async tracking of the session seems to work, only MEASUREACTION calls don't work.

Thanks for any hints!

ripcurlx commented 10 years ago

I've already created a pull request for this problem, but missed to connect it to this issue

john-gu commented 10 years ago

Hi Christopher,

Thanks for the pull req, I will make that update. That will probably not solve the issue you're having with the async calls, though.

Since you can't guarantee when the init finishes, what you'll probably want to do is call your measureAction in the success callback of initTracker or measureSession, or check for a flag you set on initTracker success. This way you can be sure that tracker was initialized.

ripcurlx commented 10 years ago

It solved my problem, as I mistakenly thought the tracking call was not sent, but it was just the error log I saw in the adb console that made me think that something might have gone wrong.