Xamarin.Insights
Reads an image from disk in a portable way - will not decompress compressed images
Reads an image from disk in a portable way - also will decompress images that require decompression
One big state machine for network availability, with allowances for overrides.
It is expected to have its NetworkState set by platform specific codebases signalling changes in their network state.
Basically every platform has a different idea of network states and trying to represent the specifics of each one is a pita.
so lets just be fuzzy and use abstract concepts, trying to match the platform specific concepts to them as best we can
Submits an exception to our api server, this runs through the crash api
Submits an exception to our api server, this runs through the crash api,
in addition this will save the current state of the journal to disk
this entire method will block. It is intended to be used when in an unhandled event handler
Sends a ping request to the web api, we expect an X-Pong header back, if we don't get taht or the request fails assume no communication with the web api will work
Obsolete, use Xamarin.Insights.ReportSeverity instead
A Warning
An Error
Xamarin.Insights
This method initializes Insights and starts automatic monitoring systems, it is required to be called before any other API
The APIKey given to you by Insights, which can be found here: https://insights.xamarin.com/app/$YourAppNameGoesHere$/settings
A delegate for the HasPendingCrashReportEventHandler event, you are expected to call Insights.PurgePendingCrashReports() in this method
if you wish for Insights to synchronously send a crash report on startup, otherwise ignore this and insights will send the crash report
in the background.
This event is fired when Insights detects a new pending crash report
Passing this key into will enable a silent debug mode in Insights.
Insights will not track, catch exceptions or submit information of any kind.
This is useful if you are trying to debug your application and want Insights to get out of the way.
This paramater will return true if Initialize has been successfully called
This paramater allows you to disable certain collection types, they will not be reported to the Insights server.
Insights.DisableCollection = true; // Disables Insights automated behaviors
Insights.DisableDataTransmission = true; // Disables data communication with the webapi
Insights.DisableExceptionCatching = true; // Disables automatic unhandled exception catching
Insights.DisableCollectionTypes = Insights.OSInfo; // Stops Insights from tracking OSInfo
Insights.DisableCollectionTypes = Insights.Jailbroken; // Stops Insights from tracking HardwareInfo
Insights.DisableCollectionTypes = Insights.NetworkInfo; // Stops Insights from tracking NetworkInfo
//Can be combined
Insights.DisableCollectionTypes = Insights.OSInfo | Insights.NetworkInfo; // Stops Insights from tracking OSInfo and NetworkInfo
URL corresponding to the location of the users avatar
Use Date.ToString('o'); to encode the users date of birth
Use Date.ToString('o'); to encode the date the user created the account
DisableCollection allows you to disable Insights at run time, it will not collect information, it will not submit
information, any information it has collected will be preserved.
Crash reporting is also disabled if this flag is set, use at your own risk.
DisableDataTransmission allows you to disable any use of data communication by Insights, when this value is set to True
Insights will just gather data and not send any data.
DisableExceptionCatching disables any automatic unhandled exception handling in Insights.
Use this if you wish to catch exceptions yourself and .Report() them to insights at your leisure
Setting this property to true will force Insights to submit data to the server regardless of the network state
Identify is used to identify your users with unique information, this also allows Insights to attach other reports
to this user.
The unique identifier for this user, this can be whatever string you like as long as it is unique for
that user, using DeviceIDs and such is not recommended, those are only unique to devices
A Generic table of information you would like to associate with this user.
This sample shows how to call the method with a table of data
var manyInfos = new Dictionary<string, string>{
{"Email", "njpatel@catfacts.com"},
{"CatTeethFact", "Cats have 30 teeth (12 incisors, 10 premolars, 4 canines, and 4 molars), while dogs have 42. Kittens have baby teeth, which are replaced by permanent teeth around the age of 7 months."}
}
Insights.Identify("YourUsersUniqueId", manyInfos);
Identify is used to identify your users with unique information, this also allows Insights to attach other reports
to this user.
This method is a shorthand version of Identify(string, IDictionary) in that it essentially represents
a table with one value
The unique identifier for this user, this can be whatever string you like as long as it is unique for
that user, using DeviceIDs and such is not recommended, those are only unique to devices
The key representing a key/value storage type.
The value representing a key/value storage type.
This sample shows how to call the method with a key/value.
Insights.Identify("YourUsersUniqueId", "Email", "njpatel@catfacts.com");
Track allows you to track usage of your application and add additional data to each event
A unique name for this event
An optional key/value store representing additional data that you would like to attach to this
event
Track allows you to track usage of your application and add additional data to each event
A unique name for this event
A trait for this track event, key value form of the Dictionary varient
Value for the given trait, key value form of the Dictionary varient
TrackTime allows you to track events that make take an amount of time to complete. For example measuring how long
it takes to submit login information to a remote server.
A unique identifier name for this event
a handler object that allows you to start and stop the built in timer.
This shows how to use this method with a using keyword
using (var handle = Insights.TrackTime("TimeToLogin")) {
await SubmitLoginInformation("myuserid", "mypassword");
... more code goes here ...
}
If you do not wish to use the using keyword or want to track events in more complex scenarios you can use the Start
and Stop methods on the handle object
var handle = Insights.TrackTime("TimeToLogin");
handle.Start();
await SubmitLoginInformation("myuserid", "mypassword");
... more code goes here ...
handle.Stop();
TrackTime allows you to track events that make take an amount of time to complete. For example measuring how long
it takes to submit login information to a remote server.
A unique identifer name for this event
a handler object that allows you to start and stop the built in timer.
This shows how to use this method with a using keyword
using (var handle = Insights.TrackTime("TimeToLogin")) {
await SubmitLoginInformation("myuserid", "mypassword");
... more code goes here ...
}
If you do not wish to use the using keyword or want to track events in more complex scenarios you can use the Start
and Stop methods on the handle object
var handle = Insights.TrackTime("TimeToLogin");
handle.Start();
await SubmitLoginInformation("myuserid", "mypassword");
... more code goes here ...
handle.Stop();
Describes the Severity of a Report
Warning Severity
Error Severity, you are not expected to call this from client side code unless you have disabled unhandled exception handling.
Critical Severity
Report allows you to report exceptions to Insights when they are caught, this allows you to track exceptions
without crashing.
an Exception data type, you can also attach extra data to the .Data paramater of the exception
A warning level for the given report, can be ReportSeverity.Warning or ReportSeverity.Error
This sample shows how to call the Report method.
try {
ExceptionThrowingFunction();
}
catch (Exception exception) {
exception.Data["This is some extra data"] = "A cat's field of vision is about 200 degrees."
Insights.Report(exception);
}
An overload of Report, this allows you to specify extra data to be sent with the exception.
The Exception you want to report
A Dictionary containing key/values that you want to report along with the exception
A warning level for the given report, can be ReportSeverity.Warning or ReportSeverity.Error
An overload of Report, this allows you to specify a single key/value pair of extra data to be sent with the exception
The Exception you want to report
A warning level for the given report, can be ReportSeverity.Warning or ReportSeverity.Error
Save is intended to be called when your process is being stopped. It informs Insights that the process will no longer be active and lets Insights save its state to disk.
Insights auto detects most cases where this would happen, The intendted use case for this is if you are handling unhandled exceptions yourself, you will need to Insights.Save() after reporting your exceptions.
Returns a task, it is recommended that you await this task.
Purges any pending crash reports. This is only ever intended to be used when Insights notifies you that there are pending crash reports.
A Task that should be awaited until it has completed, signifying that the crash reports have been delivered to insights web.
Interface for TrackHandles, this not expected to be implimented by client side code
Starts the TrackTime handle
Stops the TrackTime handle
the key value traits list associated with this TrackTime event