来10分钟波比呀 来10分钟波比呀 发表于 2023-03-24 12:43
· IP属地北京
当出现出现异常的时候,不要直接关闭页面,这样开发者新新用户很蒙,不知到什么原因就关闭页面了.建议不要关闭页面,或者给用户异常原因,Toast,或者在页面显示出错误原因,不然要找半天才知道是原因才关闭页面
getActivity().onBackPressed();
try { RtcEngineConfig config = new RtcEngineConfig(); /** * The context of Android Activity */ config.mContext = context.getApplicationContext(); /** * The App ID issued to you by Agora. See <a href="https://docs.agora.io/en/Agora%20Platform/token#get-an-app-id"> How to get the App ID</a> */ config.mAppId = getString(R.string.agora_app_id); /** Sets the channel profile of the Agora RtcEngine. CHANNEL_PROFILE_COMMUNICATION(0): (Default) The Communication profile. Use this profile in one-on-one calls or group calls, where all users can talk freely. CHANNEL_PROFILE_LIVE_BROADCASTING(1): The Live-Broadcast profile. Users in a live-broadcast channel have a role as either broadcaster or audience. A broadcaster can both send and receive streams; an audience can only receive streams.*/ config.mChannelProfile = Constants.CHANNEL_PROFILE_LIVE_BROADCASTING; /** * IRtcEngineEventHandler is an abstract class providing default implementation. * The SDK uses this class to report to the app on SDK runtime evepnts. */ config.mEventHandler = iRtcEngineEventHandler; config.mAudioScenario = Constants.AudioScenario.getValue(Constants.AudioScenario.DEFAULT); config.mAreaCode = ((MainApplication)getActivity().getApplication()).getGlobalSettings().getAreaCode(); engine = RtcEngine.create(config); /** * This parameter is for reporting the usages of APIExample to agora background. * Generally, it is not necessary for you to set this parameter. */ engine.setParameters("{" + "\"rtc.report_app_scenario\":" + "{" + "\"appScenario\":" + 100 + "," + "\"serviceType\":" + 11 + "," + "\"appVersion\":\"" + RtcEngine.getSdkVersion() + "\"" + "}" + "}"); /* setting the local access point if the private cloud ip was set, otherwise the config will be invalid.*/ engine.setLocalAccessPoint(((MainApplication) getActivity().getApplication()).getGlobalSettings().getPrivateCloudConfig());}catch (Exception e) { e.printStackTrace(); getActivity().onBackPressed();}
hi 波比,你的建议已被采纳哦~