You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: samples/kotlin-android-app-destinations/README.md
+10-43Lines changed: 10 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,50 +2,17 @@
2
2
This is a sample android app that uses the `analytics-kotlin` library and the new `Plugins` concepts. It is meant to be simplistic, and easy to understand all the while showcasing the power of the analytics-kotlin library
3
3
4
4
## Plugins
5
-
-Android AdvertisingId Plugin
6
-
Using the `play-services-ads` library this plugin adds the `advertisingId` to all payloads (under the `context` key) going through the analytics timeline
Sample plugin to enable users to send data to the device-mode Firebase destination
10
10
11
-
- Consent Tracking
12
-
Presents user with a dialog to consent to tracking. If consent is given, any queued events will be sent out to the analytics timeline. If consent is not given, all queued events and future events will be dropped
13
-
** Note: You will have to switch to the `ConsentActivity` inside of AndroidManifest.xml to view this feature **
Sample plugin to enable users to send data to the device-mode Intercom destination
14
13
15
-
-Webhook Plugin
16
-
A destination plugin that allows you to send the event from the analytics timeline to a webhook of your choice. Ideal for debugging payloads in an internal network.
Sample plugin to enable users to send data to the device-mode Mixpanel destination
17
16
18
-
## Tracking Deep Links
19
-
The sample app is configured to open links with the schema and hostname `https://segment-sample.com`
20
-
21
-
Here is how you can do it via adb
22
-
```bash
23
-
adb shell am start -W -a android.intent.action.VIEW -d "https://segment-sample.com?utm_source=cli\&utm_click=2" com.segment.analytics.next
24
-
```
25
-
26
-
## FCM
27
-
This project is setup to track push notification received and opened events. This code is strictly optional and must be customized as per your needs. The code here is only for demonstration purposes
28
-
### Setup
29
-
- Add your FCM project's `google-services.json` to this folder
30
-
- Modify `MyFirebaseService.kt` to customize the notification displayed to the user.
31
-
- Here is how to send a push notification using cURL [this uses the legacy api](https://firebase.google.com/docs/cloud-messaging/send-message#send-messages-using-the-legacy-app-server-protocols)
32
-
```bash
33
-
curl --request POST \
34
-
--url https://fcm.googleapis.com/fcm/send \
35
-
--header 'Authorization: key=<SERVER_KEY>' \
36
-
--header 'Content-Type: application/json' \
37
-
--data '{
38
-
"data": {
39
-
"title": "Hello World"
40
-
"content": "You have mail",
41
-
},
42
-
"to": "<FCM_TOKEN_FOR_DEVICE>"
43
-
}'
44
-
```
45
-
46
-
### How it works
47
-
- We have 2 core changes
48
-
- MyFirebaseService.kt
49
-
The core component to handle FCM push messages. This is responsible for handling the incoming message and assigning the intents for the notification. It is also responsible for firing the `Push Notification Received` event.
50
-
- PushNotificationTracking.kt
51
-
The analytics plugin responsible for firing the "Push Notification Tapped" event. This is a lifecycle plugin that will be invoked for any Activity onCreate.
An after plugin that allows you to send the event from the analytics timeline to a webhook of your choice. Ideal for debugging payloads in an internal network.
0 commit comments