Skip to content

Commit d019b0d

Browse files
committed
update the readme
1 parent 7909f17 commit d019b0d

File tree

1 file changed

+14
-5
lines changed
  • library/src/main/java/org/xmtp/android/library/push

1 file changed

+14
-5
lines changed

library/src/main/java/org/xmtp/android/library/push/README.md

+14-5
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ These files can serve as the basis for what you might want to provide for your o
8282
8383
```kotlin
8484
val hmacKeysResult = ClientManager.client.conversations.getHmacKeys()
85-
val subscriptions = conversations.map {
85+
val subscriptions: MutableList<Service.Subscription> = conversations.map {
8686
val hmacKeys = hmacKeysResult.hmacKeysMap
8787
val result = hmacKeys[it.topic]?.valuesList?.map { hmacKey ->
8888
Service.Subscription.HmacKey.newBuilder().also { sub_key ->
@@ -96,11 +96,20 @@ These files can serve as the basis for what you might want to provide for your o
9696
sub.topic = it.topic
9797
sub.isSilent = it.version == Conversation.Version.V1
9898
}.build()
99-
}
100-
101-
XMTPPush(context, "10.0.2.2:8080").subscribeWithMetadata(subscriptions)
102-
```
99+
}.toMutableList()
100+
101+
// To get pushes for New Group (WelcomeMessages)
102+
val welcomeTopic = Service.Subscription.newBuilder().also { sub ->
103+
sub.topic = Topic.userWelcome(ClientManager.client.installationId).description
104+
sub.isSilent = false
105+
}.build()
106+
subscriptions.add(welcomeTopic)
107+
108+
XMTPPush(context, "10.0.2.2:8080").subscribeWithMetadata(subscriptions)
109+
```
103110
104111
```kotlin
105112
XMTPPush(context, "10.0.2.2:8080").unsubscribe(conversations.map { it.topic })
106113
```
114+
115+
8. See example in [PushNotificationsService](https://github.com/xmtp/xmtp-android/blob/main/example/src/main/java/org/xmtp/android/example/pushnotifications/PushNotificationsService.kt) for how to decrypt the different messages.

0 commit comments

Comments
 (0)