Integrate your Windows 8 C# app with Localytics.
-
In your Localytics
Dashboard, create a new
application and copy the application key.
-
Download the Windows 8
C# client class, which is distributed as source code.
-
Add the class to your project.
-
Add the Localytics object to
the Application class in App.xaml.cs.
public LocalyticsSession appSession;
-
In both Application_Launching and
Application_Activated, create a new instance of Localytics. Then, open and
upload it.
Once a session is opened, subsequent calls to open are ignored, so this won't
result in multiple
sessions.
appSession = new LocalyticsSession("app key");
appSession.Open();
appSession.Upload();
-
In both Application_Closing and
Application_Deactivated, close the application.
You can’t upload here.
appSession.Close();
-
If needed, access the session object from other pages.
((App)Application.Current).appSession.tagEvent("Event Name");
Congratulations! You're integrated. Check out the data in your
Dashboard or get even more insights
when you start
tagging
events. Don't forget to test your app. Run it in an emulator, or on a real
device if possible.