pushe 0.2.1 copy "pushe: ^0.2.1" to clipboard
pushe: ^0.2.1 copied to clipboard

discontinued
outdated

Flutter plugin for Pushe sdk

Pushe flutter #

A plugin to use Pushe sdk in Flutter framework.

Run the sample #

Run: git clone https://github.com/pusheco/flutter-sample.git
The go to example: cd example
And run the example on a connected device: flutter run

Installation #

Add the plugin to pubspec.yaml:

dependencies:
  pushe: ^version

Then run flutter packages get to sync the libraries.

Set up credentials #

Go to https://console.pushe.co , create an application with the same package name and get the manifest tag. Add the manifest tag in the Application tag. It should be something like this:

<meta-data android:name="co.ronash.pushe.token"
           android:value="PUSHE_12345678" />

Add the code snippets #

In your main.dart:

import 'package:pushe/pushe.dart';
Pushe.initialize();

More #

Topics

You can add a user to a specific group. In order to do this you need to use topics. To subscribe a user to a topic:

Pushe.subscribe("topic_name");

And to undo this:

Pushe.unsubscribe("topic_name");

PusheId

Pushe id is an id that makes a device unique and can be used to identifiy devices (users) and not app users. To get that id:

Pushe.getPusheId().then((pusheId) {
  // Deal with id
});

Check initialization of Pushe

If you want to see wether pushe is registered to server or not:

Pushe.isPusheIntialized().then(isIt => print('Is it? $isIt'));

Notification listeners

To listen to different event of a notification (such as receive, click, etc), you can use this codes:


// First make the sdk listen
Pushe.initializeNotificationListeners(); // let the input arg be default for now.

// Then add the codes

Pushe.setOnNotificationReceived((notification) {
      // Called when notification was received
});
    
Pushe.setOnNotificationClicked((notification) {
      // Called when notification was clicked
});
    
Pushe.setOnNotificationDismissed((notification) {
      // Called when notification was dismissed
});

Pushe.setOnNotificationCustomContentReceived((notification) {
      // Called when notification custom content was received
});
    
Pushe.setOnNotificationButtonClicked((notification, clickedButton) {

});

Note: Callbacks only work when app is not fully closed and flutter is still running under the hood. So when app is not opened or force stopped, listeners will not be called.

More Info #

For detailed documentations visit https://pushe.co/docs/flutter/

Contribution #

Feel free to add anything you think is suitable to be in this sample.
It does not follow any specific code style. So just read the code a little bit and send a pull request at anytime. We'll be happy :D.

Support #

Email:

If you have any problem, please contact us using this email, we will get back to you right away: support [at] pushe.co

0
likes
20
pub points
0%
popularity

Publisher

unverified uploader

Flutter plugin for Pushe sdk

Homepage

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on pushe