Skip to content

Commit d2263e8

Browse files
committed
Android Updates added.
1 parent d5ce248 commit d2263e8

File tree

1 file changed

+44
-49
lines changed
  • src/connections/destinations/catalog/moengage

1 file changed

+44
-49
lines changed

src/connections/destinations/catalog/moengage/index.md

Lines changed: 44 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ Push Notifications are a great way to keep your users engaged and informed about
128128

129129
**Segment Push Implementation:**
130130

131-
1. Follow the directions to register for push notifications [using Segment's SDK](/docs/connections/sources/catalog/libraries/mobile/ios/#how-do-i-use-push-notifications)..
131+
1. Follow the directions to register for push notifications [using Segment SDK](/docs/connections/sources/catalog/libraries/mobile/ios/#how-do-i-use-push-notifications).
132132

133133
2. In your application’s application:didReceiveRemoteNotification: method, add the following:
134134
```objc
@@ -166,7 +166,7 @@ For more info on using **Segment for iOS** refer to [**Developer Docs**](/docs/c
166166

167167
To use MoEngage in an Android app, you must perform the following steps to set up your environment.
168168

169-
![Downlaod](https://api.bintray.com/packages/moengage/android-sdk/moengage-segment-integration/images/download.svg)
169+
![MavenBadge](https://maven-badges.herokuapp.com/maven-central/com.moengage/moengage-segment-integration/badge.svg)
170170

171171
To enable the full functionality of MoEngage (like Push Notifications, InApp Messaging), complete the following steps in your Android app.
172172

@@ -211,7 +211,9 @@ Analytics analytics = new Analytics.Builder(this, "write_key")
211211

212212
### Initialise the MoEngage SDK
213213

214-
Get APP ID from the [Settings Page](http://app.moengage.com/v3/#/settings/0/0) on the MoEngage dashboard and initialise the MoEngage SDK in the `Application` class's `onCreate()`
214+
Get APP ID from the Settings Page `Dashboard --> Settings --> App --> General` and initialise the MoEngage SDK in the onCreate method of the `Application` class
215+
216+
**Note:** It is recommended that you initialise the SDK on the main thread inside `onCreate()` and not create a worker thread and initialise the SDK on that thread.
215217

216218
```java
217219
// this is the instance of the application class and "XXXXXXXXXXX" is the APP ID from the dashboard.
@@ -232,64 +234,67 @@ MoEHelper.getInstance(getApplicationContext()).setAppStatus(AppStatus.UPDATE);
232234

233235
If this is a fresh install:
234236

235-
236237
```java
237238
MoEHelper.getInstance(getApplicationContext()).setAppStatus(AppStatus.INSTALL);
238239
```
239240

240241
### Configure Push Notifications
241242

242-
Copy the Server Key from the FCM console and add it to the MoEngage Dashboard(Not sure where to find the Server Key refer to [Getting FCM Server Key](https://docs.moengage.com/docs/getting-fcmgcm-server-key). To upload it, go to [Settings Page](https://app.moengage.com/v3/#/settings/push/mobile) and add the Server Key and package name.
243+
Copy the Server Key from the FCM console and add it to the MoEngage Dashboard(Not sure where to find the Server Key refer to [Getting FCM Server Key](https://docs.moengage.com/docs/getting-fcmgcm-server-key). To upload it, go to the Settings Page `Dashboard --> Settings --> Channel --> Push --> Mobile Push --> Android` and add the Server Key and package name.
243244
**Please make sure you add the keys both in Test and Live environment.**
244245

245246
#### Add meta information for push notification
246247

247-
Add the AppId, and the small and large notification icons to the builder:
248+
To show push notifications some metadata regarding the notification is required where the small icon and large icon drawables being the mandatory ones.
249+
Refer to the [NotificationConfig](https://moengage.github.io/android-api-reference/core/core/com.moengage.core.config/-notification-config/index.html) API reference for all the possible options.
250+
251+
Use the `configureNotificationMetaData()` to pass on the configuration to the SDK.
252+
248253

249254
```java
250255
MoEngage moEngage =
251256
new MoEngage.Builder(this, "XXXXXXXXXX")
252-
.setNotificationSmallIcon(R.drawable.icon)
253-
.setNotificationLargeIcon(R.drawable.ic_launcher)
254-
.enableSegmentIntegration()
257+
.configureNotificationMetaData(new NotificationConfig(R.drawable.small_icon, R.drawable.large_icon, R.color.notiColor, "sound", true, true, true))
258+
.enablePartnerIntegration(IntegrationPartner.SEGMENT)
255259
.build();
256260
MoEngage.initialise(moEngage);
257261
```
258262

263+
#### Configuring Firebase Cloud Messaging
264+
259265
For showing Push notifications there are 2 important steps:
260266

261267
1. Registration for Push, for example generating push token.
262268
2. Receiving the Push payload from Firebase Cloud Messaging(FCM) service and showing the notification on the device.
263269

270+
##### Push Registration and Receiving handled by App
264271

265-
#### Opt out of MoEngage Registration
272+
###### How to opt-out of MoEngage Registration?
266273

267-
> note ""
268-
> By default, the MoEngage SDK attempts to register a push token, since your application is handling the push, be sure to opt-out of the SDK's token registration.
269-
270-
To opt-out of MoEngage's token registration mechanism call in the `optOutTokenRegistration()` on the `MoEngage.Builder` as shown below
274+
To opt-out of MoEngage token registration mechanism disable token registration while configuring FCM in the `MoEngage.Builder` as shown below
271275

272276
```java
273277
MoEngage moEngage = new MoEngage.Builder(this, "XXXXXXXXXX")
274-
.setNotificationSmallIcon(R.drawable.icon)
275-
.setNotificationLargeIcon(R.drawable.ic_launcher)
276-
.optOutTokenRegistration()
277-
.enableSegmentIntegration()
278+
.configureNotificationMetaData(new NotificationConfig(R.drawable.small_icon, R.drawable.large_icon, R.color.notiColor, "sound", true, true, true))
279+
.configureFcm(FcmConfig(false))
280+
.enablePartnerIntegration(IntegrationPartner.SEGMENT)
278281
.build();
279282
MoEngage.initialise(moEngage);
280283
```
281284

282-
#### Pass the Push Token To the MoEngage SDK
285+
###### Pass the Push Token To MoEngage SDK
286+
283287
The Application would need to pass the Push Token received from FCM to the MoEngage SDK for the MoEngage platform to send out push notifications to the device.
284288
Use the below API to pass the push token to the MoEngage SDK.
285289

286290
```java
287-
MoEFireBaseHelper.Companion.getInstance().passPushToken(getApplicationContext(), token);
291+
MoEFireBaseHelper.getInstance().passPushToken(getApplicationContext(), token);
288292
```
289-
> note ""
290-
> *Note:* Be sure to pass the token to the MoEngage SDK whenever you refresh the push token, and on every application update. Passing the token on application update is important for migration to the MoEngage Platform.
291293

292-
#### Pass the Push payload to the MoEngage SDK
294+
Please make sure token is passed to MoEngage SDK whenever push token is refreshed and on application update. Passing token on application update is important for migration to the MoEngage Platform.
295+
296+
###### Passing the Push payload to the MoEngage SDK
297+
293298
To pass the push payload to the MoEngage SDK call the MoEngage API from the `onMessageReceived()` from the Firebase receiver.
294299
Before passing the payload to the MoEngage SDK you should check if the payload is from the MoEngage platform using the helper API provided by the SDK.
295300

@@ -301,7 +306,8 @@ if (MoEPushHelper.getInstance().isFromMoEngagePlatform(remoteMessage.getData()))
301306
}
302307
```
303308

304-
#### Push Registration and Receiving handled by SDK
309+
##### Push Registration and Receiving handled by SDK
310+
305311
Add the below code in your manifest file.
306312

307313
```xml
@@ -311,30 +317,15 @@ Add the below code in your manifest file.
311317
</intent-filter>
312318
</service>
313319
```
314-
When the MoEngage SDK handles push registration, it optionally provides a callback to the application whenever a new token is registered or the token is refreshed.
315-
Application can get this callback by implementing `FirebaseEventListener` and registering for a callback in the Application class' `onCreate()` using `MoEFireBaseHelper.Companion.getInstance().setEventListener()`
316320

321+
When MoEngage SDK handles push registration it optionally provides a callback to the Application whenever a new token is registered or the token is refreshed.
322+
An application can get this callback by implementing `FirebaseEventListener` and registering for a callback in the Application class `onCreate()` using `MoEFireBaseHelper.getInstance().addEventListener()`
323+
Refer to the [API reference](https://moengage.github.io/android-api-reference/moe-push-firebase/moe-push-firebase/com.moengage.firebase.listener/-firebase-event-listener/index.html) for more details on the listener.
317324

318-
#### Configure Geo-fence
319325

320-
By default, the MoEngage SDK does not track location, and geo-fence campaigns do not work. To track location and run geo-fence campaigns you need to opt-in for location services in the MoEngage initializer. To initialize, call the opt-in API below:
321326

322-
```java
323-
MoEngage moEngage =
324-
new MoEngage.Builder(this, "XXXXXXXXXXX")
325-
.enableLocationServices()
326-
.enableSegmentIntegration()
327-
.build();
328-
MoEngage.initialise(moEngage);
329-
```
327+
#### Declaring & configuring Rich Landing Activity:
330328

331-
> note ""
332-
> **Note:** To ensure that Geo-fence pushes work properly, configure your location to have location permissions enabled, and include the Play Services Location Library.
333-
334-
For more information about configuring the Geo-fence, see the [Configuring Geo-Fence](https://docs.moengage.com/docs/push-configuration#section-geofence-push) section in the MoEngage documentation.
335-
336-
####
337-
Declaring & configuring Rich Landing Activity:
338329
Add the following snippet and replace `[PARENT_ACTIVITY_NAME]` with the name of the parent
339330
activity; `[ACTIVITY_NAME]` with the activity name which should be the parent of the Rich Landing Page
340331

@@ -348,17 +339,21 @@ Add the following snippet and replace `[PARENT_ACTIVITY_NAME]` with the name of
348339

349340
You are now all set up to receive push notifications from MoEngage. For more information on features provided in MoEngage Android SDK refer to the following links:
350341

351-
* [Push Notifications](http://docs.moengage.com/docs/push-configuration)
342+
* [Push Notifications](http://docs.moengage.com/docs/push-configuration)
343+
344+
* [Geofence](https://docs.moengage.com/docs/android-geofence)
345+
346+
* [In-App messaging](https://docs.moengage.com/docs/android-in-app-nativ)
352347

353-
* [In-App messaging](http://docs.moengage.com/docs/configuring-in-app-nativ)
348+
* [Notification Center](https://docs.moengage.com/docs/android-notification-center)
354349

355-
* [Notification Center](http://docs.moengage.com/docs/notification-center)
350+
* [Advanced Configuration](https://docs.moengage.com/docs/android-advanced-integration)
356351

357-
* [Advanced Configuration](https://docs.moengage.com/docs/advanced-integration)
352+
* [API Reference](https://moengage.github.io/android-api-reference/-modules.html)
358353

359-
* [API Reference](https://moengage.github.io/MoEngage-Android-SDK/)
354+
* [Compliance](https://docs.moengage.com/docs/android-compliance)
360355

361-
* [GDPR Compliance](https://docs.moengage.com/docs/gdpr-compliance)
356+
* [Release Notes](https://docs.moengage.com/docs/segment-android-releases)
362357

363358

364359
### Identify

0 commit comments

Comments
 (0)