Fabric is a group of tools that are very useful for various common task in an typical mobile app development, in this blog we will explore various parts of fabric including Crashlytics, Beta and Answers.
First you need to create an account and a organization (various apps are grouped in an organization), and then go to Organizations page, you need to copy the
API key and the
Build Secret to install all the tools and plugins that we will cover.
The fabric plugin by
Sarriaroman is a very useful and easy to use plugin that will allow the integration of the fabric tools.
For the official installation process go to plugin installation page
Note: This plugins works only in a mobile device, when you are using the browser to test the app the plugin will not be available.
Note: You will have one ‘aplication’ per platform, this means that you don’t need to identify any of your request because the data for every platform will be stored and handled independently.
If you are using Ionic 2, 3 or later, then maybe you want TypeScript integration, to achieve this, you need to add to your
tsconfig.json the following:
Note: For an example of how to use this typings you can go to the typings examples.
Crashlytics is a very useful tool to report crash and other events (like not fatal crashes and errors).
The first check is to prevent to use the plugin in the browser.
Store user data
To add metadata to your reports you need to use various specific methods to store the info, the main method is
setXXXValueForKey (XXXX can be
Float), but there are other specific methods to store user data:
When the user login you can store this data, and when the user log outs we need to set the values of this keys to
In a similar way, we can use the tool
Answers, which is a tool to store various events and to keep a track of actions of the user, for example we can track successful logins, track a shopping cart, start of game levels, etc (you can create your custom events too).
You can create a simple
AnswerProvider to abstract the plugin and has an single access point to
First, let create the provider:
And edit the constructor (we don’t need the
HttpClient that comes by default with every provider):
And then add methods for our usage, for example to store and payment event:
if(!this.answers) must be in every single method of this provider, and you can accept your objects and handle the logic to translate your events and the types of events in
I will update this blog with more information about the various tools, including beta and firebase