This is a migrated thread and some comments may be shown as answers.

Delay between "IAnalyticsMonitor.Start()" and actualy connecting to the service

2 Answers 28 Views
Monitor integration
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Guest
Top achievements
Rank 1
Guest asked on 30 Jul 2012, 02:34 PM
Hi Guys, I want to share a problem that I?ve hit. As a first time user it was very easy and pretty straight forward working with your API. In our scenario we are trying to track the initial open of our license wizard. Here are the steps we did: 1. I?ve initialized your monitor like this: System.Net.ServicePointManager.Expect100Continue = false; _monitor = AnalyticsMonitorFactory.CreateMonitor(EQATEC_ID); _monitor.Start(); This is done in the Application.OnStartUp() so it is as early as possible in the app lifecycle. 2. As soon as our license wizard is created we call: If(_monitor.Status.Connectivity == ConnectivityStatus.Connected) _monitor.TrackFeature(string); The problem here is that the framework is still not connected, I guess the Start() is async. So my question is how can overcome this problem or the only way will be to wait for the _monitor.Status.ConnectivityChanged to be invoked and then start posting messages?

2 Answers, 1 is accepted

Sort by
0
Guest
Top achievements
Rank 1
answered on 30 Jul 2012, 02:34 PM
Hi I'm happy that you find our API pretty straight forward, that was one of the original design goals :) Another one of our design goals was that the operations of the library were inherently asynchronous. This is was is causing you problems, as you suspected yourself. All data delivery happens on background threads and calls on the monitor API returns as quickly as possible, rendering control back to the calling code and scheduling transmissions in the background. So, if you need to know if you are "connected" to our servers before performing an operations you basically have two choices: 1) Use some kind of synchronization mechanism and wait for the _monitor.Status.ConnectivityChanged event to fire with the correct status as you suggested 2) Use the _monitor.Lookup(...) method, that accepts a string and callback. The Lookup method attempt to connect to our servers (still async) and lookup a value matched by the string you passed in. Basically a remote dictionary lookup. Once connected, or if the connection failed, the callback will be triggered with the results of the lookup passed back in a LookupResult instance. You can choose method 1 or 2 to your liking. I'll be happy to provide additional guidance if you have a special scenario were it makes sense to know if you are connected to our servers or not. A little info on method 2. We have some customers that actively use this method to lookup values with semantic meaning, e.g. remotely controlling settings for the deployed application. I know of one of our customers that deliver a sampling rate back to their handheld device, allowing them to adjust the measurement quality in their own algorithms (so they basically deploy with a default value and all devices connect to our service and potentially receive an adjusted value to use in their calculations) Hope this helps Best regards Soren EQATEC Team
0
Guest
Top achievements
Rank 1
answered on 30 Jul 2012, 02:34 PM
Hi Nikolay Doing a bit of "issue autumn cleaning" and saw that this issue was not marked as solved. I'll go ahead and mark it as solved for now, but you should feel free to ask as many questions as you may have regarding our service. I'll be happy to help. Best regards Soren EQATEC Team
Tags
Monitor integration
Asked by
Guest
Top achievements
Rank 1
Answers by
Guest
Top achievements
Rank 1
Share this question
or