mirror of
https://gitee.com/farsunset/cim.git
synced 2025-07-23 16:26:42 +08:00
1 修改SDK中偶然出现sqlite锁库的问题
2 修改sendbody传null值 导致异常死循环的问题
This commit is contained in:
parent
b3b446acdc
commit
85c014ce69
@ -1,7 +1,7 @@
|
||||
#说明:
|
||||
此开源版本为基础功能版本,只有消息推送的基础功能!netty版本,和mina版本结构和功能完全一致,大家可以选择自己喜欢的或者合适的版本学习或者使用!
|
||||
|
||||
#侣信专业版2.2.0版本发布
|
||||
#侣信专业版2.2.3版本发布
|
||||
#[http://farsunset.com](http://farsunset.com)
|
||||
|
||||
|
||||
|
@ -3,8 +3,8 @@
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="libs/log4j-1.2.17.jar"/>
|
||||
<classpathentry kind="lib" path="D:/Program Files (x86)/dev/android-sdk-windos/platforms/android-21/android.jar"/>
|
||||
<classpathentry kind="lib" path="libs/mina-core-2.0.16.jar"/>
|
||||
<classpathentry kind="lib" path="libs/protobuf-java-3.2.0.jar"/>
|
||||
<classpathentry kind="lib" path="D:/devtools/dev/android-sdk-windows/platforms/android-21/android.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
@ -0,0 +1,109 @@
|
||||
/**
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
***************************************************************************************
|
||||
* *
|
||||
* Website : http://www.farsunset.com *
|
||||
* *
|
||||
***************************************************************************************
|
||||
*/
|
||||
package com.farsunset.cim.sdk.android;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
class CIMCacheManager {
|
||||
|
||||
|
||||
public static final String CIM_CONFIG_INFO = "CIM_CONFIG_INFO";
|
||||
|
||||
public static final String KEY_ACCOUNT = "KEY_ACCOUNT";
|
||||
|
||||
public static final String KEY_MANUAL_STOP = "KEY_MANUAL_STOP";
|
||||
|
||||
public static final String KEY_CIM_DESTROYED = "KEY_CIM_DESTROYED";
|
||||
|
||||
public static final String KEY_CIM_SERVIER_HOST = "KEY_CIM_SERVIER_HOST";
|
||||
|
||||
public static final String KEY_CIM_SERVIER_PORT = "KEY_CIM_SERVIER_PORT";
|
||||
|
||||
public static final String KEY_CIM_CONNECTION_STATE = "KEY_CIM_CONNECTION_STATE";
|
||||
|
||||
|
||||
public static void remove(Context context ,String key)
|
||||
{
|
||||
ContentResolver resolver = context.getContentResolver();
|
||||
resolver.delete(Uri.parse(CIMCacheProvider.CONTENT_URI), key, null);
|
||||
}
|
||||
|
||||
|
||||
public static void putString(Context context ,String key,String value)
|
||||
{
|
||||
|
||||
ContentResolver resolver = context.getContentResolver();
|
||||
ContentValues values = new ContentValues();
|
||||
values.put("value", value);
|
||||
values.put("key", key);
|
||||
resolver.insert(Uri.parse(CIMCacheProvider.CONTENT_URI), values);
|
||||
|
||||
}
|
||||
|
||||
public static String getString(Context context ,String key)
|
||||
{
|
||||
String value = null;
|
||||
ContentResolver resolver = context.getContentResolver();
|
||||
Cursor cursor = resolver.query(Uri.parse(CIMCacheProvider.CONTENT_URI), new String[]{key}, null,null,null);
|
||||
if (cursor!=null && cursor.moveToFirst())
|
||||
{
|
||||
value = cursor.getString(0);
|
||||
cursor.close();
|
||||
}
|
||||
closeQuietly(cursor);
|
||||
return value;
|
||||
}
|
||||
|
||||
private static void closeQuietly(Cursor cursor){
|
||||
try{
|
||||
if(cursor!=null)
|
||||
cursor.close();
|
||||
}catch(Exception e){}
|
||||
}
|
||||
|
||||
public static void putBoolean(Context context,String key,boolean value)
|
||||
{
|
||||
putString(context,key,Boolean.toString(value));
|
||||
}
|
||||
|
||||
public static boolean getBoolean(Context context,String key)
|
||||
{
|
||||
String value = getString(context,key);
|
||||
return value == null?false:Boolean.parseBoolean(value);
|
||||
}
|
||||
|
||||
|
||||
public static void putInt(Context context,String key,int value)
|
||||
{
|
||||
putString(context,key, String.valueOf(value));
|
||||
}
|
||||
|
||||
public static int getInt(Context context,String key)
|
||||
{
|
||||
String value = getString(context,key);
|
||||
return value == null?0:Integer.parseInt(value);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
/**
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
***************************************************************************************
|
||||
* *
|
||||
* Website : http://www.farsunset.com *
|
||||
* *
|
||||
***************************************************************************************
|
||||
*/
|
||||
package com.farsunset.cim.sdk.android;
|
||||
|
||||
import android.content.ContentProvider;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.MatrixCursor;
|
||||
import android.net.Uri;
|
||||
|
||||
public class CIMCacheProvider extends ContentProvider {
|
||||
public static final String CONTENT_URI="content://com.farsunset.cim.provider";
|
||||
static final String MODEL_KEY = "PRIVATE_CIM_CONFIG";
|
||||
|
||||
|
||||
@Override
|
||||
public int delete(Uri arg0, String key, String[] arg2) {
|
||||
getContext().getSharedPreferences(MODEL_KEY, Context.MODE_PRIVATE).edit().remove(key).apply();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType(Uri arg0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Uri insert(Uri arg0, ContentValues values) {
|
||||
String key = values.getAsString("key");
|
||||
String value = values.getAsString("value");
|
||||
getContext().getSharedPreferences(MODEL_KEY, Context.MODE_PRIVATE).edit().putString(key, value).apply();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreate() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cursor query(Uri arg0, String[] arg1, String key, String[] arg3, String arg4) {
|
||||
MatrixCursor cursor = new MatrixCursor(new String[]{"value"});
|
||||
String value = getContext().getSharedPreferences(MODEL_KEY, Context.MODE_PRIVATE).getString(arg1[0], null);
|
||||
cursor.addRow(new Object[]{value});
|
||||
return cursor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(Uri arg0, ContentValues arg1, String arg2, String[] arg3) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,170 +0,0 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
***************************************************************************************
|
||||
* *
|
||||
* Website : http://www.farsunset.com *
|
||||
* *
|
||||
***************************************************************************************
|
||||
*/
|
||||
package com.farsunset.cim.sdk.android;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
|
||||
class CIMCacheToolkit extends SQLiteOpenHelper {
|
||||
|
||||
private static final String DATABASE_NAME = "CIM_CONFIG_INFO.db";
|
||||
private static final int DATABASE_VERSION = 20160406;
|
||||
private static final String TABLE_NAME = "T_CIM_CONFIG";
|
||||
private static CIMCacheToolkit toolkit;
|
||||
|
||||
private static final String TABLE_SQL = "CREATE TABLE IF NOT EXISTS "+TABLE_NAME+" (KEY VARCHAR(64) PRIMARY KEY,VALUE TEXT)";
|
||||
|
||||
private static final String DELETE_SQL = "DELETE FROM "+TABLE_NAME+" WHERE KEY = ?";
|
||||
|
||||
private static final String QUERY_SQL = "SELECT VALUE FROM "+TABLE_NAME+" WHERE KEY = ?";
|
||||
|
||||
private SQLiteDatabase mSQLiteDatabase;
|
||||
|
||||
public static final String CIM_CONFIG_INFO = "CIM_CONFIG_INFO";
|
||||
|
||||
public static final String KEY_ACCOUNT = "KEY_ACCOUNT";
|
||||
|
||||
public static final String KEY_MANUAL_STOP = "KEY_MANUAL_STOP";
|
||||
|
||||
public static final String KEY_CIM_DESTROYED = "KEY_CIM_DESTROYED";
|
||||
|
||||
public static final String KEY_CIM_SERVIER_HOST = "KEY_CIM_SERVIER_HOST";
|
||||
|
||||
public static final String KEY_CIM_SERVIER_PORT = "KEY_CIM_SERVIER_PORT";
|
||||
|
||||
public static final String KEY_CIM_CONNECTION_STATE = "KEY_CIM_CONNECTION_STATE";
|
||||
|
||||
|
||||
public synchronized static CIMCacheToolkit getInstance(Context context){
|
||||
|
||||
if(toolkit==null){
|
||||
toolkit = new CIMCacheToolkit(context);
|
||||
}
|
||||
|
||||
return toolkit;
|
||||
}
|
||||
|
||||
|
||||
public CIMCacheToolkit(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
|
||||
super(context, name, factory, version);
|
||||
}
|
||||
|
||||
public CIMCacheToolkit(Context context){
|
||||
this(context, DATABASE_NAME,null, DATABASE_VERSION);
|
||||
}
|
||||
|
||||
|
||||
public synchronized void remove(String key)
|
||||
{
|
||||
getSQLiteDatabase().execSQL(DELETE_SQL,new String[]{key});
|
||||
}
|
||||
|
||||
|
||||
public synchronized void putString(String key,String value)
|
||||
{
|
||||
|
||||
ContentValues values = new ContentValues();
|
||||
values.put("VALUE", value);
|
||||
int result = getSQLiteDatabase().updateWithOnConflict(TABLE_NAME, values, "KEY=?",new String[]{key},SQLiteDatabase.CONFLICT_FAIL);
|
||||
if(result<=0){
|
||||
|
||||
values.put("KEY", key);
|
||||
getSQLiteDatabase().insert(TABLE_NAME, null, values);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public synchronized String getString(String key)
|
||||
{
|
||||
String value = null;
|
||||
Cursor cursor = getSQLiteDatabase().rawQuery(QUERY_SQL, new String[]{key});
|
||||
if (cursor!=null)
|
||||
{
|
||||
if(cursor.moveToFirst()){
|
||||
value = cursor.getString(0);
|
||||
}
|
||||
|
||||
cursor.close();
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public void putBoolean(String key,boolean value)
|
||||
{
|
||||
putString(key,Boolean.toString(value));
|
||||
}
|
||||
|
||||
public boolean getBoolean(String key)
|
||||
{
|
||||
String value = getString(key);
|
||||
return value == null?false:Boolean.parseBoolean(value);
|
||||
}
|
||||
|
||||
|
||||
public void putInt(String key,int value)
|
||||
{
|
||||
putString(key, String.valueOf(value));
|
||||
}
|
||||
|
||||
public int getInt(String key)
|
||||
{
|
||||
String value = getString(key);
|
||||
return value == null?0:Integer.parseInt(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(SQLiteDatabase database) {
|
||||
database.execSQL(TABLE_SQL);
|
||||
}
|
||||
|
||||
|
||||
public static synchronized void destroy(){
|
||||
if (toolkit!=null){
|
||||
try{toolkit.mSQLiteDatabase.close();}catch(Exception e){}
|
||||
try{toolkit.close();}catch(Exception e){}
|
||||
}
|
||||
|
||||
toolkit = null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private SQLiteDatabase getSQLiteDatabase(){
|
||||
if(mSQLiteDatabase!=null){
|
||||
return mSQLiteDatabase;
|
||||
}else
|
||||
{
|
||||
mSQLiteDatabase = getWritableDatabase();
|
||||
}
|
||||
return mSQLiteDatabase;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) {
|
||||
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -20,7 +20,6 @@
|
||||
***************************************************************************************
|
||||
*/
|
||||
package com.farsunset.cim.sdk.android;
|
||||
import java.io.Serializable;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
@ -44,8 +43,8 @@ import android.net.NetworkInfo;
|
||||
import android.util.Log;
|
||||
|
||||
import com.farsunset.cim.sdk.android.constant.CIMConstant;
|
||||
import com.farsunset.cim.sdk.android.exception.SessionDisconnectedException;
|
||||
import com.farsunset.cim.sdk.android.exception.NetworkDisconnectedException;
|
||||
import com.farsunset.cim.sdk.android.exception.SessionClosedException;
|
||||
import com.farsunset.cim.sdk.android.exception.NetworkDisabledException;
|
||||
import com.farsunset.cim.sdk.android.filter.ClientMessageCodecFactory;
|
||||
import com.farsunset.cim.sdk.android.model.HeartbeatRequest;
|
||||
import com.farsunset.cim.sdk.android.model.HeartbeatResponse;
|
||||
@ -66,7 +65,7 @@ class CIMConnectorManager extends IoHandlerAdapter implements KeepAliveMessageF
|
||||
private final int WRITE_TIMEOUT = 10 * 1000;//秒
|
||||
|
||||
private final int READ_IDLE_TIME = 120;//秒
|
||||
private final int HEARBEAT_TIME_OUT = (READ_IDLE_TIME + 20) * 1000;// 收到服务端心跳请求超时时间 毫秒
|
||||
private final int HEARBEAT_TIME_OUT = (READ_IDLE_TIME + 10) * 1000;// 收到服务端心跳请求超时时间 毫秒
|
||||
private final String KEY_LAST_HEART_TIME = "KEY_LAST_HEART_TIME" ;
|
||||
|
||||
private NioSocketConnector connector;
|
||||
@ -117,7 +116,7 @@ class CIMConnectorManager extends IoHandlerAdapter implements KeepAliveMessageF
|
||||
|
||||
Log.i(TAG, "****************CIM正在连接服务器 "+host+":"+port+"......");
|
||||
|
||||
CIMCacheToolkit.getInstance(context).putBoolean(CIMCacheToolkit.KEY_CIM_CONNECTION_STATE, false);
|
||||
CIMCacheManager.putBoolean(context,CIMCacheManager.KEY_CIM_CONNECTION_STATE, false);
|
||||
InetSocketAddress remoteSocketAddress = new InetSocketAddress(host, port);
|
||||
connectFuture = connector.connect(remoteSocketAddress);
|
||||
connectFuture.awaitUninterruptibly();
|
||||
@ -128,7 +127,7 @@ class CIMConnectorManager extends IoHandlerAdapter implements KeepAliveMessageF
|
||||
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(CIMConstant.IntentAction.ACTION_CONNECTION_FAILED);
|
||||
intent.putExtra(Exception.class.getName(), e);
|
||||
intent.putExtra(Exception.class.getName(), e.getClass().getSimpleName());
|
||||
intent.putExtra("interval", interval);
|
||||
context.sendBroadcast(intent);
|
||||
|
||||
@ -144,7 +143,7 @@ class CIMConnectorManager extends IoHandlerAdapter implements KeepAliveMessageF
|
||||
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(CIMConstant.IntentAction.ACTION_CONNECTION_FAILED);
|
||||
intent.putExtra(Exception.class.getName(), new NetworkDisconnectedException());
|
||||
intent.putExtra(Exception.class.getName(),NetworkDisabledException.class.getSimpleName());
|
||||
context.sendBroadcast(intent);
|
||||
|
||||
return;
|
||||
@ -163,7 +162,7 @@ class CIMConnectorManager extends IoHandlerAdapter implements KeepAliveMessageF
|
||||
|
||||
boolean isSuccessed = false;
|
||||
|
||||
Throwable exception = new SessionDisconnectedException();
|
||||
String exceptionName =SessionClosedException.class.getSimpleName();
|
||||
|
||||
IoSession session = getCurrentSession();
|
||||
if(session!=null && session.isConnected())
|
||||
@ -172,18 +171,16 @@ class CIMConnectorManager extends IoHandlerAdapter implements KeepAliveMessageF
|
||||
// 消息发送超时 5秒
|
||||
wf.awaitUninterruptibly(WRITE_TIMEOUT);
|
||||
isSuccessed = wf.isWritten();
|
||||
|
||||
if(wf.getException() instanceof Serializable)
|
||||
if(wf.getException() != null)
|
||||
{
|
||||
exception = wf.getException();
|
||||
exceptionName =wf.getException().getClass().getSimpleName();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!isSuccessed){
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(CIMConstant.IntentAction.ACTION_SENT_FAILED);
|
||||
intent.putExtra(Exception.class.getName(),exception);
|
||||
intent.putExtra(Exception.class.getName(),exceptionName);
|
||||
intent.putExtra(SentBody.class.getName(), body);
|
||||
context.sendBroadcast(intent);
|
||||
}
|
||||
@ -200,9 +197,6 @@ class CIMConnectorManager extends IoHandlerAdapter implements KeepAliveMessageF
|
||||
connector.dispose();
|
||||
}
|
||||
|
||||
|
||||
CIMCacheToolkit.destroy();
|
||||
|
||||
manager = null;
|
||||
}
|
||||
|
||||
@ -286,11 +280,6 @@ class CIMConnectorManager extends IoHandlerAdapter implements KeepAliveMessageF
|
||||
if(cause!=null && cause.getMessage()!=null){
|
||||
Log.e(TAG, cause.getMessage());
|
||||
}
|
||||
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(CIMConstant.IntentAction.ACTION_UNCAUGHT_EXCEPTION);
|
||||
intent.putExtra(Exception.class.getName(), cause);
|
||||
context.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -22,9 +22,8 @@
|
||||
package com.farsunset.cim.sdk.android;
|
||||
|
||||
|
||||
|
||||
import com.farsunset.cim.sdk.android.constant.CIMConstant;
|
||||
import com.farsunset.cim.sdk.android.exception.SessionDisconnectedException;
|
||||
import com.farsunset.cim.sdk.android.exception.SessionClosedException;
|
||||
import com.farsunset.cim.sdk.android.model.Message;
|
||||
import com.farsunset.cim.sdk.android.model.ReplyBody;
|
||||
import com.farsunset.cim.sdk.android.model.SentBody;
|
||||
@ -55,7 +54,6 @@ public abstract class CIMEventBroadcastReceiver extends BroadcastReceiver{
|
||||
{
|
||||
startPushService();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 设备网络状态变化事件
|
||||
@ -80,7 +78,8 @@ public abstract class CIMEventBroadcastReceiver extends BroadcastReceiver{
|
||||
if(intent.getAction().equals(CIMConstant.IntentAction.ACTION_CONNECTION_FAILED))
|
||||
{
|
||||
long interval = intent.getLongExtra("interval", CIMConstant.RECONN_INTERVAL_TIME);
|
||||
onConnectionFailed((Exception) intent.getSerializableExtra(Exception.class.getName()),interval);
|
||||
String exceptionName = intent.getStringExtra(Exception.class.getName());
|
||||
onConnectionFailed(exceptionName,interval);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -114,9 +113,9 @@ public abstract class CIMEventBroadcastReceiver extends BroadcastReceiver{
|
||||
*/
|
||||
if(intent.getAction().equals(CIMConstant.IntentAction.ACTION_SENT_FAILED))
|
||||
{
|
||||
Exception exception = (Exception) intent.getSerializableExtra(Exception.class.getName());
|
||||
String exceptionName = intent.getStringExtra(Exception.class.getName());
|
||||
SentBody sentBody = (SentBody)intent.getSerializableExtra(SentBody.class.getName());
|
||||
onSentFailed(exception,sentBody);
|
||||
onSentFailed(exceptionName,sentBody);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -128,15 +127,7 @@ public abstract class CIMEventBroadcastReceiver extends BroadcastReceiver{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 获取cim数据传输异常事件
|
||||
*/
|
||||
if(intent.getAction().equals(CIMConstant.IntentAction.ACTION_UNCAUGHT_EXCEPTION))
|
||||
{
|
||||
onUncaughtException((Exception)intent.getSerializableExtra(Exception.class.getName()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 重新连接,如果断开的话
|
||||
*/
|
||||
@ -153,7 +144,7 @@ public abstract class CIMEventBroadcastReceiver extends BroadcastReceiver{
|
||||
}
|
||||
|
||||
private void onInnerConnectionClosed(){
|
||||
CIMCacheToolkit.getInstance(context).putBoolean(CIMCacheToolkit.KEY_CIM_CONNECTION_STATE, false);
|
||||
CIMCacheManager.putBoolean(context,CIMCacheManager.KEY_CIM_CONNECTION_STATE, false);
|
||||
if(CIMConnectorManager.isNetworkConnected(context))
|
||||
{
|
||||
CIMPushManager.connect(context,0);
|
||||
@ -162,7 +153,7 @@ public abstract class CIMEventBroadcastReceiver extends BroadcastReceiver{
|
||||
onConnectionClosed();
|
||||
}
|
||||
|
||||
private void onConnectionFailed(Exception e,long reinterval){
|
||||
private void onConnectionFailed(String exceptionName,long reinterval){
|
||||
|
||||
if(CIMConnectorManager.isNetworkConnected(context))
|
||||
{
|
||||
@ -173,14 +164,12 @@ public abstract class CIMEventBroadcastReceiver extends BroadcastReceiver{
|
||||
}
|
||||
|
||||
private void onInnerConnectionSuccessed(){
|
||||
CIMCacheToolkit.getInstance(context).putBoolean(CIMCacheToolkit.KEY_CIM_CONNECTION_STATE, true);
|
||||
CIMCacheManager.putBoolean(context,CIMCacheManager.KEY_CIM_CONNECTION_STATE, true);
|
||||
|
||||
boolean autoBind = CIMPushManager.autoBindAccount(context);
|
||||
onConnectionSuccessed(autoBind);
|
||||
}
|
||||
|
||||
private void onUncaughtException(Throwable arg0) {}
|
||||
|
||||
private void onDevicesNetworkChanged(NetworkInfo info) {
|
||||
|
||||
if(info !=null)
|
||||
@ -202,13 +191,13 @@ public abstract class CIMEventBroadcastReceiver extends BroadcastReceiver{
|
||||
|
||||
private boolean isForceOfflineMessage(String action)
|
||||
{
|
||||
return CIMConstant.MessageAction.ACTION_999.equals(action) || CIMConstant.MessageAction.ACTION_444.equals(action);
|
||||
return CIMConstant.MessageAction.ACTION_999.equals(action);
|
||||
}
|
||||
|
||||
private void onSentFailed(Exception e, SentBody body){
|
||||
private void onSentFailed(String exceptionName, SentBody body){
|
||||
|
||||
//与服务端端开链接,重新连接
|
||||
if(e instanceof SessionDisconnectedException)
|
||||
if(SessionClosedException.class.getSimpleName().equals(exceptionName))
|
||||
{
|
||||
CIMPushManager.connect(context,0);
|
||||
}else
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -48,6 +48,7 @@ public class CIMPushManager {
|
||||
|
||||
static String KEY_SEND_BODY ="KEY_SEND_BODY";
|
||||
|
||||
static String KEY_CIM_CONNECTION_STATUS ="KEY_CIM_CONNECTION_STATUS";
|
||||
|
||||
/**
|
||||
* 初始化,连接服务端,在程序启动页或者 在Application里调用
|
||||
@ -63,20 +64,20 @@ public class CIMPushManager {
|
||||
|
||||
private static void connect(Context context,String ip,int port,boolean autoBind,long delayedTime){
|
||||
|
||||
CIMCacheToolkit.getInstance(context).putBoolean(CIMCacheToolkit.KEY_CIM_DESTROYED, false);
|
||||
CIMCacheToolkit.getInstance(context).putBoolean(CIMCacheToolkit.KEY_MANUAL_STOP, false);
|
||||
CIMCacheManager.putBoolean(context,CIMCacheManager.KEY_CIM_DESTROYED, false);
|
||||
CIMCacheManager.putBoolean(context,CIMCacheManager.KEY_MANUAL_STOP, false);
|
||||
|
||||
CIMCacheToolkit.getInstance(context).putString( CIMCacheToolkit.KEY_CIM_SERVIER_HOST, ip);
|
||||
CIMCacheToolkit.getInstance(context).putInt( CIMCacheToolkit.KEY_CIM_SERVIER_PORT, port);
|
||||
CIMCacheManager.putString(context, CIMCacheManager.KEY_CIM_SERVIER_HOST, ip);
|
||||
CIMCacheManager.putInt(context, CIMCacheManager.KEY_CIM_SERVIER_PORT, port);
|
||||
|
||||
if(!autoBind)
|
||||
{
|
||||
CIMCacheToolkit.getInstance(context).remove(CIMCacheToolkit.KEY_ACCOUNT);
|
||||
CIMCacheManager.remove(context,CIMCacheManager.KEY_ACCOUNT);
|
||||
}
|
||||
|
||||
Intent serviceIntent = new Intent(context, CIMPushService.class);
|
||||
serviceIntent.putExtra(CIMCacheToolkit.KEY_CIM_SERVIER_HOST, ip);
|
||||
serviceIntent.putExtra(CIMCacheToolkit.KEY_CIM_SERVIER_PORT, port);
|
||||
serviceIntent.putExtra(CIMCacheManager.KEY_CIM_SERVIER_HOST, ip);
|
||||
serviceIntent.putExtra(CIMCacheManager.KEY_CIM_SERVIER_PORT, port);
|
||||
serviceIntent.putExtra(CIMPushService.KEY_DELAYED_TIME, delayedTime);
|
||||
serviceIntent.setAction(ACTION_CREATE_CIM_CONNECTION);
|
||||
context.startService(serviceIntent);
|
||||
@ -85,16 +86,16 @@ public class CIMPushManager {
|
||||
|
||||
protected static void connect(Context context,long delayedTime){
|
||||
|
||||
boolean isManualStop = CIMCacheToolkit.getInstance(context).getBoolean(CIMCacheToolkit.KEY_MANUAL_STOP);
|
||||
boolean isManualDestory = CIMCacheToolkit.getInstance(context).getBoolean(CIMCacheToolkit.KEY_CIM_DESTROYED);
|
||||
boolean isManualStop = CIMCacheManager.getBoolean(context,CIMCacheManager.KEY_MANUAL_STOP);
|
||||
boolean isManualDestory = CIMCacheManager.getBoolean(context,CIMCacheManager.KEY_CIM_DESTROYED);
|
||||
|
||||
if(isManualStop || isManualDestory)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
String host = CIMCacheToolkit.getInstance(context).getString( CIMCacheToolkit.KEY_CIM_SERVIER_HOST);
|
||||
int port =CIMCacheToolkit.getInstance(context).getInt( CIMCacheToolkit.KEY_CIM_SERVIER_PORT);
|
||||
String host = CIMCacheManager.getString(context, CIMCacheManager.KEY_CIM_SERVIER_HOST);
|
||||
int port =CIMCacheManager.getInt(context, CIMCacheManager.KEY_CIM_SERVIER_PORT);
|
||||
|
||||
connect(context,host,port,true,delayedTime);
|
||||
|
||||
@ -108,7 +109,7 @@ public class CIMPushManager {
|
||||
public static void bindAccount(Context context,String account){
|
||||
|
||||
|
||||
boolean isManualDestory = CIMCacheToolkit.getInstance(context).getBoolean(CIMCacheToolkit.KEY_CIM_DESTROYED);
|
||||
boolean isManualDestory = CIMCacheManager.getBoolean(context,CIMCacheManager.KEY_CIM_DESTROYED);
|
||||
if(isManualDestory || account==null || account.trim().length()==0)
|
||||
{
|
||||
return ;
|
||||
@ -121,8 +122,8 @@ public class CIMPushManager {
|
||||
|
||||
private static void sendBindRequest(Context context, String account){
|
||||
|
||||
CIMCacheToolkit.getInstance(context).putBoolean(CIMCacheToolkit.KEY_MANUAL_STOP, false);
|
||||
CIMCacheToolkit.getInstance(context).putString(CIMCacheToolkit.KEY_ACCOUNT, account);
|
||||
CIMCacheManager.putBoolean(context,CIMCacheManager.KEY_MANUAL_STOP, false);
|
||||
CIMCacheManager.putString(context,CIMCacheManager.KEY_ACCOUNT, account);
|
||||
|
||||
String imei = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId();
|
||||
imei += context.getPackageName();
|
||||
@ -140,8 +141,8 @@ public class CIMPushManager {
|
||||
|
||||
protected static boolean autoBindAccount(Context context){
|
||||
|
||||
String account = CIMCacheToolkit.getInstance(context).getString(CIMCacheToolkit.KEY_ACCOUNT);
|
||||
boolean isManualDestory = CIMCacheToolkit.getInstance(context).getBoolean(CIMCacheToolkit.KEY_CIM_DESTROYED);
|
||||
String account = CIMCacheManager.getString(context,CIMCacheManager.KEY_ACCOUNT);
|
||||
boolean isManualDestory = CIMCacheManager.getBoolean(context,CIMCacheManager.KEY_CIM_DESTROYED);
|
||||
if( account==null || account.trim().length()==0 || isManualDestory )
|
||||
{
|
||||
return false;
|
||||
@ -161,8 +162,8 @@ public class CIMPushManager {
|
||||
*/
|
||||
public static void sendRequest(Context context, SentBody body){
|
||||
|
||||
boolean isManualStop = CIMCacheToolkit.getInstance(context).getBoolean(CIMCacheToolkit.KEY_MANUAL_STOP);
|
||||
boolean isManualDestory = CIMCacheToolkit.getInstance(context).getBoolean(CIMCacheToolkit.KEY_CIM_DESTROYED);
|
||||
boolean isManualStop = CIMCacheManager.getBoolean(context,CIMCacheManager.KEY_MANUAL_STOP);
|
||||
boolean isManualDestory = CIMCacheManager.getBoolean(context,CIMCacheManager.KEY_CIM_DESTROYED);
|
||||
|
||||
if(isManualStop || isManualDestory)
|
||||
{
|
||||
@ -182,12 +183,12 @@ public class CIMPushManager {
|
||||
*/
|
||||
public static void stop(Context context){
|
||||
|
||||
boolean isManualDestory = CIMCacheToolkit.getInstance(context).getBoolean(CIMCacheToolkit.KEY_CIM_DESTROYED);
|
||||
boolean isManualDestory = CIMCacheManager.getBoolean(context,CIMCacheManager.KEY_CIM_DESTROYED);
|
||||
if(isManualDestory){
|
||||
return ;
|
||||
}
|
||||
|
||||
CIMCacheToolkit.getInstance(context).putBoolean(CIMCacheToolkit.KEY_MANUAL_STOP, true);
|
||||
CIMCacheManager.putBoolean(context,CIMCacheManager.KEY_MANUAL_STOP, true);
|
||||
|
||||
Intent serviceIntent = new Intent(context, CIMPushService.class);
|
||||
serviceIntent.setAction(ACTION_CLOSE_CIM_CONNECTION);
|
||||
@ -203,8 +204,8 @@ public class CIMPushManager {
|
||||
public static void destroy(Context context){
|
||||
|
||||
|
||||
CIMCacheToolkit.getInstance(context).putBoolean(CIMCacheToolkit.KEY_CIM_DESTROYED, true);
|
||||
CIMCacheToolkit.getInstance(context).putString(CIMCacheToolkit.KEY_ACCOUNT, null);
|
||||
CIMCacheManager.putBoolean(context,CIMCacheManager.KEY_CIM_DESTROYED, true);
|
||||
CIMCacheManager.putString(context,CIMCacheManager.KEY_ACCOUNT, null);
|
||||
|
||||
Intent serviceIntent = new Intent(context, CIMPushService.class);
|
||||
serviceIntent.setAction(ACTION_DESTORY);
|
||||
@ -219,7 +220,7 @@ public class CIMPushManager {
|
||||
*/
|
||||
public static void resume(Context context){
|
||||
|
||||
boolean isManualDestory = CIMCacheToolkit.getInstance(context).getBoolean(CIMCacheToolkit.KEY_CIM_DESTROYED);
|
||||
boolean isManualDestory = CIMCacheManager.getBoolean(context,CIMCacheManager.KEY_CIM_DESTROYED);
|
||||
if(isManualDestory){
|
||||
return ;
|
||||
}
|
||||
@ -228,7 +229,7 @@ public class CIMPushManager {
|
||||
}
|
||||
|
||||
public static boolean isConnected(Context context){
|
||||
return CIMCacheToolkit.getInstance(context).getBoolean(CIMCacheToolkit.KEY_CIM_CONNECTION_STATE);
|
||||
return CIMCacheManager.getBoolean(context,CIMCacheManager.KEY_CIM_CONNECTION_STATE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -51,8 +51,8 @@ import com.farsunset.cim.sdk.android.model.SentBody;
|
||||
|
||||
connectionHandler.removeMessages(0);
|
||||
|
||||
String host = message.getData().getString(CIMCacheToolkit.KEY_CIM_SERVIER_HOST);
|
||||
int port = message.getData().getInt(CIMCacheToolkit.KEY_CIM_SERVIER_PORT,0);
|
||||
String host = message.getData().getString(CIMCacheManager.KEY_CIM_SERVIER_HOST);
|
||||
int port = message.getData().getInt(CIMCacheManager.KEY_CIM_SERVIER_PORT,0);
|
||||
manager.connect(host, port);
|
||||
}
|
||||
};
|
||||
@ -79,8 +79,8 @@ import com.farsunset.cim.sdk.android.model.SentBody;
|
||||
|
||||
}else
|
||||
{
|
||||
String host = intent.getStringExtra(CIMCacheToolkit.KEY_CIM_SERVIER_HOST);
|
||||
int port = intent.getIntExtra(CIMCacheToolkit.KEY_CIM_SERVIER_PORT,0);
|
||||
String host = intent.getStringExtra(CIMCacheManager.KEY_CIM_SERVIER_HOST);
|
||||
int port = intent.getIntExtra(CIMCacheManager.KEY_CIM_SERVIER_PORT,0);
|
||||
manager.connect(host,port);
|
||||
}
|
||||
}
|
||||
@ -105,7 +105,7 @@ import com.farsunset.cim.sdk.android.model.SentBody;
|
||||
{
|
||||
if(!manager.isConnected()){
|
||||
|
||||
boolean isManualStop = CIMCacheToolkit.getInstance(this).getBoolean(CIMCacheToolkit.KEY_MANUAL_STOP);
|
||||
boolean isManualStop = CIMCacheManager.getBoolean(getApplicationContext(),CIMCacheManager.KEY_MANUAL_STOP);
|
||||
Log.w(TAG, "manager.isConnected() == false, isManualStop == " + isManualStop);
|
||||
CIMPushManager.connect(this,0);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -74,8 +74,6 @@ public interface CIMConstant {
|
||||
|
||||
//被其他设备登录挤下线消息
|
||||
String ACTION_999 ="999";
|
||||
//被系统禁用消息
|
||||
String ACTION_444 ="444";
|
||||
}
|
||||
|
||||
|
||||
@ -105,9 +103,6 @@ public interface CIMConstant {
|
||||
// 网络变化广播
|
||||
String ACTION_NETWORK_CHANGED = "android.net.conn.CONNECTIVITY_CHANGE";
|
||||
|
||||
// 未知异常
|
||||
String ACTION_UNCAUGHT_EXCEPTION = "com.farsunset.cim.UNCAUGHT_EXCEPTION";
|
||||
|
||||
//重试连接
|
||||
String ACTION_CONNECTION_RECOVERY = "com.farsunset.cim.CONNECTION_RECOVERY";
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -21,16 +21,17 @@
|
||||
*/
|
||||
package com.farsunset.cim.sdk.android.exception;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class NetworkDisconnectedException extends Exception {
|
||||
public class NetworkDisabledException extends Exception implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public NetworkDisconnectedException() {
|
||||
public NetworkDisabledException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public NetworkDisconnectedException(String s) {
|
||||
public NetworkDisabledException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -21,16 +21,17 @@
|
||||
*/
|
||||
package com.farsunset.cim.sdk.android.exception;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class SessionDisconnectedException extends Exception {
|
||||
public class SessionClosedException extends Exception implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public SessionDisconnectedException() {
|
||||
public SessionClosedException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SessionDisconnectedException(String s) {
|
||||
public SessionClosedException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -22,9 +22,10 @@
|
||||
package com.farsunset.cim.sdk.android.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 请求应答对象
|
||||
*
|
||||
@ -49,19 +50,16 @@ public class ReplyBody implements Serializable {
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 返回数据集合
|
||||
*/
|
||||
private HashMap<String, String> data;
|
||||
|
||||
|
||||
private long timestamp;
|
||||
|
||||
public ReplyBody()
|
||||
{
|
||||
data = new HashMap<String, String>();
|
||||
timestamp = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回数据集合
|
||||
*/
|
||||
private Hashtable<String, String> data = new Hashtable<String, String>();
|
||||
|
||||
|
||||
public long getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
@ -81,9 +79,7 @@ public class ReplyBody implements Serializable {
|
||||
}
|
||||
|
||||
public void put(String k, String v) {
|
||||
if(v!=null && k!=null){
|
||||
data.put(k, v);
|
||||
}
|
||||
data.put(k, v);
|
||||
}
|
||||
|
||||
public String get(String k) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -22,12 +22,12 @@
|
||||
package com.farsunset.cim.sdk.android.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Set;
|
||||
|
||||
import com.farsunset.cim.sdk.android.constant.CIMConstant;
|
||||
import com.farsunset.cim.sdk.android.model.proto.SentBodyProto;
|
||||
|
||||
/**
|
||||
* java |android 客户端请求结构
|
||||
*
|
||||
@ -38,7 +38,7 @@ public class SentBody implements Serializable,Protobufable {
|
||||
|
||||
private String key;
|
||||
|
||||
private HashMap<String, String> data = new HashMap<String, String>();;
|
||||
private Hashtable<String, String> data = new Hashtable<String, String>();;
|
||||
|
||||
private long timestamp;
|
||||
|
||||
@ -67,13 +67,12 @@ public class SentBody implements Serializable,Protobufable {
|
||||
}
|
||||
|
||||
public void put(String k, String v) {
|
||||
if(v!=null && k!=null){
|
||||
data.put(k, v);
|
||||
if(k == null || v == null){
|
||||
return;
|
||||
}
|
||||
data.put(k, v);
|
||||
}
|
||||
public void putAll(Map<String, String> map) {
|
||||
data.putAll(map);
|
||||
}
|
||||
|
||||
|
||||
public Set<String> getKeySet() {
|
||||
return data.keySet();
|
||||
|
@ -1,24 +1,6 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
***************************************************************************************
|
||||
* *
|
||||
* Website : http://www.farsunset.com *
|
||||
* *
|
||||
***************************************************************************************
|
||||
*/
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: Message.proto
|
||||
|
||||
package com.farsunset.cim.sdk.android.model.proto;
|
||||
|
||||
public final class MessageProto {
|
||||
|
@ -1,24 +1,6 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
***************************************************************************************
|
||||
* *
|
||||
* Website : http://www.farsunset.com *
|
||||
* *
|
||||
***************************************************************************************
|
||||
*/
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: ReplyBody.proto
|
||||
|
||||
package com.farsunset.cim.sdk.android.model.proto;
|
||||
|
||||
public final class ReplyBodyProto {
|
||||
|
@ -1,24 +1,6 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
***************************************************************************************
|
||||
* *
|
||||
* Website : http://www.farsunset.com *
|
||||
* *
|
||||
***************************************************************************************
|
||||
*/
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: SentBody.proto
|
||||
|
||||
package com.farsunset.cim.sdk.android.model.proto;
|
||||
|
||||
public final class SentBodyProto {
|
||||
|
22
cim_for_mina/cim-client-android/.idea/compiler.xml
generated
Normal file
22
cim_for_mina/cim-client-android/.idea/compiler.xml
generated
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<resourceExtensions />
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="!?*.java" />
|
||||
<entry name="!?*.form" />
|
||||
<entry name="!?*.class" />
|
||||
<entry name="!?*.groovy" />
|
||||
<entry name="!?*.scala" />
|
||||
<entry name="!?*.flex" />
|
||||
<entry name="!?*.kt" />
|
||||
<entry name="!?*.clj" />
|
||||
<entry name="!?*.aj" />
|
||||
</wildcardResourcePatterns>
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="false">
|
||||
<processorPath useClasspath="true" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
3
cim_for_mina/cim-client-android/.idea/copyright/profiles_settings.xml
generated
Normal file
3
cim_for_mina/cim-client-android/.idea/copyright/profiles_settings.xml
generated
Normal file
@ -0,0 +1,3 @@
|
||||
<component name="CopyrightManager">
|
||||
<settings default="" />
|
||||
</component>
|
18
cim_for_mina/cim-client-android/.idea/gradle.xml
generated
Normal file
18
cim_for_mina/cim-client-android/.idea/gradle.xml
generated
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
59
cim_for_mina/cim-client-android/.idea/misc.xml
generated
59
cim_for_mina/cim-client-android/.idea/misc.xml
generated
@ -27,46 +27,6 @@
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectInspectionProfilesVisibleTreeState">
|
||||
<entry key="Project Default">
|
||||
<profile-state>
|
||||
<expanded-state>
|
||||
<State>
|
||||
<id />
|
||||
</State>
|
||||
<State>
|
||||
<id>Android</id>
|
||||
</State>
|
||||
<State>
|
||||
<id>Android > Lint > Correctness</id>
|
||||
</State>
|
||||
<State>
|
||||
<id>Android > Lint > Internationalization</id>
|
||||
</State>
|
||||
<State>
|
||||
<id>Android > Lint > Security</id>
|
||||
</State>
|
||||
<State>
|
||||
<id>CorrectnessLintAndroid</id>
|
||||
</State>
|
||||
<State>
|
||||
<id>Gradle</id>
|
||||
</State>
|
||||
<State>
|
||||
<id>LintAndroid</id>
|
||||
</State>
|
||||
<State>
|
||||
<id>Probable bugsGradle</id>
|
||||
</State>
|
||||
</expanded-state>
|
||||
<selected-state>
|
||||
<State>
|
||||
<id>Android</id>
|
||||
</State>
|
||||
</selected-state>
|
||||
</profile-state>
|
||||
</entry>
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
||||
<OptionsSetting value="true" id="Add" />
|
||||
<OptionsSetting value="true" id="Remove" />
|
||||
@ -83,23 +43,4 @@
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
<component name="SuppressionsComponent">
|
||||
<option name="suppComments" value="[]" />
|
||||
</component>
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
<state key="ProjectJDKs.UI">
|
||||
<settings>
|
||||
<last-edited>1.8</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
</states>
|
||||
</component>
|
||||
</project>
|
9
cim_for_mina/cim-client-android/.idea/modules.xml
generated
Normal file
9
cim_for_mina/cim-client-android/.idea/modules.xml
generated
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/cim-client-android.iml" filepath="$PROJECT_DIR$/cim-client-android.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
12
cim_for_mina/cim-client-android/.idea/runConfigurations.xml
generated
Normal file
12
cim_for_mina/cim-client-android/.idea/runConfigurations.xml
generated
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
@ -7,8 +7,8 @@ android {
|
||||
applicationId "com.farsunset.ichat.example"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 21
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
versionCode 31
|
||||
versionName "3.1.0"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
@ -27,8 +27,8 @@ android {
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile 'com.android.support:appcompat-v7:25.1.0'
|
||||
compile 'com.google.protobuf:protobuf-java:3.2.0'
|
||||
compile 'com.android.support:appcompat-v7:25.3.1'
|
||||
compile 'com.google.protobuf:protobuf-java:3.3.0'
|
||||
compile 'org.apache.mina:mina-core:2.0.16'
|
||||
compile 'org.slf4j:slf4j-api:1.7.24'
|
||||
compile 'org.slf4j:slf4j-nop:1.7.24'
|
||||
|
Binary file not shown.
BIN
cim_for_mina/cim-client-android/app/libs/cim-server-sdk-3.1.jar
Normal file
BIN
cim_for_mina/cim-client-android/app/libs/cim-server-sdk-3.1.jar
Normal file
Binary file not shown.
@ -1,8 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.farsunset.ichat.example"
|
||||
android:versionCode="30"
|
||||
android:versionName="3.0.0" >
|
||||
>
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
@ -47,8 +46,13 @@
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<!--推送服务-->
|
||||
<service android:name="com.farsunset.cim.sdk.android.CIMPushService" android:process=":cimpush" />
|
||||
<!-- ****************************************CIM推送配置 begin*************************************** -->
|
||||
<service android:name="com.farsunset.cim.sdk.android.CIMPushService" android:process=":cimpush" />
|
||||
<provider android:name="com.farsunset.cim.sdk.android.CIMCacheProvider"
|
||||
android:authorities="com.farsunset.cim.provider"
|
||||
android:process=":cimpush"
|
||||
android:exported="false" />
|
||||
<!-- ****************************************CIM推送配置 end*************************************** -->
|
||||
|
||||
<!--消息接受广播注册-->
|
||||
<receiver android:name="com.farsunset.ichat.example.receiver.CIMPushManagerReceiver" android:exported="false">
|
||||
|
@ -24,7 +24,7 @@ package com.farsunset.ichat.example.app;
|
||||
public interface Constant {
|
||||
|
||||
//服务端IP地址
|
||||
public static final String CIM_SERVER_HOST = "172.168.11.28";
|
||||
public static final String CIM_SERVER_HOST = "172.168.11.13";
|
||||
|
||||
|
||||
//注意,这里的端口不是tomcat的端口,CIM端口在服务端spring-cim.xml中配置的,没改动就使用默认的23456
|
||||
|
@ -5,7 +5,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.2.3'
|
||||
classpath 'com.android.tools.build:gradle:2.3.0'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
@ -2,11 +2,6 @@
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="src" path="src/main/resource"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.8.0_45">
|
||||
<attributes>
|
||||
<attribute name="owner.project.facets" value="java"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0">
|
||||
<attributes>
|
||||
<attribute name="owner.project.facets" value="jst.web"/>
|
||||
@ -14,5 +9,6 @@
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="output" path="WebContent/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
@ -3,12 +3,12 @@
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="libs/log4j-1.2.17.jar"/>
|
||||
<classpathentry kind="lib" path="D:/Program Files (x86)/dev/android-sdk-windos/platforms/android-21/android.jar"/>
|
||||
<classpathentry kind="lib" path="libs/protobuf-java-3.2.0.jar"/>
|
||||
<classpathentry kind="lib" path="libs/netty-buffer-4.1.9.Final.jar"/>
|
||||
<classpathentry kind="lib" path="libs/netty-codec-4.1.9.Final.jar"/>
|
||||
<classpathentry kind="lib" path="libs/netty-transport-4.1.9.Final.jar"/>
|
||||
<classpathentry kind="lib" path="libs/netty-common-4.1.9.Final.jar"/>
|
||||
<classpathentry kind="lib" path="libs/netty-handler-4.1.9.Final.jar"/>
|
||||
<classpathentry kind="lib" path="D:/devtools/android-sdk-windows/platforms/android-21/android.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
@ -0,0 +1,109 @@
|
||||
/**
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
***************************************************************************************
|
||||
* *
|
||||
* Website : http://www.farsunset.com *
|
||||
* *
|
||||
***************************************************************************************
|
||||
*/
|
||||
package com.farsunset.cim.sdk.android;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
class CIMCacheManager {
|
||||
|
||||
|
||||
public static final String CIM_CONFIG_INFO = "CIM_CONFIG_INFO";
|
||||
|
||||
public static final String KEY_ACCOUNT = "KEY_ACCOUNT";
|
||||
|
||||
public static final String KEY_MANUAL_STOP = "KEY_MANUAL_STOP";
|
||||
|
||||
public static final String KEY_CIM_DESTROYED = "KEY_CIM_DESTROYED";
|
||||
|
||||
public static final String KEY_CIM_SERVIER_HOST = "KEY_CIM_SERVIER_HOST";
|
||||
|
||||
public static final String KEY_CIM_SERVIER_PORT = "KEY_CIM_SERVIER_PORT";
|
||||
|
||||
public static final String KEY_CIM_CONNECTION_STATE = "KEY_CIM_CONNECTION_STATE";
|
||||
|
||||
|
||||
public static void remove(Context context ,String key)
|
||||
{
|
||||
ContentResolver resolver = context.getContentResolver();
|
||||
resolver.delete(Uri.parse(CIMCacheProvider.CONTENT_URI), key, null);
|
||||
}
|
||||
|
||||
|
||||
public static void putString(Context context ,String key,String value)
|
||||
{
|
||||
|
||||
ContentResolver resolver = context.getContentResolver();
|
||||
ContentValues values = new ContentValues();
|
||||
values.put("value", value);
|
||||
values.put("key", key);
|
||||
resolver.insert(Uri.parse(CIMCacheProvider.CONTENT_URI), values);
|
||||
|
||||
}
|
||||
|
||||
public static String getString(Context context ,String key)
|
||||
{
|
||||
String value = null;
|
||||
ContentResolver resolver = context.getContentResolver();
|
||||
Cursor cursor = resolver.query(Uri.parse(CIMCacheProvider.CONTENT_URI), new String[]{key}, null,null,null);
|
||||
if (cursor!=null && cursor.moveToFirst())
|
||||
{
|
||||
value = cursor.getString(0);
|
||||
cursor.close();
|
||||
}
|
||||
closeQuietly(cursor);
|
||||
return value;
|
||||
}
|
||||
|
||||
private static void closeQuietly(Cursor cursor){
|
||||
try{
|
||||
if(cursor!=null)
|
||||
cursor.close();
|
||||
}catch(Exception e){}
|
||||
}
|
||||
|
||||
public static void putBoolean(Context context,String key,boolean value)
|
||||
{
|
||||
putString(context,key,Boolean.toString(value));
|
||||
}
|
||||
|
||||
public static boolean getBoolean(Context context,String key)
|
||||
{
|
||||
String value = getString(context,key);
|
||||
return value == null?false:Boolean.parseBoolean(value);
|
||||
}
|
||||
|
||||
|
||||
public static void putInt(Context context,String key,int value)
|
||||
{
|
||||
putString(context,key, String.valueOf(value));
|
||||
}
|
||||
|
||||
public static int getInt(Context context,String key)
|
||||
{
|
||||
String value = getString(context,key);
|
||||
return value == null?0:Integer.parseInt(value);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
/**
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
***************************************************************************************
|
||||
* *
|
||||
* Website : http://www.farsunset.com *
|
||||
* *
|
||||
***************************************************************************************
|
||||
*/
|
||||
package com.farsunset.cim.sdk.android;
|
||||
|
||||
import android.content.ContentProvider;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.MatrixCursor;
|
||||
import android.net.Uri;
|
||||
|
||||
public class CIMCacheProvider extends ContentProvider {
|
||||
public static final String CONTENT_URI="content://com.farsunset.cim.provider";
|
||||
static final String MODEL_KEY = "PRIVATE_CIM_CONFIG";
|
||||
|
||||
|
||||
@Override
|
||||
public int delete(Uri arg0, String key, String[] arg2) {
|
||||
getContext().getSharedPreferences(MODEL_KEY, Context.MODE_PRIVATE).edit().remove(key).apply();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType(Uri arg0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Uri insert(Uri arg0, ContentValues values) {
|
||||
String key = values.getAsString("key");
|
||||
String value = values.getAsString("value");
|
||||
getContext().getSharedPreferences(MODEL_KEY, Context.MODE_PRIVATE).edit().putString(key, value).apply();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreate() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cursor query(Uri arg0, String[] arg1, String key, String[] arg3, String arg4) {
|
||||
MatrixCursor cursor = new MatrixCursor(new String[]{"value"});
|
||||
String value = getContext().getSharedPreferences(MODEL_KEY, Context.MODE_PRIVATE).getString(arg1[0], null);
|
||||
cursor.addRow(new Object[]{value});
|
||||
return cursor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(Uri arg0, ContentValues arg1, String arg2, String[] arg3) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -45,10 +45,10 @@ import io.netty.handler.timeout.IdleStateEvent;
|
||||
import io.netty.handler.timeout.IdleStateHandler;
|
||||
import io.netty.util.AttributeKey;
|
||||
import com.farsunset.cim.sdk.android.constant.CIMConstant;
|
||||
import com.farsunset.cim.sdk.android.exception.SessionDisconnectedException;
|
||||
import com.farsunset.cim.sdk.android.filter.ClientMessageDecoder;
|
||||
import com.farsunset.cim.sdk.android.filter.ClientMessageEncoder;
|
||||
import com.farsunset.cim.sdk.android.exception.NetworkDisconnectedException;
|
||||
import com.farsunset.cim.sdk.android.exception.NetworkDisabledException;
|
||||
import com.farsunset.cim.sdk.android.exception.SessionClosedException;
|
||||
import com.farsunset.cim.sdk.android.model.HeartbeatRequest;
|
||||
import com.farsunset.cim.sdk.android.model.HeartbeatResponse;
|
||||
import com.farsunset.cim.sdk.android.model.Message;
|
||||
@ -129,7 +129,7 @@ class CIMConnectorManager extends SimpleChannelInboundHandler<Object> {
|
||||
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(CIMConstant.IntentAction.ACTION_CONNECTION_FAILED);
|
||||
intent.putExtra(Exception.class.getName(), e);
|
||||
intent.putExtra(Exception.class.getName(), e.getClass().getSimpleName());
|
||||
intent.putExtra("interval", interval);
|
||||
context.sendBroadcast(intent);
|
||||
|
||||
@ -145,7 +145,7 @@ class CIMConnectorManager extends SimpleChannelInboundHandler<Object> {
|
||||
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(CIMConstant.IntentAction.ACTION_CONNECTION_FAILED);
|
||||
intent.putExtra(Exception.class.getName(), new NetworkDisconnectedException());
|
||||
intent.putExtra(Exception.class.getName(), NetworkDisabledException.class.getSimpleName());
|
||||
context.sendBroadcast(intent);
|
||||
|
||||
return;
|
||||
@ -164,17 +164,22 @@ class CIMConnectorManager extends SimpleChannelInboundHandler<Object> {
|
||||
|
||||
boolean isSuccessed = false;
|
||||
|
||||
Throwable exception = new SessionDisconnectedException();
|
||||
String exceptionName = SessionClosedException.class.getSimpleName();
|
||||
|
||||
if(channel!=null && channel.isActive())
|
||||
{
|
||||
isSuccessed = channel.writeAndFlush(body).awaitUninterruptibly(WRITE_TIMEOUT);
|
||||
ChannelFuture future = channel.writeAndFlush(body);
|
||||
isSuccessed = future.awaitUninterruptibly(WRITE_TIMEOUT);
|
||||
if(!isSuccessed && future.cause()!=null){
|
||||
exceptionName = future.cause().getClass().getSimpleName();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!isSuccessed){
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(CIMConstant.IntentAction.ACTION_SENT_FAILED);
|
||||
intent.putExtra(Exception.class.getName(),exception);
|
||||
intent.putExtra(Exception.class.getName(),exceptionName);
|
||||
intent.putExtra(SentBody.class.getName(), body);
|
||||
context.sendBroadcast(intent);
|
||||
}else
|
||||
@ -279,7 +284,7 @@ class CIMConnectorManager extends SimpleChannelInboundHandler<Object> {
|
||||
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(CIMConstant.IntentAction.ACTION_UNCAUGHT_EXCEPTION);
|
||||
intent.putExtra(Exception.class.getName(), cause);
|
||||
intent.putExtra(Exception.class.getName(), cause.getClass().getSimpleName());
|
||||
context.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -22,9 +22,8 @@
|
||||
package com.farsunset.cim.sdk.android;
|
||||
|
||||
|
||||
|
||||
import com.farsunset.cim.sdk.android.constant.CIMConstant;
|
||||
import com.farsunset.cim.sdk.android.exception.SessionDisconnectedException;
|
||||
import com.farsunset.cim.sdk.android.exception.SessionClosedException;
|
||||
import com.farsunset.cim.sdk.android.model.Message;
|
||||
import com.farsunset.cim.sdk.android.model.ReplyBody;
|
||||
import com.farsunset.cim.sdk.android.model.SentBody;
|
||||
@ -55,7 +54,6 @@ public abstract class CIMEventBroadcastReceiver extends BroadcastReceiver{
|
||||
{
|
||||
startPushService();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 设备网络状态变化事件
|
||||
@ -80,7 +78,8 @@ public abstract class CIMEventBroadcastReceiver extends BroadcastReceiver{
|
||||
if(intent.getAction().equals(CIMConstant.IntentAction.ACTION_CONNECTION_FAILED))
|
||||
{
|
||||
long interval = intent.getLongExtra("interval", CIMConstant.RECONN_INTERVAL_TIME);
|
||||
onConnectionFailed((Exception) intent.getSerializableExtra(Exception.class.getName()),interval);
|
||||
String exceptionName = intent.getStringExtra(Exception.class.getName());
|
||||
onConnectionFailed(exceptionName,interval);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -114,9 +113,9 @@ public abstract class CIMEventBroadcastReceiver extends BroadcastReceiver{
|
||||
*/
|
||||
if(intent.getAction().equals(CIMConstant.IntentAction.ACTION_SENT_FAILED))
|
||||
{
|
||||
Exception exception = (Exception) intent.getSerializableExtra(Exception.class.getName());
|
||||
String exceptionName = intent.getStringExtra(Exception.class.getName());
|
||||
SentBody sentBody = (SentBody)intent.getSerializableExtra(SentBody.class.getName());
|
||||
onSentFailed(exception,sentBody);
|
||||
onSentFailed(exceptionName,sentBody);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -128,15 +127,7 @@ public abstract class CIMEventBroadcastReceiver extends BroadcastReceiver{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 获取cim数据传输异常事件
|
||||
*/
|
||||
if(intent.getAction().equals(CIMConstant.IntentAction.ACTION_UNCAUGHT_EXCEPTION))
|
||||
{
|
||||
onUncaughtException((Exception)intent.getSerializableExtra(Exception.class.getName()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 重新连接,如果断开的话
|
||||
*/
|
||||
@ -153,7 +144,7 @@ public abstract class CIMEventBroadcastReceiver extends BroadcastReceiver{
|
||||
}
|
||||
|
||||
private void onInnerConnectionClosed(){
|
||||
CIMCacheToolkit.getInstance(context).putBoolean(CIMCacheToolkit.KEY_CIM_CONNECTION_STATE, false);
|
||||
CIMCacheManager.putBoolean(context,CIMCacheManager.KEY_CIM_CONNECTION_STATE, false);
|
||||
if(CIMConnectorManager.isNetworkConnected(context))
|
||||
{
|
||||
CIMPushManager.connect(context,0);
|
||||
@ -162,7 +153,7 @@ public abstract class CIMEventBroadcastReceiver extends BroadcastReceiver{
|
||||
onConnectionClosed();
|
||||
}
|
||||
|
||||
private void onConnectionFailed(Exception e,long reinterval){
|
||||
private void onConnectionFailed(String exceptionName,long reinterval){
|
||||
|
||||
if(CIMConnectorManager.isNetworkConnected(context))
|
||||
{
|
||||
@ -173,14 +164,12 @@ public abstract class CIMEventBroadcastReceiver extends BroadcastReceiver{
|
||||
}
|
||||
|
||||
private void onInnerConnectionSuccessed(){
|
||||
CIMCacheToolkit.getInstance(context).putBoolean(CIMCacheToolkit.KEY_CIM_CONNECTION_STATE, true);
|
||||
CIMCacheManager.putBoolean(context,CIMCacheManager.KEY_CIM_CONNECTION_STATE, true);
|
||||
|
||||
boolean autoBind = CIMPushManager.autoBindAccount(context);
|
||||
onConnectionSuccessed(autoBind);
|
||||
}
|
||||
|
||||
private void onUncaughtException(Throwable arg0) {}
|
||||
|
||||
private void onDevicesNetworkChanged(NetworkInfo info) {
|
||||
|
||||
if(info !=null)
|
||||
@ -202,13 +191,13 @@ public abstract class CIMEventBroadcastReceiver extends BroadcastReceiver{
|
||||
|
||||
private boolean isForceOfflineMessage(String action)
|
||||
{
|
||||
return CIMConstant.MessageAction.ACTION_999.equals(action) || CIMConstant.MessageAction.ACTION_444.equals(action);
|
||||
return CIMConstant.MessageAction.ACTION_999.equals(action);
|
||||
}
|
||||
|
||||
private void onSentFailed(Exception e, SentBody body){
|
||||
private void onSentFailed(String exceptionName, SentBody body){
|
||||
|
||||
//与服务端端开链接,重新连接
|
||||
if(e instanceof SessionDisconnectedException)
|
||||
if(SessionClosedException.class.getSimpleName().equals(exceptionName))
|
||||
{
|
||||
CIMPushManager.connect(context,0);
|
||||
}else
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -48,6 +48,7 @@ public class CIMPushManager {
|
||||
|
||||
static String KEY_SEND_BODY ="KEY_SEND_BODY";
|
||||
|
||||
static String KEY_CIM_CONNECTION_STATUS ="KEY_CIM_CONNECTION_STATUS";
|
||||
|
||||
/**
|
||||
* 初始化,连接服务端,在程序启动页或者 在Application里调用
|
||||
@ -63,20 +64,20 @@ public class CIMPushManager {
|
||||
|
||||
private static void connect(Context context,String ip,int port,boolean autoBind,long delayedTime){
|
||||
|
||||
CIMCacheToolkit.getInstance(context).putBoolean(CIMCacheToolkit.KEY_CIM_DESTROYED, false);
|
||||
CIMCacheToolkit.getInstance(context).putBoolean(CIMCacheToolkit.KEY_MANUAL_STOP, false);
|
||||
CIMCacheManager.putBoolean(context,CIMCacheManager.KEY_CIM_DESTROYED, false);
|
||||
CIMCacheManager.putBoolean(context,CIMCacheManager.KEY_MANUAL_STOP, false);
|
||||
|
||||
CIMCacheToolkit.getInstance(context).putString( CIMCacheToolkit.KEY_CIM_SERVIER_HOST, ip);
|
||||
CIMCacheToolkit.getInstance(context).putInt( CIMCacheToolkit.KEY_CIM_SERVIER_PORT, port);
|
||||
CIMCacheManager.putString(context, CIMCacheManager.KEY_CIM_SERVIER_HOST, ip);
|
||||
CIMCacheManager.putInt(context, CIMCacheManager.KEY_CIM_SERVIER_PORT, port);
|
||||
|
||||
if(!autoBind)
|
||||
{
|
||||
CIMCacheToolkit.getInstance(context).remove(CIMCacheToolkit.KEY_ACCOUNT);
|
||||
CIMCacheManager.remove(context,CIMCacheManager.KEY_ACCOUNT);
|
||||
}
|
||||
|
||||
Intent serviceIntent = new Intent(context, CIMPushService.class);
|
||||
serviceIntent.putExtra(CIMCacheToolkit.KEY_CIM_SERVIER_HOST, ip);
|
||||
serviceIntent.putExtra(CIMCacheToolkit.KEY_CIM_SERVIER_PORT, port);
|
||||
serviceIntent.putExtra(CIMCacheManager.KEY_CIM_SERVIER_HOST, ip);
|
||||
serviceIntent.putExtra(CIMCacheManager.KEY_CIM_SERVIER_PORT, port);
|
||||
serviceIntent.putExtra(CIMPushService.KEY_DELAYED_TIME, delayedTime);
|
||||
serviceIntent.setAction(ACTION_CREATE_CIM_CONNECTION);
|
||||
context.startService(serviceIntent);
|
||||
@ -85,16 +86,16 @@ public class CIMPushManager {
|
||||
|
||||
protected static void connect(Context context,long delayedTime){
|
||||
|
||||
boolean isManualStop = CIMCacheToolkit.getInstance(context).getBoolean(CIMCacheToolkit.KEY_MANUAL_STOP);
|
||||
boolean isManualDestory = CIMCacheToolkit.getInstance(context).getBoolean(CIMCacheToolkit.KEY_CIM_DESTROYED);
|
||||
boolean isManualStop = CIMCacheManager.getBoolean(context,CIMCacheManager.KEY_MANUAL_STOP);
|
||||
boolean isManualDestory = CIMCacheManager.getBoolean(context,CIMCacheManager.KEY_CIM_DESTROYED);
|
||||
|
||||
if(isManualStop || isManualDestory)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
String host = CIMCacheToolkit.getInstance(context).getString( CIMCacheToolkit.KEY_CIM_SERVIER_HOST);
|
||||
int port =CIMCacheToolkit.getInstance(context).getInt( CIMCacheToolkit.KEY_CIM_SERVIER_PORT);
|
||||
String host = CIMCacheManager.getString(context, CIMCacheManager.KEY_CIM_SERVIER_HOST);
|
||||
int port =CIMCacheManager.getInt(context, CIMCacheManager.KEY_CIM_SERVIER_PORT);
|
||||
|
||||
connect(context,host,port,true,delayedTime);
|
||||
|
||||
@ -108,7 +109,7 @@ public class CIMPushManager {
|
||||
public static void bindAccount(Context context,String account){
|
||||
|
||||
|
||||
boolean isManualDestory = CIMCacheToolkit.getInstance(context).getBoolean(CIMCacheToolkit.KEY_CIM_DESTROYED);
|
||||
boolean isManualDestory = CIMCacheManager.getBoolean(context,CIMCacheManager.KEY_CIM_DESTROYED);
|
||||
if(isManualDestory || account==null || account.trim().length()==0)
|
||||
{
|
||||
return ;
|
||||
@ -121,8 +122,8 @@ public class CIMPushManager {
|
||||
|
||||
private static void sendBindRequest(Context context, String account){
|
||||
|
||||
CIMCacheToolkit.getInstance(context).putBoolean(CIMCacheToolkit.KEY_MANUAL_STOP, false);
|
||||
CIMCacheToolkit.getInstance(context).putString(CIMCacheToolkit.KEY_ACCOUNT, account);
|
||||
CIMCacheManager.putBoolean(context,CIMCacheManager.KEY_MANUAL_STOP, false);
|
||||
CIMCacheManager.putString(context,CIMCacheManager.KEY_ACCOUNT, account);
|
||||
|
||||
String imei = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId();
|
||||
imei += context.getPackageName();
|
||||
@ -140,8 +141,8 @@ public class CIMPushManager {
|
||||
|
||||
protected static boolean autoBindAccount(Context context){
|
||||
|
||||
String account = CIMCacheToolkit.getInstance(context).getString(CIMCacheToolkit.KEY_ACCOUNT);
|
||||
boolean isManualDestory = CIMCacheToolkit.getInstance(context).getBoolean(CIMCacheToolkit.KEY_CIM_DESTROYED);
|
||||
String account = CIMCacheManager.getString(context,CIMCacheManager.KEY_ACCOUNT);
|
||||
boolean isManualDestory = CIMCacheManager.getBoolean(context,CIMCacheManager.KEY_CIM_DESTROYED);
|
||||
if( account==null || account.trim().length()==0 || isManualDestory )
|
||||
{
|
||||
return false;
|
||||
@ -161,8 +162,8 @@ public class CIMPushManager {
|
||||
*/
|
||||
public static void sendRequest(Context context, SentBody body){
|
||||
|
||||
boolean isManualStop = CIMCacheToolkit.getInstance(context).getBoolean(CIMCacheToolkit.KEY_MANUAL_STOP);
|
||||
boolean isManualDestory = CIMCacheToolkit.getInstance(context).getBoolean(CIMCacheToolkit.KEY_CIM_DESTROYED);
|
||||
boolean isManualStop = CIMCacheManager.getBoolean(context,CIMCacheManager.KEY_MANUAL_STOP);
|
||||
boolean isManualDestory = CIMCacheManager.getBoolean(context,CIMCacheManager.KEY_CIM_DESTROYED);
|
||||
|
||||
if(isManualStop || isManualDestory)
|
||||
{
|
||||
@ -182,12 +183,12 @@ public class CIMPushManager {
|
||||
*/
|
||||
public static void stop(Context context){
|
||||
|
||||
boolean isManualDestory = CIMCacheToolkit.getInstance(context).getBoolean(CIMCacheToolkit.KEY_CIM_DESTROYED);
|
||||
boolean isManualDestory = CIMCacheManager.getBoolean(context,CIMCacheManager.KEY_CIM_DESTROYED);
|
||||
if(isManualDestory){
|
||||
return ;
|
||||
}
|
||||
|
||||
CIMCacheToolkit.getInstance(context).putBoolean(CIMCacheToolkit.KEY_MANUAL_STOP, true);
|
||||
CIMCacheManager.putBoolean(context,CIMCacheManager.KEY_MANUAL_STOP, true);
|
||||
|
||||
Intent serviceIntent = new Intent(context, CIMPushService.class);
|
||||
serviceIntent.setAction(ACTION_CLOSE_CIM_CONNECTION);
|
||||
@ -203,8 +204,8 @@ public class CIMPushManager {
|
||||
public static void destroy(Context context){
|
||||
|
||||
|
||||
CIMCacheToolkit.getInstance(context).putBoolean(CIMCacheToolkit.KEY_CIM_DESTROYED, true);
|
||||
CIMCacheToolkit.getInstance(context).putString(CIMCacheToolkit.KEY_ACCOUNT, null);
|
||||
CIMCacheManager.putBoolean(context,CIMCacheManager.KEY_CIM_DESTROYED, true);
|
||||
CIMCacheManager.putString(context,CIMCacheManager.KEY_ACCOUNT, null);
|
||||
|
||||
Intent serviceIntent = new Intent(context, CIMPushService.class);
|
||||
serviceIntent.setAction(ACTION_DESTORY);
|
||||
@ -219,7 +220,7 @@ public class CIMPushManager {
|
||||
*/
|
||||
public static void resume(Context context){
|
||||
|
||||
boolean isManualDestory = CIMCacheToolkit.getInstance(context).getBoolean(CIMCacheToolkit.KEY_CIM_DESTROYED);
|
||||
boolean isManualDestory = CIMCacheManager.getBoolean(context,CIMCacheManager.KEY_CIM_DESTROYED);
|
||||
if(isManualDestory){
|
||||
return ;
|
||||
}
|
||||
@ -228,7 +229,7 @@ public class CIMPushManager {
|
||||
}
|
||||
|
||||
public static boolean isConnected(Context context){
|
||||
return CIMCacheToolkit.getInstance(context).getBoolean(CIMCacheToolkit.KEY_CIM_CONNECTION_STATE);
|
||||
return CIMCacheManager.getBoolean(context,CIMCacheManager.KEY_CIM_CONNECTION_STATE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -51,8 +51,8 @@ import com.farsunset.cim.sdk.android.model.SentBody;
|
||||
|
||||
connectionHandler.removeMessages(0);
|
||||
|
||||
String host = message.getData().getString(CIMCacheToolkit.KEY_CIM_SERVIER_HOST);
|
||||
int port = message.getData().getInt(CIMCacheToolkit.KEY_CIM_SERVIER_PORT,0);
|
||||
String host = message.getData().getString(CIMCacheManager.KEY_CIM_SERVIER_HOST);
|
||||
int port = message.getData().getInt(CIMCacheManager.KEY_CIM_SERVIER_PORT,0);
|
||||
manager.connect(host, port);
|
||||
}
|
||||
};
|
||||
@ -79,8 +79,8 @@ import com.farsunset.cim.sdk.android.model.SentBody;
|
||||
|
||||
}else
|
||||
{
|
||||
String host = intent.getStringExtra(CIMCacheToolkit.KEY_CIM_SERVIER_HOST);
|
||||
int port = intent.getIntExtra(CIMCacheToolkit.KEY_CIM_SERVIER_PORT,0);
|
||||
String host = intent.getStringExtra(CIMCacheManager.KEY_CIM_SERVIER_HOST);
|
||||
int port = intent.getIntExtra(CIMCacheManager.KEY_CIM_SERVIER_PORT,0);
|
||||
manager.connect(host,port);
|
||||
}
|
||||
}
|
||||
@ -105,7 +105,7 @@ import com.farsunset.cim.sdk.android.model.SentBody;
|
||||
{
|
||||
if(!manager.isConnected()){
|
||||
|
||||
boolean isManualStop = CIMCacheToolkit.getInstance(this).getBoolean(CIMCacheToolkit.KEY_MANUAL_STOP);
|
||||
boolean isManualStop = CIMCacheManager.getBoolean(getApplicationContext(),CIMCacheManager.KEY_MANUAL_STOP);
|
||||
Log.w(TAG, "manager.isConnected() == false, isManualStop == " + isManualStop);
|
||||
CIMPushManager.connect(this,0);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -27,6 +27,7 @@ package com.farsunset.cim.sdk.android.constant;
|
||||
public interface CIMConstant {
|
||||
|
||||
long RECONN_INTERVAL_TIME= 30 * 1000;
|
||||
|
||||
//消息头长度为3个字节,第一个字节为消息类型,第二,第三字节 转换int后为消息长度
|
||||
int DATA_HEADER_LENGTH = 3;
|
||||
public static interface ReturnCode{
|
||||
@ -73,8 +74,6 @@ public interface CIMConstant {
|
||||
|
||||
//被其他设备登录挤下线消息
|
||||
String ACTION_999 ="999";
|
||||
//被系统禁用消息
|
||||
String ACTION_444 ="444";
|
||||
}
|
||||
|
||||
|
||||
@ -104,11 +103,11 @@ public interface CIMConstant {
|
||||
// 网络变化广播
|
||||
String ACTION_NETWORK_CHANGED = "android.net.conn.CONNECTIVITY_CHANGE";
|
||||
|
||||
// 未知异常
|
||||
String ACTION_UNCAUGHT_EXCEPTION = "com.farsunset.cim.UNCAUGHT_EXCEPTION";
|
||||
|
||||
//重试连接
|
||||
String ACTION_CONNECTION_RECOVERY = "com.farsunset.cim.CONNECTION_RECOVERY";
|
||||
|
||||
// 未知异常
|
||||
String ACTION_UNCAUGHT_EXCEPTION = "com.farsunset.cim.UNCAUGHT_EXCEPTION";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -21,16 +21,17 @@
|
||||
*/
|
||||
package com.farsunset.cim.sdk.android.exception;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class NetworkDisconnectedException extends Exception {
|
||||
public class NetworkDisabledException extends Exception implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public NetworkDisconnectedException() {
|
||||
public NetworkDisabledException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public NetworkDisconnectedException(String s) {
|
||||
public NetworkDisabledException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -21,16 +21,17 @@
|
||||
*/
|
||||
package com.farsunset.cim.sdk.android.exception;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class SessionDisconnectedException extends Exception {
|
||||
public class SessionClosedException extends Exception implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public SessionDisconnectedException() {
|
||||
public SessionClosedException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SessionDisconnectedException(String s) {
|
||||
public SessionClosedException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
@ -53,6 +53,8 @@ public class ClientMessageDecoder extends ByteToMessageDecoder {
|
||||
|
||||
buffer.markReaderIndex();
|
||||
|
||||
buffer.markReaderIndex();
|
||||
|
||||
byte conetnType = buffer.readByte();
|
||||
|
||||
byte lv = buffer.readByte();// int 低位
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -22,9 +22,10 @@
|
||||
package com.farsunset.cim.sdk.android.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 请求应答对象
|
||||
*
|
||||
@ -49,19 +50,16 @@ public class ReplyBody implements Serializable {
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 返回数据集合
|
||||
*/
|
||||
private HashMap<String, String> data;
|
||||
|
||||
|
||||
private long timestamp;
|
||||
|
||||
public ReplyBody()
|
||||
{
|
||||
data = new HashMap<String, String>();
|
||||
timestamp = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回数据集合
|
||||
*/
|
||||
private Hashtable<String, String> data = new Hashtable<String, String>();
|
||||
|
||||
|
||||
public long getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
@ -81,9 +79,7 @@ public class ReplyBody implements Serializable {
|
||||
}
|
||||
|
||||
public void put(String k, String v) {
|
||||
if(v!=null && k!=null){
|
||||
data.put(k, v);
|
||||
}
|
||||
data.put(k, v);
|
||||
}
|
||||
|
||||
public String get(String k) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
* Copyright 2013-2033 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -22,12 +22,12 @@
|
||||
package com.farsunset.cim.sdk.android.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Set;
|
||||
|
||||
import com.farsunset.cim.sdk.android.constant.CIMConstant;
|
||||
import com.farsunset.cim.sdk.android.model.proto.SentBodyProto;
|
||||
|
||||
/**
|
||||
* java |android 客户端请求结构
|
||||
*
|
||||
@ -38,7 +38,7 @@ public class SentBody implements Serializable,Protobufable {
|
||||
|
||||
private String key;
|
||||
|
||||
private HashMap<String, String> data = new HashMap<String, String>();;
|
||||
private Hashtable<String, String> data = new Hashtable<String, String>();;
|
||||
|
||||
private long timestamp;
|
||||
|
||||
@ -67,13 +67,12 @@ public class SentBody implements Serializable,Protobufable {
|
||||
}
|
||||
|
||||
public void put(String k, String v) {
|
||||
if(v!=null && k!=null){
|
||||
data.put(k, v);
|
||||
if(k == null || v == null){
|
||||
return;
|
||||
}
|
||||
data.put(k, v);
|
||||
}
|
||||
public void putAll(Map<String, String> map) {
|
||||
data.putAll(map);
|
||||
}
|
||||
|
||||
|
||||
public Set<String> getKeySet() {
|
||||
return data.keySet();
|
||||
|
@ -1,24 +1,6 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
***************************************************************************************
|
||||
* *
|
||||
* Website : http://www.farsunset.com *
|
||||
* *
|
||||
***************************************************************************************
|
||||
*/
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: Message.proto
|
||||
|
||||
package com.farsunset.cim.sdk.android.model.proto;
|
||||
|
||||
public final class MessageProto {
|
||||
|
@ -1,24 +1,6 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
***************************************************************************************
|
||||
* *
|
||||
* Website : http://www.farsunset.com *
|
||||
* *
|
||||
***************************************************************************************
|
||||
*/
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: ReplyBody.proto
|
||||
|
||||
package com.farsunset.cim.sdk.android.model.proto;
|
||||
|
||||
public final class ReplyBodyProto {
|
||||
|
@ -1,24 +1,6 @@
|
||||
/**
|
||||
* Copyright 2013-2023 Xia Jun(3979434@qq.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
***************************************************************************************
|
||||
* *
|
||||
* Website : http://www.farsunset.com *
|
||||
* *
|
||||
***************************************************************************************
|
||||
*/
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: SentBody.proto
|
||||
|
||||
package com.farsunset.cim.sdk.android.model.proto;
|
||||
|
||||
public final class SentBodyProto {
|
||||
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="PROJECT" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
@ -3,9 +3,8 @@
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="distributionType" value="LOCAL" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleHome" value="D:/Program Files (x86)/dev/gradle-3.4" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
|
64
cim_for_netty/cim-client-android/.idea/misc.xml
generated
64
cim_for_netty/cim-client-android/.idea/misc.xml
generated
@ -1,5 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<entry_points version="2.0" />
|
||||
</component>
|
||||
<component name="NullableNotNullManager">
|
||||
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
|
||||
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
|
||||
@ -24,46 +27,6 @@
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectInspectionProfilesVisibleTreeState">
|
||||
<entry key="Project Default">
|
||||
<profile-state>
|
||||
<expanded-state>
|
||||
<State>
|
||||
<id />
|
||||
</State>
|
||||
<State>
|
||||
<id>Android</id>
|
||||
</State>
|
||||
<State>
|
||||
<id>Android > Lint > Correctness</id>
|
||||
</State>
|
||||
<State>
|
||||
<id>Android > Lint > Internationalization</id>
|
||||
</State>
|
||||
<State>
|
||||
<id>Android > Lint > Security</id>
|
||||
</State>
|
||||
<State>
|
||||
<id>CorrectnessLintAndroid</id>
|
||||
</State>
|
||||
<State>
|
||||
<id>Gradle</id>
|
||||
</State>
|
||||
<State>
|
||||
<id>LintAndroid</id>
|
||||
</State>
|
||||
<State>
|
||||
<id>Probable bugsGradle</id>
|
||||
</State>
|
||||
</expanded-state>
|
||||
<selected-state>
|
||||
<State>
|
||||
<id>Android</id>
|
||||
</State>
|
||||
</selected-state>
|
||||
</profile-state>
|
||||
</entry>
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
||||
<OptionsSetting value="true" id="Add" />
|
||||
<OptionsSetting value="true" id="Remove" />
|
||||
@ -74,29 +37,10 @@
|
||||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
<component name="SuppressionsComponent">
|
||||
<option name="suppComments" value="[]" />
|
||||
</component>
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
<state key="ProjectJDKs.UI">
|
||||
<settings>
|
||||
<last-edited>1.8</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
</states>
|
||||
</component>
|
||||
</project>
|
@ -1,289 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AnalysisProjectProfileManager">
|
||||
<option name="PROJECT_PROFILE" value="Project Default" />
|
||||
<option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
|
||||
<scopes />
|
||||
<profiles>
|
||||
<profile version="1.0" is_locked="false">
|
||||
<option name="myName" value="Project Default" />
|
||||
<coding_rule class="AndroidCallSuperFirst" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="AndroidCallSuperLast" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="AndroidDoNotHardCodeSDCard" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="BasicAvoidBranchingStatementAsLastInLoop" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="BasicAvoidDecimalLiteralsInBigDecimalConstructor" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="BasicAvoidMultipleUnaryOperators" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="BasicAvoidThreadGroup" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="BasicAvoidUsingHardCodedIP" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="BasicAvoidUsingOctalValues" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="BasicBigIntegerInstantiation" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="BasicBooleanInstantiation" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="BasicBrokenNullCheck" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="BasicCheckResultSet" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="BasicCheckSkipResult" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="BasicClassCastExceptionWithToArray" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="BasicCollapsibleIfStatements" level="MINOR" enabled="true" />
|
||||
<coding_rule class="BasicDontCallThreadRun" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="BasicDontUseFloatTypeForLoopIndices" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="BasicDoubleCheckedLocking" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="BasicExtendsObject" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="BasicForLoopShouldBeWhileLoop" level="MINOR" enabled="false" />
|
||||
<coding_rule class="BasicJSFDontNestJsfInJstlIteration" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="BasicJSPIframeMissingSrcAttribute" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="BasicJSPNoClassAttribute" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="BasicJSPNoHtmlComments" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="BasicJSPNoInlineStyleInformation" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="BasicJSPNoJspForward" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="BasicJSPNoLongScripts" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="BasicJSPNoScriptlets" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="BasicJumbledIncrementer" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="BasicMisplacedNullCheck" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="BasicOverrideBothEqualsAndHashcode" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="BasicReturnFromFinallyBlock" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="BasicUnconditionalIfStatement" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="BracesForLoopsMustUseBraces" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="BracesIfElseStmtsMustUseBraces" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="BracesIfStmtsMustUseBraces" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="BracesWhileLoopsMustUseBraces" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="CloneImplementationCloneMethodMustImplementCloneable" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="CloneImplementationCloneThrowsCloneNotSupportedException" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="CloneImplementationProperCloneImplementation" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="CodeSizeCyclomaticComplexity" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="CodeSizeExcessiveClassLength" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="CodeSizeExcessiveMethodLength" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="CodeSizeExcessiveParameterList" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="CodeSizeExcessivePublicCount" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="CodeSizeNPathComplexity" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="CodeSizeNcssConstructorCount" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="CodeSizeNcssMethodCount" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="CodeSizeNcssTypeCount" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="CodeSizeTooManyFields" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="CodeSizeTooManyMethods" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="ControversialAssignmentInOperand" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="ControversialAtLeastOneConstructor" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="ControversialAvoidAccessibilityAlteration" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="ControversialAvoidFinalLocalVariable" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="ControversialAvoidLiteralsInIfCondition" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="ControversialAvoidPrefixingMethodParameters" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="ControversialAvoidUsingNativeCode" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="ControversialAvoidUsingShortType" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="ControversialAvoidUsingVolatile" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="ControversialBooleanInversion" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="ControversialCallSuperInConstructor" level="MINOR" enabled="false" />
|
||||
<coding_rule class="ControversialDataflowAnomalyAnalysis" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="ControversialDefaultPackage" level="MINOR" enabled="false" />
|
||||
<coding_rule class="ControversialDoNotCallGarbageCollectionExplicitly" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="ControversialDontImportSun" level="MINOR" enabled="true" />
|
||||
<coding_rule class="ControversialNullAssignment" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="ControversialOneDeclarationPerLine" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="ControversialOnlyOneReturn" level="MINOR" enabled="false" />
|
||||
<coding_rule class="ControversialSuspiciousOctalEscape" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="ControversialUnnecessaryConstructor" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="ControversialUnnecessaryParentheses" level="MINOR" enabled="false" />
|
||||
<coding_rule class="ControversialUseConcurrentHashMap" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="ControversialUseObjectForClearerAPI" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="CouplingCouplingBetweenObjects" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="CouplingExcessiveImports" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="CouplingLawOfDemeter" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="CouplingLooseCoupling" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="CouplingLoosePackageCoupling" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignAbstractClassWithoutAbstractMethod" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignAbstractClassWithoutAnyMethod" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignAccessorClassGeneration" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignAssignmentToNonFinalStatic" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignAvoidConstantsInterface" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignAvoidDeeplyNestedIfStmts" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignAvoidInstanceofChecksInCatchClause" level="MINOR" enabled="true" />
|
||||
<coding_rule class="DesignAvoidProtectedFieldInFinalClass" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignAvoidReassigningParameters" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignAvoidSynchronizedAtMethodLevel" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignBadComparison" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignClassWithOnlyPrivateConstructorsShouldBeFinal" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignCloseResource" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DesignCompareObjectsWithEquals" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DesignConfusingTernary" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignConstructorCallsOverridableMethod" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DesignDefaultLabelNotLastInSwitchStmt" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignEmptyMethodInAbstractClassShouldBeAbstract" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignEqualsNull" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DesignFieldDeclarationsShouldBeAtStartOfClass" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignFinalFieldCouldBeStatic" level="MINOR" enabled="true" />
|
||||
<coding_rule class="DesignGodClass" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignIdempotentOperations" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DesignImmutableField" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignInstantiationToGetClass" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DesignLogicInversion" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignMissingBreakInSwitch" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="DesignMissingStaticMethodInNonInstantiatableClass" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DesignNonCaseLabelInSwitchStatement" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignNonStaticInitializer" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignNonThreadSafeSingleton" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignOptimizableToArrayCall" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignPositionLiteralsFirstInComparisons" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignPreserveStackTrace" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DesignReturnEmptyArrayRatherThanNull" level="MINOR" enabled="false" />
|
||||
<coding_rule class="DesignSimpleDateFormatNeedsLocale" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignSimplifyBooleanExpressions" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignSimplifyBooleanReturns" level="MINOR" enabled="false" />
|
||||
<coding_rule class="DesignSimplifyConditional" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DesignSingularField" level="MINOR" enabled="true" />
|
||||
<coding_rule class="DesignSwitchDensity" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignSwitchStmtsShouldHaveDefault" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignTooFewBranchesForASwitchStatement" level="MINOR" enabled="false" />
|
||||
<coding_rule class="DesignUncommentedEmptyConstructor" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignUncommentedEmptyMethod" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignUnnecessaryLocalBeforeReturn" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DesignUnsynchronizedStaticDateFormatter" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignUseCollectionIsEmpty" level="MINOR" enabled="false" />
|
||||
<coding_rule class="DesignUseLocaleWithCaseConversions" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignUseNotifyAllInsteadOfNotify" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignUseSingleton" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DesignUseVarargs" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="EmptyCodeEmptyCatchBlock" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="EmptyCodeEmptyFinallyBlock" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="EmptyCodeEmptyIfStmt" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="EmptyCodeEmptyInitializer" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="EmptyCodeEmptyStatementBlock" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="EmptyCodeEmptyStatementNotInLoop" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="EmptyCodeEmptyStaticInitializer" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="EmptyCodeEmptySwitchStatements" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="EmptyCodeEmptySynchronizedBlock" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="EmptyCodeEmptyTryBlock" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="EmptyCodeEmptyWhileStmt" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="FinalizerAvoidCallingFinalize" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="FinalizerEmptyFinalizer" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="FinalizerFinalizeDoesNotCallSuperFinalize" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="FinalizerFinalizeOnlyCallsSuperFinalize" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="FinalizerFinalizeOverloaded" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="FinalizerFinalizeShouldBeProtected" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="ImportStatementsDontImportJavaLang" level="MINOR" enabled="true" />
|
||||
<coding_rule class="ImportStatementsDuplicateImports" level="MINOR" enabled="false" />
|
||||
<coding_rule class="ImportStatementsImportFromSamePackage" level="MINOR" enabled="false" />
|
||||
<coding_rule class="ImportStatementsTooManyStaticImports" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="ImportStatementsUnusedImports" level="INFO" enabled="false" />
|
||||
<coding_rule class="J2EEDoNotCallSystemExit" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="J2EEDoNotUseThreads" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="J2EELocalHomeNamingConvention" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="J2EELocalInterfaceSessionNamingConvention" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="J2EEMDBAndSessionBeanNamingConvention" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="J2EERemoteInterfaceNamingConvention" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="J2EERemoteSessionInterfaceNamingConvention" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="J2EEStaticEJBFieldShouldBeFinal" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="J2EEUseProperClassLoader" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="JUnitJUnitAssertionsShouldIncludeMessage" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="JUnitJUnitSpelling" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="JUnitJUnitStaticSuite" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="JUnitJUnitTestContainsTooManyAsserts" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="JUnitJUnitTestsShouldIncludeAssert" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="JUnitSimplifyBooleanAssertion" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="JUnitTestClassWithoutTestCases" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="JUnitUnnecessaryBooleanAssertion" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="JUnitUseAssertEqualsInsteadOfAssertTrue" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="JUnitUseAssertNullInsteadOfAssertTrue" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="JUnitUseAssertSameInsteadOfAssertTrue" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="JUnitUseAssertTrueInsteadOfAssertEquals" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="JakartaCommonsLoggingGuardDebugLogging" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="JakartaCommonsLoggingProperLogger" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="JakartaCommonsLoggingUseCorrectExceptionLogging" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="JavaBeansBeanMembersShouldSerialize" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="JavaBeansMissingSerialVersionUID" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="JavaLoggingAvoidPrintStackTrace" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="JavaLoggingLoggerIsNotStaticFinal" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="JavaLoggingMoreThanOneLogger" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="JavaLoggingSystemPrintln" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="MigrationAvoidAssertAsIdentifier" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="MigrationAvoidEnumAsIdentifier" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="MigrationByteInstantiation" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="MigrationIntegerInstantiation" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="MigrationJUnit4SuitesShouldUseSuiteAnnotation" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="MigrationJUnit4TestShouldUseAfterAnnotation" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="MigrationJUnit4TestShouldUseBeforeAnnotation" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="MigrationJUnit4TestShouldUseTestAnnotation" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="MigrationJUnitUseExpected" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="MigrationLongInstantiation" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="MigrationReplaceEnumerationWithIterator" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="MigrationReplaceHashtableWithMap" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="MigrationReplaceVectorWithList" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="MigrationShortInstantiation" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NamingAbstractNaming" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NamingAvoidDollarSigns" level="MINOR" enabled="true" />
|
||||
<coding_rule class="NamingAvoidFieldNameMatchingMethodName" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NamingAvoidFieldNameMatchingTypeName" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NamingBooleanGetMethodName" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NamingClassNamingConventions" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="NamingGenericsNaming" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NamingLongVariable" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NamingMethodNamingConventions" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NamingMethodWithSameNameAsEnclosingClass" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="NamingMisleadingVariableName" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NamingNoPackage" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NamingPackageCase" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NamingShortClassName" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NamingShortMethodName" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NamingShortVariable" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NamingSuspiciousConstantFieldName" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="NamingSuspiciousEqualsMethodName" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="NamingSuspiciousHashcodeMethodName" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="NamingVariableNamingConventions" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="OptimizationAddEmptyString" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="OptimizationAvoidArrayLoops" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="OptimizationAvoidInstantiatingObjectsInLoops" level="MINOR" enabled="false" />
|
||||
<coding_rule class="OptimizationLocalVariableCouldBeFinal" level="MINOR" enabled="false" />
|
||||
<coding_rule class="OptimizationMethodArgumentCouldBeFinal" level="MINOR" enabled="false" />
|
||||
<coding_rule class="OptimizationPrematureDeclaration" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="OptimizationRedundantFieldInitializer" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="OptimizationSimplifyStartsWith" level="MINOR" enabled="false" />
|
||||
<coding_rule class="OptimizationUnnecessaryWrapperObjectCreation" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="OptimizationUseArrayListInsteadOfVector" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="OptimizationUseArraysAsList" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="OptimizationUseStringBufferForStringAppends" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="SecurityCodeGuidelinesArrayIsStoredDirectly" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="SecurityCodeGuidelinesMethodReturnsInternalArray" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="StrictExceptionsAvoidCatchingGenericException" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="StrictExceptionsAvoidCatchingNPE" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="StrictExceptionsAvoidCatchingThrowable" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="StrictExceptionsAvoidLosingExceptionInformation" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="StrictExceptionsAvoidRethrowingException" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="StrictExceptionsAvoidThrowingNewInstanceOfSameException" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="StrictExceptionsAvoidThrowingNullPointerException" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="StrictExceptionsAvoidThrowingRawExceptionTypes" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="StrictExceptionsDoNotExtendJavaLangError" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="StrictExceptionsDoNotThrowExceptionInFinally" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="StrictExceptionsExceptionAsFlowControl" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="StrictExceptionsSignatureDeclareThrowsException" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="StringandStringBufferAppendCharacterWithChar" level="MINOR" enabled="false" />
|
||||
<coding_rule class="StringandStringBufferAvoidDuplicateLiterals" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="StringandStringBufferAvoidStringBufferField" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="StringandStringBufferConsecutiveLiteralAppends" level="MINOR" enabled="false" />
|
||||
<coding_rule class="StringandStringBufferInefficientEmptyStringCheck" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="StringandStringBufferInefficientStringBuffering" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="StringandStringBufferInsufficientStringBufferDeclaration" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="StringandStringBufferStringBufferInstantiationWithChar" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="StringandStringBufferStringInstantiation" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="StringandStringBufferStringToString" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="StringandStringBufferUnnecessaryCaseChange" level="MINOR" enabled="true" />
|
||||
<coding_rule class="StringandStringBufferUseEqualsToCompareStrings" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="StringandStringBufferUseIndexOfChar" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="StringandStringBufferUseStringBufferLength" level="MINOR" enabled="true" />
|
||||
<coding_rule class="StringandStringBufferUselessStringValueOf" level="MINOR" enabled="true" />
|
||||
<coding_rule class="TypeResolutionCloneMethodMustImplementCloneable" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="TypeResolutionLooseCoupling" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="TypeResolutionSignatureDeclareThrowsException" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="TypeResolutionUnusedImports" level="INFO" enabled="false" />
|
||||
<coding_rule class="UnnecessaryUnnecessaryConversionTemporary" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="UnnecessaryUnnecessaryFinalModifier" level="INFO" enabled="false" />
|
||||
<coding_rule class="UnnecessaryUnnecessaryReturn" level="MINOR" enabled="false" />
|
||||
<coding_rule class="UnnecessaryUnusedNullCheckInEquals" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="UnnecessaryUselessOperationOnImmutable" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="UnnecessaryUselessOverridingMethod" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="UnnecessaryUselessParentheses" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="UnusedCodeUnusedFormalParameter" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="UnusedCodeUnusedLocalVariable" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="UnusedCodeUnusedModifier" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="UnusedCodeUnusedPrivateField" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="UnusedCodeUnusedPrivateMethod" level="MAJOR" enabled="true" />
|
||||
</profile>
|
||||
</profiles>
|
||||
<list size="0" />
|
||||
</component>
|
||||
</project>
|
@ -7,8 +7,8 @@ android {
|
||||
applicationId "com.farsunset.ichat.example"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 21
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
versionCode 31
|
||||
versionName "3.1.0"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
@ -31,9 +31,7 @@ android {
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile 'com.android.support:appcompat-v7:25.1.0'
|
||||
compile 'com.google.protobuf:protobuf-java:3.2.0'
|
||||
compile 'org.apache.mina:mina-core:2.0.16'
|
||||
compile 'org.slf4j:slf4j-api:1.7.24'
|
||||
compile 'org.slf4j:slf4j-nop:1.7.24'
|
||||
compile 'com.google.protobuf:protobuf-java:3.3.0'
|
||||
compile 'com.android.support:appcompat-v7:25.3.1'
|
||||
|
||||
}
|
||||
|
Binary file not shown.
BIN
cim_for_netty/cim-client-android/app/libs/cim-server-sdk-3.1.jar
Normal file
BIN
cim_for_netty/cim-client-android/app/libs/cim-server-sdk-3.1.jar
Normal file
Binary file not shown.
@ -1,8 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.farsunset.ichat.example"
|
||||
android:versionCode="30"
|
||||
android:versionName="3.0.0" >
|
||||
>
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
@ -47,8 +46,13 @@
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<!--推送服务-->
|
||||
<service android:name="com.farsunset.cim.sdk.android.CIMPushService" android:process=":cimpush" />
|
||||
<!-- ****************************************CIM推送配置 begin*************************************** -->
|
||||
<service android:name="com.farsunset.cim.sdk.android.CIMPushService" android:process=":cimpush" />
|
||||
<provider android:name="com.farsunset.cim.sdk.android.CIMCacheProvider"
|
||||
android:authorities="com.farsunset.cim.provider"
|
||||
android:process=":cimpush"
|
||||
android:exported="false" />
|
||||
<!-- ****************************************CIM推送配置 end*************************************** -->
|
||||
|
||||
<!--消息接受广播注册-->
|
||||
<receiver android:name="com.farsunset.ichat.example.receiver.CIMPushManagerReceiver" android:exported="false">
|
||||
|
@ -24,7 +24,7 @@ package com.farsunset.ichat.example.app;
|
||||
public interface Constant {
|
||||
|
||||
//服务端IP地址
|
||||
public static final String CIM_SERVER_HOST = "172.168.11.28";
|
||||
public static final String CIM_SERVER_HOST = "172.168.141.13";
|
||||
|
||||
|
||||
//注意,这里的端口不是tomcat的端口,CIM端口在服务端spring-cim.xml中配置的,没改动就使用默认的23456
|
||||
|
@ -116,7 +116,6 @@ public final class CIMPushManagerReceiver extends CIMEventBroadcastReceiver {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onConnectionFailed() {
|
||||
// TODO Auto-generated method stub
|
||||
|
@ -73,8 +73,8 @@ public class LoginActivity extends CIMMonitorActivity implements
|
||||
if(!autoBind)
|
||||
CIMPushManager.bindAccount(this, accountEdit.getText().toString().trim());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onReplyReceived(final ReplyBody reply) {
|
||||
|
||||
|
@ -69,8 +69,9 @@ public class SplanshActivity extends CIMMonitorActivity{
|
||||
finish();
|
||||
CIMPushManager.destroy(this);
|
||||
}
|
||||
public void onConnectionFailed(Exception e){
|
||||
|
||||
showToask("连接服务器失败,请检查当前设备是否能连接上服务器IP和端口");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectionFailed() {
|
||||
showToask("连接服务器失败,请检查当前设备是否能连接上服务器IP和端口");
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.2.3'
|
||||
classpath 'com.android.tools.build:gradle:2.3.0'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
Loading…
x
Reference in New Issue
Block a user