Skip to content

Commit d062a44

Browse files
committed
Update documentation for 1.0.1
1 parent 8c5f320 commit d062a44

File tree

1 file changed

+47
-37
lines changed

1 file changed

+47
-37
lines changed

README.md

Lines changed: 47 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,33 @@
22

33
A library for Dart developers. Help you manage notifications easily and effectively.
44

5-
## Usage
5+
## Example project
6+
7+
You can try our sample project inlcuded with the library:
8+
```shell
9+
git clone [email protected]:pushbots/flutter-sdk.git
10+
cd flutter-sdk/example
11+
flutter run
12+
```
613

714

15+
## Usage
16+
817
Use this package as a library
918

10-
**1- Depend on it**
19+
**1- Add to dependencies:**
1120

12-
Add this to your package's `pubspec.yaml` file:
21+
Add this to your package's `pubspec.yaml` file below dependencies:
1322

1423

15-
````
24+
````yaml
1625
dependencies:
1726
pushbots_flutter: ^1.0.1
1827
````
1928

20-
**2- Install it**
21-
22-
You can install packages from the command line:
23-
24-
with Flutter:
29+
**2- Install the SDK:**
2530

31+
Run this command on your project:
2632

2733
````
2834
$ flutter pub get
@@ -31,23 +37,34 @@ $ flutter pub get
3137
Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.
3238

3339

40+
**3- Add to your project:**
3441

42+
Now in your Dart code `lib/main.dart`, you can start using PushBots SDK:
3543

36-
**3- Import it**
37-
38-
Now in your Dart code, you can use:
39-
40-
````
44+
````dart
4145
import 'package:pushbots_flutter/pushbots_flutter.dart';
4246
````
4347

48+
### iOS Setup
4449

45-
### Android Setup
50+
#### Add PushBots service extension
4651

47-
Add to `defaultConfig` section, then replace `PUSHBOTS_APP_ID` and `GOOGLE_SENDER_ID`
52+
Follow this article to add PushBots service extension in order to be able to use rich media in your iOS app, you'll find `Flutter SDK additional config` at the end of the article, please make sure to follow it:
4853

54+
https://www.pushbots.help/en/articles/1571650-creating-notification-service-extension
4955

50-
````
56+
#### Enable push notifications in your app
57+
58+
1. Under targets, click on project name, then click on "+ Capability"
59+
2. Search for "Push notifications" and click on it, then search for "Background modes", click on it then enable "remote notifications" from the list
60+
61+
![Enable push notifications](https://downloads.intercomcdn.com/i/o/243149291/bdb77b474f7d1c38ab65eca9/xcode8-2.gif)
62+
63+
### Android Setup
64+
65+
Add to `defaultConfig` section, then replace `PUSHBOTS_APPLICATION_ID` and `SENDER_ID`
66+
67+
````gradle
5168
defaultConfig {
5269
// Add PushBots integration data
5370
manifestPlaceholders = [
@@ -60,27 +77,27 @@ defaultConfig {
6077
6178
````
6279

63-
64-
65-
6680
### Flutter Usage
6781

68-
69-
Once added `pushbots_flutter` into your `pubspec.yaml`.
70-
7182
#### Initializing PushBots:-
7283

7384

74-
You can start by initializing the `PushBotsFlutter` by calling **`PushbotsFlutter.initialize("PUSHBOTS_APPLICATIN_ID", "YOUR_WEBAPI_KEY", "YOUR_FCM_APP_ID", "YOUR_PROJECT_ID");`**
85+
You can start by initializing the `PushBotsFlutter` by calling
86+
87+
````dart
88+
PushbotsFlutter.initialize("PUSHBOTS_APPLICATIN_ID", "YOUR_WEBAPI_KEY", "YOUR_FCM_APP_ID", "YOUR_PROJECT_ID");
89+
````
7590

91+
to be able to get all firebase cerdentials, check out this article for all details:
92+
https://www.pushbots.help/en/articles/498201-the-google-part-firebase-credentials
7693

7794
![Initialize Image](assets/fcm-info.png)
7895

7996

8097
Listen for notifiers (receive, open) notifications:-
8198

8299

83-
````
100+
````dart
84101
PushbotsFlutter.listenForNotificationReceive().stream.listen((onData) {
85102
print("MAIN, received: " + onData.toString());
86103
});
@@ -95,18 +112,18 @@ Update User info:-
95112

96113

97114

98-
````
115+
````dart
99116
PushbotsFlutter.setName("Pushbotter");
100117
PushbotsFlutter.setFirstName("FirstName");
101118
PushbotsFlutter.setLastName("LastName");
102119
PushbotsFlutter.setEmail("[email protected]");
103120
PushbotsFlutter.setAlias("Alias");
104121
PushbotsFlutter.setPhone("phoneNumber");
105-
106-
107122
````
123+
108124
Other Methods:
109-
````
125+
126+
````dart
110127
PushbotsFlutter.debug(true);
111128
//Track event
112129
PushbotsFlutter.trackEvent("added_to_cart");
@@ -121,7 +138,7 @@ PushbotsFlutter.setTags(["tag1", "tag2"]);
121138
122139
PushbotsFlutter.removeTags(["tag1"]);
123140
124-
// ---- iOS
141+
// ====== iOS only method ======
125142
//Set log level with alert
126143
//Log Levels : noLog, error, warn, info, verbose
127144
PushbotsFlutter.setLogLevelWithUI(LogLevels.verbose.index,true);
@@ -133,15 +150,8 @@ PushbotsFlutter.setBadge(10);
133150
PushbotsFlutter.incrementBadgeCountBy(1);
134151
//Decrement badge count
135152
PushbotsFlutter.decrementBadgeCountBy(10);
136-
137-
138153
````
139154

140-
141-
142-
143-
144-
145155
## Feature and bugs
146156

147157
Please fill issue on https://github.com/pushbots or https://stackoverflow.com/questions/tagged/pushbots

0 commit comments

Comments
 (0)