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
the above Set the custom notification click listener is used for this class file
import com.onesignal.notifications.INotificationClickEvent
import com.onesignal.notifications.INotificationClickListener
/**
* A custom notification click listener to handle clicks and navigate to the main activity.
*/
class CustomNotificationClickListener(private val context: Context) : INotificationClickListener {
override fun onClick(event: INotificationClickEvent) {
// Handle notification click
val notification = event.notification
val result = event.result
// You can use notification or result data if needed
// For example, you might want to handle specific actions or URLs here
// Create an intent to start the main activity
val intent = Intent(context, MainActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
// Start the main activity
context.startActivity(intent)
}
}
can anyone help me fix this issue, I went through documentation i didn't find anything for custom notification opened handling for v5 SDK
Steps to reproduce?
create a custom class and use this line
OneSignal.addClickListener(CustomNotificationClickListener(this))
What did you expect to happen?
I wanted to open the main activity when notification was clicked
OneSignal Android SDK version
release 5.1.8
Android version
14, 13, 12, 11, 10
Specific Android models
No response
Relevant log output
Unresolved reference: addClickListener
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
What happened?
I am using the latest version of the Android SDK in kotlin
here is my code
i have imported the following libraries
the above Set the custom notification click listener is used for this class file
can anyone help me fix this issue, I went through documentation i didn't find anything for custom notification opened handling for v5 SDK
Steps to reproduce?
What did you expect to happen?
I wanted to open the main activity when notification was clicked
OneSignal Android SDK version
release 5.1.8
Android version
14, 13, 12, 11, 10
Specific Android models
No response
Relevant log output
Code of Conduct
The text was updated successfully, but these errors were encountered: