Skip to main content
Version: v6

Pollfish

Pollfish Ionic Native plugin wrapper

https://github.com/pollfish/cordova-plugin-pollfish

Stuck on a Cordova issue?

Don't waste precious time on plugin issues.

If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic’s experts offer premium advisory services for both community plugins and premier plugins.

Installation

$ npm install com.pollfish.cordova_plugin 
$ npm install @awesome-cordova-plugins/pollfish
$ ionic cap sync

Supported Platforms

  • Android
  • iOS

Usage

React

Learn more about using Ionic Native components in React

Angular

import { Pollfish } from '@awesome-cordova-plugins/pollfish/ngx';


constructor(private pollfish: Pollfish) { }

...

this.pollfish.init(false, false, 'YOUR_API_KEY', 1, 8, 'REQUEST_UUID', false);

this.pollfish.initWithUserAttributes(false, false, 'YOUR_API_KEY', 1, 8, 'REQUEST_UUID', false, {
'gender': '1',
...
});

this.pollfish.showPollfish();

this.pollfish.hidePollfish();

// Event Listeners

this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishSurveyReceived, (surveyInfo) => {
console.log("Survey Received: " + JSON.stringify(surveyInfo));
});

this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishSurveyCompleted, (result) => {
console.log("Survey Completed: " + JSON.stringify(surveyInfo));
});

this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishUserNotEligible, (_) => {
console.log("Pollfish User Not Eligible");
});

this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishSurveyNotAvailable, (_) => {
console.log("Pollfish Survey not available");
});

this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishOpened, (_) => {
console.log("Pollfish Survey panel is open");
});

this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishClosed, (_) => {
console.log("Pollfish Survey panel is closed");
});

this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishUserRejectedSurvey, (_) => {
console.log("Pollfish User Rejected Survey");
});