-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from chandarlee/v1.3.1
V1.3.1
- Loading branch information
Showing
44 changed files
with
1,543 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
SampleCode/Android/app/src/main/java/com/netease/meetinglib/demo/nim/NIMInitializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright (c) 2014-2020 NetEase, Inc. | ||
* All right reserved. | ||
*/ | ||
|
||
package com.netease.meetinglib.demo.nim; | ||
|
||
import android.content.Context; | ||
import android.util.Log; | ||
|
||
import com.netease.meetinglib.demo.utils.ProcessUtils; | ||
import com.netease.meetinglib.demo.utils.SPUtils; | ||
import com.netease.nimlib.sdk.NIMClient; | ||
import com.netease.nimlib.sdk.SDKOptions; | ||
|
||
import java.io.File; | ||
|
||
public class NIMInitializer { | ||
|
||
private static final String TAG = "NIMInitializer"; | ||
|
||
private static NIMInitializer sInstance; | ||
|
||
public synchronized static NIMInitializer getInstance() { | ||
if (sInstance == null) { | ||
sInstance = new NIMInitializer(); | ||
} | ||
return sInstance; | ||
} | ||
|
||
private NIMInitializer() {} | ||
|
||
//如果开启了NIM复用,则需要单独进行NIM的初始化 | ||
//正常情况下不需要单独手动进行初始化 | ||
public void startInitialize(Context context) { | ||
if (isReuseNIMEnabled()) { | ||
Log.i(TAG, "reuse nim is enabled"); | ||
SDKOptions sdkOptions = SDKOptions.DEFAULT; | ||
sdkOptions.disableAwake = true; | ||
sdkOptions.useAssetServerAddressConfig = SPUtils.getInstance().getBoolean("use-asset-server-config"); | ||
File externalFilesDir = context.getExternalFilesDir(null); | ||
sdkOptions.sdkStorageRootPath = externalFilesDir != null ? externalFilesDir.getAbsolutePath() : null; | ||
NIMClient.config(context, null, sdkOptions); | ||
if (ProcessUtils.isMainProcess(context)) { | ||
NIMClient.initSDK(); | ||
} | ||
} | ||
} | ||
|
||
public boolean isReuseNIMEnabled() { | ||
return SPUtils.getInstance().getBoolean("meeting-reuse-nim", false); | ||
} | ||
|
||
public void setReuseNIMEnabled(boolean enable) { | ||
SPUtils.getInstance().put("meeting-reuse-nim", enable); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.