Skip to content

Commit

Permalink
Add connect error handling to basic sample app (#515)
Browse files Browse the repository at this point in the history
* Add connect error handling to basic sample app

* fix
  • Loading branch information
davidliu authored Oct 1, 2024
1 parent bee0a1e commit efaf867
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package io.livekit.android.sample.basic
import android.Manifest
import android.content.pm.PackageManager
import android.os.Bundle
import android.util.Log
import android.view.View
import android.widget.Toast
import androidx.activity.result.contract.ActivityResultContracts
Expand Down Expand Up @@ -71,10 +72,15 @@ class MainActivity : AppCompatActivity() {
}

// Connect to server.
room.connect(
url,
token,
)
try {
room.connect(
url,
token,
)
} catch (e: Exception) {
Log.e("MainActivity", "Error while connecting to server:", e)
return@launch
}

// Turn on audio/video recording.
val localParticipant = room.localParticipant
Expand Down

0 comments on commit efaf867

Please sign in to comment.