element-hq / element-hq/element-android

room TimelineEvent is null when receive notification

Open
#4,705 2 comments 0 reactions 0 assignees View on GitHub
matrix-sdk
Dominant language
Kotlin
Stars
3.7k
Forks
917
PR merge metrics
No merged PRs in 30d

Description

### Steps to reproduce

1. Where are you starting? What can you see?
-null
2. What do you click?
nothing
3. More steps…

sample code :
val eventId = intent.getStringExtra("event_id")
val roomId = intent.getStringExtra("room_id")

val matrix = Matrix.getInstance(context)
val matrixAuthService = matrix.authenticationService()
if(matrixAuthService.hasAuthenticatedSessions()) {
try {
//matrixAuthService.getLastAuthenticatedSession()?.requireBackgroundSync()
var session = matrixAuthService.getLastAuthenticatedSession()
var room = session?.getRoom(roomId ?: "")
var timelineEvent = room?.getTimeLineEvent(eventId ?: "")

Timber.d("timelineEvent: ${timelineEvent}") <--- give null why?
}catch (e: Exception) {
Timber.d("ErrorNotification: ${e.message.toString()}")
}catch (e: RealmFileException){
}
}

### Outcome

#### What did you expect?
-list of timeline
#### What happened instead?
- it give return null

### Your phone model

xiomi 9t

### Operating system version

android 10

### Application version and app store

_No response_

### Homeserver

_No response_

### Will you send logs?

Yes

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.