Crashlytics Integration

Hey… plz anyone help me how to integrate crashlytics in ionic2 . i installed cordova-fabric-plugin for crashlytics bt i don’t know how to implement in project code… if any one have reference please help out.

Thanks,
Priti

You could declare var window in your provider ts file.
Like below snippet:

import {Injectable} from '@angular/core';

declare var window;

@Injectable()
export class ProviderClassName{

}

And then access fabric APIs in your provider class.
Like below snippet:
window.fabric.Crashlytics.setUserIdentifier('TheIdentifier')

1 Like

Thanks for replying me,
I implement these thing… But how could i identify this is working or not… because i m getting error Runtime Error
Cannot read property ‘Crashlytics’ of undefined… my app is working properly… plz help me out.

If you will add declare var window, as i have mentioned in above post then ‘Crashlytics’ of undefined error should not come.

Still error coming, then might be you have some issue with installation.
Please follow as mentioned here : https://www.npmjs.com/package/cordova-fabric-plugin

Do not forget to mention FABRIC_API_KEY=XXX & FABRIC_API_SECRET=xxx, at the time of adding plugin.

After that, you can remove the platform and add it again.
I have noticed, CLI fails to update files sometime.

1 Like

Thanks a lot ankit… Its working properly

1 Like