Skip to content

Need HockeyApp in your Ionic application, add this package!

License

Notifications You must be signed in to change notification settings

AndyMDoyle/ionic-hockeyapp

 
 

Repository files navigation

Ionic-HockeyApp

npm npm npm license GitHub stars

Need HockeyApp in your Ionic application, add this package! This is an Ionic wrapper of the cordova-plugin-hockeyapp to make it easier to add HockeyApp into your Ionic application.

Supported Ionic Platforms

Ionic 2 & 3 are fully supported, the latest version of Ionic that was tested is v3.6.1.

Getting Started

Start by creating a HockeyApp account and register your app with the service.

Install the official HockeyApp plugin by running this command:

ionic cordova plugin add cordova-plugin-hockeyapp@latest

Install ionic-hockeyapp

npm install ionic-hockeyapp --save

Add the HockeyApp provider to app.module.ts

import { HockeyApp } from 'ionic-hockeyapp';

providers: [
  HockeyApp
]

How to use

After following the Getting Started guide. Import HockeyApp provider into your class and call HockeyApp. Start the HockeyApp Service in app.component.ts

import { HockeyApp } from 'ionic-hockeyapp';
import { Platform, App } from 'ionic-angular';

constructor(..., app:App, hockeyapp:HockeyApp) {
  platform.ready().then(() => {
    // The Android ID of the app as provided by the HockeyApp portal. Can be null if for iOS only.
    let androidAppId = '9e49aeddaa96488891f0a46b52b27618';
    // The iOS ID of the app as provided by the HockeyApp portal. Can be null if for android only.
    let iosAppId = '7ea7b82b9b6e4366a8c8dd57e07b2743';
    // Specifies whether you would like crash reports to be automatically sent to the HockeyApp server when the end user restarts the app.
    let autoSendCrashReports = false;
    // Specifies whether you would like to display the standard dialog when the app is about to crash. This parameter is only relevant on Android.
    let ignoreCrashDialog = true;

    hockeyapp.start(androidAppId, iosAppId, autoSendCrashReports, ignoreCrashDialog);

    //So app doesn't close when hockey app activities close
    //This also has a side effect of unable to close the app when on the rootPage and using the back button.
    //Back button will perform as normal on other pages and pop to the previous page.
    platform.registerBackButtonAction(() => {
      let nav = app.getRootNav();
      if (nav.canGoBack()) {
        nav.pop();
      } else {
        nav.setRoot(this.rootPage);
      }
    });
  });
}

After starting HockeyApp, import into pages, providers, and components and you are good to go.

import { HockeyApp } from 'ionic-hockeyapp';

constructor(..., private hockeyApp:HockeyApp) {
  this.hockeyApp.trackEvent('Hello World');
}

Example

Check out the example Ionic application in the example folder.

Android Screenshot iOS Screenshot
android screenshot ios screenshot

API Reference

Read the Cordova HockeyApp API Reference for official documentation.

Contributing

If you want to make an improvement, please feel free to fork this repo and submit a pull request.

Possible enhancements:

  • Update HockeyApp start command to add Login Mode.
  • Add Unit Tests
  • Make library promise based. Added in v0.1.6

License

MIT License

Copyright (c) 2017 Boston University - Software and Application Innovation Lab

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Need HockeyApp in your Ionic application, add this package!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 70.8%
  • CSS 15.9%
  • HTML 13.3%