当我将主要视频通话活动添加为应用程序的启动程序活动时,我能够成功运行Jitsi视频通话android sdk,视频连接流畅且无后顾之忧。但是,当我将代码更改为从另一个活动调用相同的活动时,它将引发一个活动未找到异常。
这是我的清单文件
<activity
android:name=".activity.JitsiVideoCallActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize"
android:label="@string/app_name"
android:resizeableActivity="true"
android:supportsPictureInPicture="true"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="beta.hipchat.me"
android:scheme="https" />
<data
android:host="beta.meet.jit.si"
android:scheme="https" />
<data
android:host="chaos.hipchat.me"
android:scheme="https" />
<data
android:host="enso.me"
android:scheme="https" />
<data
android:host="hipchat.me"
android:scheme="https" />
<data
android:host="meet.jit.si"
android:scheme="https" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="org.jitsi.meet" />
</intent-filter>
</activity>
这是我的活动,应该进行视频通话
公共类JitsiVideoCallActivity扩展了AppCompatActivity {
private JitsiMeetView view;
private static final String ADD_PEOPLE_CONTROLLER_QUERY = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
view = new JitsiMeetView(this);
Bundle config = new Bundle();
config.putBoolean("startWithAudioMuted", false);
config.putBoolean("startWithVideoMuted", false);
Bundle urlObject = new Bundle();
urlObject.putBundle("config", config);
urlObject.putString("url", "https://meet.jit.si/wizcounsel");
view.loadURLObject(urlObject);
setContentView(view);
}
这就是我发动意图的方式
@OnClick(R.id.call)
void call() {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO)
!= PackageManager.PERMISSION_GRANTED) {
// Permission is not granted
askForAudioPermission();
} else
startActivity(new Intent(this, JitsiMeetActivity.class),);
}
我已经在我的应用程序级别gradle文件中添加了JAVA 8兼容性,并且在两个gradle文件中都具有依赖关系
我尝试过的 将启动模式更改为单任务,应用崩溃 使视频通话活动启动器可以正常运行 扩展AppCombactActivity和/或JitsiMee活动应用崩溃
这是我的崩溃日志
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.star.star*, PID: 26197
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.star.star/org.jitsi.meet.sdk.JitsiMeetActivity}; have you declared this activity in your AndroidManifest.xml?
如果需要更多信息,请提前告诉我,谢谢!
答案 0 :(得分:0)
在oncreate方法中将其初始化。在任何活动中。
void connectCall() {
URL serverURL;
try {
serverURL = new URL("https://meet.jit.si");
} catch (MalformedURLException e) {
e.printStackTrace();
throw new RuntimeException("Invalid server URL!");
}
JitsiMeetConferenceOptions defaultOptions
= new JitsiMeetConferenceOptions.Builder()
.setServerURL(serverURL)
.build();
JitsiMeet.setDefaultConferenceOptions(defaultOptions);
}
现在在所需的位置调用此方法。示例onclick监听器
public void onVideoCall(String text) {
if (text.length() > 0) {
// Build options object for joining the conference. The SDK will merge the default
// one we set earlier and this one when joining.
JitsiMeetConferenceOptions options
= new JitsiMeetConferenceOptions.Builder()
.setRoom(text)
.setWelcomePageEnabled(false)
.build();
// Launch the new activity with the given options. The launch() method takes care
// of creating the required Intent and passing the options.
JitsiMeetActivity.launch(activity, options);
}
答案 1 :(得分:0)
我认为您忘记在 AndroidManifest.xml 中注册您的活动。您应该在 <application>
标签中注册您的活动,如下所示。
<activity
android:name=".YourActivity"/>