'How can I close a JitsiMeet room using code?
I'm doing some tests to close the JitsiMeet call via code, I tried a few things but it gave an error.
tried
jitsiMeetActivity.finish();
I also tried
jitsiMeetActivity.leave();
In both cases the error
java.lang.NullPointerException: Attempt to invoke virtual method 'void org.jitsi.meet.sdk.JitsiMeetActivity.finish()' on a null object reference
My code
try {
JitsiMeetConferenceOptions defaultOptions = new JitsiMeetConferenceOptions.Builder().
setServerURL(new URL("https://meet.jit.si"))
.setFeatureFlag("chat.enabled",false)
.setFeatureFlag("invite.enabled",false)
.setWelcomePageEnabled(false).build();
JitsiMeet.setDefaultConferenceOptions(defaultOptions);
Date data = new Date(System.currentTimeMillis());
SimpleDateFormat formatDate = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
salas.setSala(nomeSala);
salas.setEmailCreator(email);
salas.setDate(formatDate.format(data));
salas.setEmailParticipant("");
salas.setRoomAtive(true);
db.collection("Salas").document(nomeSala).set(salas).addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void unused) {
Toast.makeText(getContext(), "Room Created", Toast.LENGTH_SHORT);
JitsiMeetConferenceOptions options = new JitsiMeetConferenceOptions.Builder().setRoom(salas.getSala()).setWelcomePageEnabled(false).build();
jitsiMeetActivity.launch(getContext(), options);
try{
jitsiMeetActivity.finish();
}catch (Exception e){
Log.d("Error",e.toString());
}
}
});
}catch (MalformedURLException e){
e.printStackTrace();
}
The intention is for the code to go back to the fragment that calls JitsiMeet.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
