Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After disconnet the internert my Application crashed #308

Open
MOhsain opened this issue Nov 12, 2021 · 2 comments
Open

After disconnet the internert my Application crashed #308

MOhsain opened this issue Nov 12, 2021 · 2 comments

Comments

@MOhsain
Copy link

MOhsain commented Nov 12, 2021

Hi I'm working on Android Application.
Applicaiton is working fine with internet but i turn off internet my application gone crashed.
Here is the screenshot.

image

CC @pusher/mobile

@benjamin-tang-pusher
Copy link
Contributor

Thanks for this. I get the same in my app. I will see if there is a way to get this handled better.

@benjamin-tang-pusher
Copy link
Contributor

Are you implementing a ConnectionEventListener? The parameters for its methods have to be nullable with a '?' at the end, and variables accessed in a null safe manner. Such as the following:

val pusher = Pusher("xxxxxxxxxxxxx", options)
        pusher.connect(object : ConnectionEventListener {
            override fun onConnectionStateChange(change: ConnectionStateChange?) {
                if (change != null) {
                    Log.i("Pusher", "State changed from ${change.previousState} to ${change.currentState}")
                }
            }
            override fun onError(
                message: String?,
                code: String?,
                e: Exception?
            ) {
                Log.i("Pusher", "There was a problem connecting! code ($code), message ($message), exception($e)")
            }
        }, ConnectionState.ALL)

Let me know if this isn't the case for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants