mirror of
https://gitee.com/farsunset/cim.git
synced 2025-06-17 15:45:24 +08:00
android sdk更新
适配targetSdkVersion 33
This commit is contained in:
parent
97fe0a2721
commit
046bfd8ade
29
.gitignore
vendored
29
.gitignore
vendored
@ -1,2 +1,27 @@
|
||||
target/
|
||||
app/build/
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
/target/
|
||||
/.idea/
|
||||
*.class
|
||||
*/local.properties
|
@ -181,7 +181,7 @@ https://www.yuque.com/yuanfangxiyang/ma4ytb/vvy3iz/edit#nnzKN
|
||||
<dependency>
|
||||
<groupId>com.farsunset</groupId>
|
||||
<artifactId>cim-server-sdk-netty</artifactId>
|
||||
<version>4.2.5</version>
|
||||
<version>4.2.6</version>
|
||||
</dependency>
|
||||
|
||||
```
|
||||
@ -189,5 +189,5 @@ https://www.yuque.com/yuanfangxiyang/ma4ytb/vvy3iz/edit#nnzKN
|
||||
android端sdk引用
|
||||
|
||||
```
|
||||
implementation "com.farsunset:cim-android-sdk:4.2.8"
|
||||
implementation "com.farsunset:cim-android-sdk:4.2.10"
|
||||
```
|
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.farsunset</groupId>
|
||||
<artifactId>cim-android-sdk</artifactId>
|
||||
<version>4.2.9</version>
|
||||
<version>4.2.10</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>${project.groupId}:${project.artifactId}</name>
|
||||
|
@ -22,21 +22,21 @@
|
||||
package com.farsunset.cim.sdk.android;
|
||||
|
||||
import android.net.NetworkInfo;
|
||||
import android.util.Log;
|
||||
import com.farsunset.cim.sdk.android.model.Message;
|
||||
import com.farsunset.cim.sdk.android.model.ReplyBody;
|
||||
import com.farsunset.cim.sdk.android.model.SentBody;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
/**
|
||||
* CIM 消息监听器管理
|
||||
*/
|
||||
public class CIMListenerManager {
|
||||
|
||||
private static final List<CIMEventListener> cimListeners = new CopyOnWriteArrayList<>();
|
||||
private static final List<CIMEventListener> cimListeners = new LinkedList<>();
|
||||
private static final ReceiveComparator comparator = new ReceiveComparator();
|
||||
|
||||
private CIMListenerManager() {
|
||||
@ -47,7 +47,7 @@ public class CIMListenerManager {
|
||||
|
||||
if (!cimListeners.contains(listener)) {
|
||||
cimListeners.add(listener);
|
||||
cimListeners.sort(comparator);
|
||||
Collections.sort(cimListeners,comparator);
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,32 +56,32 @@ public class CIMListenerManager {
|
||||
}
|
||||
|
||||
public static void notifyOnNetworkChanged(NetworkInfo info) {
|
||||
for (CIMEventListener cimListener : cimListeners) {
|
||||
for (CIMEventListener cimListener : getListeners()) {
|
||||
cimListener.onNetworkChanged(info);
|
||||
}
|
||||
}
|
||||
|
||||
public static void notifyOnConnectFinished(boolean hasAutoBind) {
|
||||
for (CIMEventListener cimListener : cimListeners) {
|
||||
for (CIMEventListener cimListener : getListeners()) {
|
||||
cimListener.onConnectFinished(hasAutoBind);
|
||||
}
|
||||
}
|
||||
|
||||
public static void notifyOnMessageReceived(Message message) {
|
||||
for (CIMEventListener cimListener : cimListeners) {
|
||||
for (CIMEventListener cimListener : getListeners()) {
|
||||
cimListener.onMessageReceived(message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void notifyOnConnectionClosed() {
|
||||
for (CIMEventListener cimListener : cimListeners) {
|
||||
for (CIMEventListener cimListener : getListeners()) {
|
||||
cimListener.onConnectionClosed();
|
||||
}
|
||||
}
|
||||
|
||||
public static void notifyOnConnectFailed() {
|
||||
|
||||
for (CIMEventListener cimListener : cimListeners) {
|
||||
for (CIMEventListener cimListener : getListeners()) {
|
||||
cimListener.onConnectFailed();
|
||||
}
|
||||
|
||||
@ -89,14 +89,14 @@ public class CIMListenerManager {
|
||||
|
||||
public static void notifyOnReplyReceived(ReplyBody body) {
|
||||
|
||||
for (CIMEventListener cimListener : cimListeners) {
|
||||
for (CIMEventListener cimListener : getListeners()) {
|
||||
cimListener.onReplyReceived(body);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void notifyOnSendFinished(SentBody body) {
|
||||
for (CIMEventListener cimListener : cimListeners) {
|
||||
for (CIMEventListener cimListener : getListeners()) {
|
||||
cimListener.onSendFinished(body);
|
||||
}
|
||||
}
|
||||
@ -105,10 +105,8 @@ public class CIMListenerManager {
|
||||
cimListeners.clear();
|
||||
}
|
||||
|
||||
public static void logListenersName() {
|
||||
for (CIMEventListener cimListener : cimListeners) {
|
||||
Log.i(CIMEventListener.class.getSimpleName(), "#######" + cimListener.getClass().getName() + "#######");
|
||||
}
|
||||
public static List<CIMEventListener> getListeners() {
|
||||
return new LinkedList<>(cimListeners);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -271,6 +271,7 @@ public class CIMPushService extends Service {
|
||||
channel.enableVibration(false);
|
||||
channel.setSound(null, null);
|
||||
notificationManager.createNotificationChannel(channel);
|
||||
}
|
||||
|
||||
Notification notification = makeNotification(TRANSIENT_NTC_CHANNEL_ID,0,CIMPushService.class.getSimpleName(),null);
|
||||
|
||||
@ -279,9 +280,6 @@ public class CIMPushService extends Service {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void createPersistNotification(String channelName ,String message,int icon) {
|
||||
|
||||
CIMCacheManager.putString(this,CIMCacheManager.KEY_NTC_CHANNEL_NAME,channelName);
|
||||
|
@ -1,23 +1,21 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
}
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion "29.0.3"
|
||||
compileSdkVersion 33
|
||||
buildToolsVersion '33.0.0'
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.farsunset.cim"
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 29
|
||||
targetSdkVersion 33
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
/*
|
||||
CIM服务器
|
||||
*/
|
||||
buildConfigField("String", "CIM_API_URL", '"http://192.168.31.245:8080"')
|
||||
buildConfigField("String", "CIM_SERVER_HOST", '"192.168.31.245"')
|
||||
buildConfigField("String", "CIM_API_URL", '"http://192.168.31.175:8080"')
|
||||
buildConfigField("String", "CIM_SERVER_HOST", '"192.168.31.175"')
|
||||
buildConfigField("Integer", "CIM_SERVER_PORT", '23456')
|
||||
}
|
||||
|
||||
@ -28,17 +26,17 @@ android {
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
sourceCompatibility = '1.8'
|
||||
targetCompatibility = '1.8'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "com.farsunset:cim-android-sdk:4.2.8"
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'com.google.android.material:material:1.2.1'
|
||||
implementation 'androidx.annotation:annotation:1.1.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
implementation "com.farsunset:cim-android-sdk:4.2.10"
|
||||
implementation 'androidx.appcompat:appcompat:1.6.0'
|
||||
implementation 'com.google.android.material:material:1.8.0'
|
||||
implementation 'androidx.annotation:annotation:1.3.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'com.google.protobuf:protobuf-lite:3.0.1'
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||
|
@ -17,7 +17,7 @@
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity
|
||||
android:name="com.farsunset.cim.activity.LoginActivity">
|
||||
android:name="com.farsunset.cim.activity.LoginActivity" android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
@ -32,7 +32,6 @@
|
||||
<!-- ****************************************CIM推送配置 begin*************************************** -->
|
||||
<service
|
||||
android:name="com.farsunset.cim.sdk.android.CIMPushService"
|
||||
android:process=":cimpush"
|
||||
android:exported="false"
|
||||
/>
|
||||
|
||||
@ -44,7 +43,7 @@
|
||||
|
||||
|
||||
<!--消息接受广播注册-->
|
||||
<receiver android:name="com.farsunset.cim.reveiver.CIMPushMessageReceiver">
|
||||
<receiver android:name="com.farsunset.cim.reveiver.CIMPushMessageReceiver" android:exported="false">
|
||||
<intent-filter android:priority="0x7fffffff">
|
||||
<!-- 网络变事件action targetVersion 24之前 -->
|
||||
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
|
||||
|
@ -1,24 +1,27 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
maven{ url'https://maven.aliyun.com/repository/central' }
|
||||
maven{ url'https://maven.aliyun.com/repository/google' }
|
||||
maven{ url'https://maven.aliyun.com/repository/public' }
|
||||
maven{ url'https://maven.aliyun.com/repository/gradle-plugin' }
|
||||
maven { url "https://jitpack.io" }
|
||||
}
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:4.1.2"
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
classpath 'com.android.tools.build:gradle:7.4.0'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
maven { url "https://jitpack.io" }
|
||||
maven{ url'https://maven.aliyun.com/repository/central' }
|
||||
maven{ url'https://maven.aliyun.com/repository/google' }
|
||||
maven{ url'https://maven.aliyun.com/repository/public' }
|
||||
maven{ url'https://maven.aliyun.com/repository/gradle-plugin' }
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
@ -17,3 +17,4 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
android.useAndroidX=true
|
||||
# Automatically convert third-party libraries to use AndroidX
|
||||
android.enableJetifier=true
|
||||
android.injected.testOnly=false
|
||||
|
@ -1,6 +1,6 @@
|
||||
#Mon Apr 26 20:11:13 CST 2021
|
||||
#Wed Feb 15 10:18:48 CST 2023
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
Loading…
x
Reference in New Issue
Block a user