imsdk_client_flutter 0.0.19 imsdk_client_flutter: ^0.0.19 copied to clipboard
Flutter client of Zhiyou real-time communication cloud service.
Flutter client of Zhiyou real-time communication cloud service.
Usage #
In main.dart
file:
import 'package:flutter/material.dart';
import 'package:imsdk_client_flutter/imsdk_client_flutter.dart';
void main() {
AppConfig.init(
agentFlag: 'ZhiYou',
host: 'http://192.168.2.6:8080',
bsid: '61da2b54285650ba5034ada4',
secret: '1234567890',
logLevel: EasyLogLevel.debug,
notificationsEnable: true,
onInited: (uid, token) {
runApp(AppRouter(title: 'IMSDK', uid: uid, token: token));
},
);
}
Base Setup #
If you set AppConfig.init(...notificationsEnable: true...)
, please look here: https://pub.dev/packages/flutter_local_notifications
ios #
Set platform :ios, '10.0'
in your .../Podfile
file.
Set IPHONEOS_DEPLOYMENT_TARGET = 10.0;
in your .../project.pbxproj
file at every matched line.
android #
Set minSdkVersion 21
in your .../build.gradle
file.
Add android.permission.INTERNET
permission in your .../AndroidManifest.xml
file like this:
<uses-permission android:name="android.permission.INTERNET"/>
If you wish to connect to non-HTTPS URLS, also add the following attribute to the application element:
<application ... android:usesCleartextTraffic="true"... />
macos #
Set platform :osx, '10.15'
in your .../Podfile
file.
Set MACOSX_DEPLOYMENT_TARGET = 10.15;
in your .../project.pbxproj
file at every matched line.
Add com.apple.security.network.client
permission in your .../DebugProfile.entitlements
file like this:
<key>com.apple.security.network.client</key>
<true/>
Login Setup #
ios #
If you need sign in with apple
function, please look here: https://pub.dev/packages/sign_in_with_apple
android #
If you need sign in with wechat
function, please look here: https://pub.dev/packages/wechat_kit
May need add tag to your .../AndroidManifest.xml
file like this:
<manifest ...>
...
<queries>
<package android:name="com.tencent.mm" />
</queries>
...
</manifest>
macos #
If you need sign in with apple
function, please look here: https://pub.dev/packages/sign_in_with_apple
Permissions Setup #
Internal permissions used permission_handler
, you can look here: https://pub.dev/packages/permission_handler
ios #
Open your .../Info.plist
file.
For real-time video call and voice call and image picker and qrcode scan, please add:
<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) Camera Usage!</string>
<key>NSMicrophoneUsageDescription</key>
<string>$(PRODUCT_NAME) Microphone Usage!</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>$(PRODUCT_NAME) PhotoLibrary Usage!</string>
android #
Open your .../AndroidManifest.xml
file.
For real-time video call and voice call and image picker and qrcode scan, please add:
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
If you need to use a Bluetooth device, please add:
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
If you want app keep running in the background, first set AppConfig.init(...androidKeepAliveEnable: true...)
, then add:
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
macos #
Open your .../DebugProfile.entitlements
file.
For real-time video call and voice call and image picker and qrcode scan, please add:
<!-- May need add "com.apple.security.device.audio-input" permission-->
<!-- <key>com.apple.security.device.audio-input</key> -->
<!-- <true/> -->
<key>com.apple.security.device.camera</key>
<true/>
web #
For qrcode scanner, add this to .../index.html
:
<script src="https://cdn.jsdelivr.net/npm/jsqr@1.4.0/dist/jsQR.min.js"></script>
Amap view and location and navigation Setup #
In main.dart
file like this:
void main() {
AppConfig.init(
...
amapAndroidKey: '...',
amapIosKey: '...',
amapWebKey: '...',
...
);
}
for amap and location setup you can look these: https://pub.dev/packages/amap_flutter_map and https://pub.dev/packages/amap_flutter_location
for outer map navigation setup you can look here: https://pub.dev/packages/map_launcher