sarriaroman / FabricPlugin

Fabric.io plugin for Cordova or Phonegap
MIT License
198 stars 159 forks source link

How I can integrate this plugin into my ionic 3 app? #131

Open lsantaniello opened 6 years ago

lsantaniello commented 6 years ago

Hi all, I'd like to integrate this plugin into my ionic 3 app but I have some problems.

I installed plugin using the following command: cordova plugin add cordova-fabric-plugin --variable FABRIC_API_KEY=XXX --variable FABRIC_API_SECRET=xxx

Then I tryed to insert the code into my app: window.fabric.Crashlytics.addLog("about to send a crash for testing!"); window.fabric.Crashlytics.sendCrash();

but I have "fabric doesn't exist" compilation error.

I replaced with: (<any>window).fabric.Crashlytics.addLog("about to send a crash for testing!"); (<any>window).fabric.Crashlytics.sendCrash();

Then, I built my app and I generated the apk. I tested into my android simulator and when I execute the code, the app crash.

I have two questions: 1) I don't know if my implementation is correct. 2) How I can see the logs? When I log in into my fabric account, I don't see the log.

Thanks in advance Luca

o-dlr-o commented 6 years ago

Did you try let fabric; .... fabric.Crashlytics.addLog("about to send a crash for testing!");

And don't forget to include typings in your tsconfig.json :

"files": [ "plugins/cordova-fabric-plugin/typings/cordova-fabric-plugin.d.ts" ]

lourensdev commented 5 years ago

@lsantaniello if you are using Ionic 3 you should follow these installation instructions: https://ionicframework.com/docs/native/crashlytics/

Crashlytics should be imported on the .ts file, and defined in your constructor for it to be usable. Also don't forget to add Crashlytics as a Provider in your app.module.ts file

chethangowda commented 5 years ago

Am am not able to install fabric plugin in ionic 3 project, used: cordova plugin add cordova-fabric-plugin --variable FABRIC_API_KEY=XXX --variable FABRIC_API_SECRET=xxx

getting error: npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! cordova-fabric-plugin@1.1.14-dev postinstall:opencollective postinstall` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the cordova-fabric-plugin@1.1.14-dev postinstall script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\CKG\AppData\Roaming\npm-cache_logs\2018-11-14T08_59_13_062Z-debug.log`

@lsantaniello can any one help to use fabric acrashlytics in ionic 3