1 修改消息断包时没有正确处理,导致消息接收不到的问题

2  修改多处细节问题
This commit is contained in:
远方夕阳 2016-07-14 11:26:42 +08:00
parent 2c07c3a173
commit 3585cf4eb2
75 changed files with 264 additions and 363 deletions

4
.gitignore vendored
View File

@ -6,5 +6,7 @@
*.apk
.fatjar
bin/
bin/
classes/

View File

@ -2,8 +2,7 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="D:/cim-system/cim-server/WebRoot/WEB-INF/lib/log4j.jar"/>
<classpathentry kind="lib" path="/cim-server/WebRoot/WEB-INF/lib/mina-core-2.0.13.jar"/>
<classpathentry kind="lib" path="D:/dev/Android-SDK-Windows/platforms/android-21/android.jar"/>
<classpathentry kind="lib" path="C:/dev/android-sdk-windows/platforms/android-22/android.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/
@ -40,7 +40,7 @@ import com.farsunset.cim.sdk.android.model.SentBody;
*
* @author 3979434@qq.com
*/
class CIMConnectorManager {
class CIMConnectorManager extends IoHandlerAdapter implements KeepAliveMessageFactory{
final static String TAG = CIMConnectorManager.class.getSimpleName();
private NioSocketConnector connector;
@ -82,9 +82,9 @@ class CIMConnectorManager {
public final static String ACTION_CONNECTION_RECOVERY = "com.farsunset.cim.CONNECTION_RECOVERY";
private ExecutorService executor;
private CIMConnectorManager(Context ctx) {
private CIMConnectorManager(Context ctx) {
context = ctx;
executor = Executors.newFixedThreadPool(1);
executor = Executors.newCachedThreadPool();
connector = new NioSocketConnector();
connector.setConnectTimeoutMillis(10 * 1000);
@ -93,10 +93,10 @@ class CIMConnectorManager {
connector.getSessionConfig().setReadBufferSize(2048);
connector.getFilterChain().addLast("codec", new ProtocolCodecFilter(new ClientMessageCodecFactory()));
KeepAliveFilter keepAliveaHandler = new KeepAliveFilter(new ClientKeepAliveFactoryImpl(), IdleStatus.BOTH_IDLE);
KeepAliveFilter keepAliveaHandler = new KeepAliveFilter(this, IdleStatus.BOTH_IDLE);
keepAliveaHandler.setForwardEvent(true);
connector.getFilterChain().addLast("heartbeat", keepAliveaHandler);
connector.setHandler(iohandler);
connector.setHandler(this);
@ -252,98 +252,94 @@ class CIMConnectorManager {
return null;
}
IoHandlerAdapter iohandler = new IoHandlerAdapter() {
@Override
public void sessionCreated(IoSession session) throws Exception {
@Override
public void sessionCreated(IoSession session) throws Exception {
Log.i(TAG, "******************CIM连接服务器成功:"+session.getLocalAddress());
setLastHeartbeatTime(session);
Intent intent = new Intent();
intent.setAction(ACTION_CONNECTION_SUCCESSED);
context.sendBroadcast(intent);
Log.i(TAG, "******************CIM连接服务器成功:"+session.getLocalAddress());
setLastHeartbeatTime(session);
Intent intent = new Intent();
intent.setAction(ACTION_CONNECTION_SUCCESSED);
context.sendBroadcast(intent);
}
@Override
public void sessionOpened(IoSession session) throws Exception {
session.getConfig().setBothIdleTime(180);
}
@Override
public void sessionClosed(IoSession session) throws Exception {
Log.e(TAG, "******************CIM与服务器断开连接:"+session.getLocalAddress());
Intent intent = new Intent();
intent.setAction(ACTION_CONNECTION_CLOSED);
context.sendBroadcast(intent);
}
@Override
public void sessionIdle(IoSession session, IdleStatus status)throws Exception {
Log.d(TAG, "******************CIM与服务器连接空闲:"+session.getLocalAddress() + " isActive:" + session.isActive()+ " isConnected:" + session.isConnected());
/**
* 用于解决wifi情况下偶而路由器与服务器断开连接时客户端并没及时收到关闭事件
* 导致这样的情况下当前连接无效也不会重连的问题
*
*/
long lastHeartbeatTime = getLastHeartbeatTime(session);
if(System.currentTimeMillis() - lastHeartbeatTime >= HEARBEAT_TIME_OUT)
{
session.closeNow();
}
}
@Override
public void sessionOpened(IoSession session) throws Exception {
session.getConfig().setBothIdleTime(180);
}
@Override
public void exceptionCaught(IoSession session, Throwable cause)
throws Exception {
@Override
public void sessionClosed(IoSession session) throws Exception {
Intent intent = new Intent();
intent.setAction(ACTION_UNCAUGHT_EXCEPTION);
intent.putExtra("exception", cause);
context.sendBroadcast(intent);
}
Log.e(TAG, "******************CIM与服务器断开连接:"+session.getLocalAddress());
Intent intent = new Intent();
intent.setAction(ACTION_CONNECTION_CLOSED);
context.sendBroadcast(intent);
@Override
public void messageReceived(IoSession session, Object obj)
throws Exception {
}
@Override
public void sessionIdle(IoSession session, IdleStatus status)throws Exception {
Log.d(TAG, "******************CIM与服务器连接空闲:"+session.getLocalAddress() + " isActive:" + session.isActive()+ " isConnected:" + session.isConnected());
/**
* 用于解决wifi情况下偶而路由器与服务器断开连接时客户端并没及时收到关闭事件
* 导致这样的情况下当前连接无效也不会重连的问题
*
*/
long lastHeartbeatTime = getLastHeartbeatTime(session);
if(System.currentTimeMillis() - lastHeartbeatTime >= HEARBEAT_TIME_OUT)
{
session.closeNow();
}
}
@Override
public void exceptionCaught(IoSession session, Throwable cause)
throws Exception {
if (obj instanceof Message) {
Intent intent = new Intent();
intent.setAction(ACTION_UNCAUGHT_EXCEPTION);
intent.putExtra("exception", cause);
intent.setAction(ACTION_MESSAGE_RECEIVED);
intent.putExtra("message", (Message) obj);
context.sendBroadcast(intent);
}
if (obj instanceof ReplyBody) {
Intent intent = new Intent();
intent.setAction(ACTION_REPLY_RECEIVED);
intent.putExtra("replyBody", (ReplyBody) obj);
context.sendBroadcast(intent);
}
}
@Override
public void messageReceived(IoSession session, Object obj)
throws Exception {
if (obj instanceof Message) {
Intent intent = new Intent();
intent.setAction(ACTION_MESSAGE_RECEIVED);
intent.putExtra("message", (Message) obj);
context.sendBroadcast(intent);
}
if (obj instanceof ReplyBody) {
Intent intent = new Intent();
intent.setAction(ACTION_REPLY_RECEIVED);
intent.putExtra("replyBody", (ReplyBody) obj);
context.sendBroadcast(intent);
}
@Override
public void messageSent(IoSession session, Object message) throws Exception {
if(message instanceof SentBody)
{
Intent intent = new Intent();
intent.setAction(ACTION_SENT_SUCCESSED);
intent.putExtra("sentBody", (SentBody) message);
context.sendBroadcast(intent);
}
@Override
public void messageSent(IoSession session, Object message) throws Exception {
if(message instanceof SentBody)
{
Intent intent = new Intent();
intent.setAction(ACTION_SENT_SUCCESSED);
intent.putExtra("sentBody", (SentBody) message);
context.sendBroadcast(intent);
}
}
};
}
private void setLastHeartbeatTime(IoSession session)
{
@ -370,30 +366,27 @@ class CIMConnectorManager {
return false;
}
public class ClientKeepAliveFactoryImpl implements KeepAliveMessageFactory {
@Override
public Object getRequest(IoSession arg0) {
return null;
}
@Override
public Object getResponse(IoSession arg0, Object arg1) {
return CIMConstant.CMD_HEARTBEAT_RESPONSE;
}
@Override
public boolean isRequest(IoSession session, Object data) {
setLastHeartbeatTime(session);
return CIMConstant.CMD_HEARTBEAT_REQUEST.equalsIgnoreCase(data.toString());
}
@Override
public boolean isResponse(IoSession arg0, Object arg1) {
return false;
}
@Override
public Object getRequest(IoSession arg0) {
return null;
}
@Override
public Object getResponse(IoSession arg0, Object arg1) {
return CIMConstant.CMD_HEARTBEAT_RESPONSE;
}
@Override
public boolean isRequest(IoSession session, Object data) {
setLastHeartbeatTime(session);
return CIMConstant.CMD_HEARTBEAT_REQUEST.equalsIgnoreCase(data.toString());
}
@Override
public boolean isResponse(IoSession arg0, Object arg1) {
return false;
}
}

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/
@ -11,6 +11,7 @@ import android.content.Intent;
import android.os.IBinder;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.util.Log;
import com.farsunset.cim.sdk.android.model.SentBody;
@ -20,7 +21,7 @@ import com.farsunset.cim.sdk.android.model.SentBody;
*
*/
public class CIMPushService extends Service {
final static String TAG = CIMPushService.class.getSimpleName();
protected final static int DEF_CIM_PORT = 28888;
CIMConnectorManager manager;
WakeLock wakeLock;
@ -67,12 +68,19 @@ import com.farsunset.cim.sdk.android.model.SentBody;
android.os.Process.killProcess(android.os.Process.myPid());
}
if(CIMPushManager.ACTION_ACTIVATE_PUSH_SERVICE.equals(action) && !manager.isConnected())
if(CIMPushManager.ACTION_ACTIVATE_PUSH_SERVICE.equals(action) )
{
if(!manager.isConnected()){
boolean isManualStop = CIMCacheToolkit.getInstance(this).getBoolean(CIMCacheToolkit.KEY_MANUAL_STOP);
Log.i(TAG, "CIM.isConnected() == false, isManualStop == " + isManualStop);
CIMPushManager.connect(this);
}else
{
Log.i(TAG, "CIM.isConnected() == true");
}
String host = CIMCacheToolkit.getInstance(this).getString(CIMCacheToolkit.KEY_CIM_SERVIER_HOST);
int port =CIMCacheToolkit.getInstance(this).getInt( CIMCacheToolkit.KEY_CIM_SERVIER_PORT);
manager.connect(host,port);
}
try{

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/
@ -52,8 +52,6 @@ public interface CIMConstant {
public static String CLIENT_BIND ="client_bind";
public static String CLIENT_LOGOUT ="client_logout";
public static String CLIENT_OFFLINE_MESSAGE ="client_get_offline_message";
}

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/
@ -31,13 +31,14 @@ public class ClientMessageDecoder extends CumulativeProtocolDecoder {
final static String TAG = ClientMessageDecoder.class.getSimpleName();
private IoBuffer buff = IoBuffer.allocate(320).setAutoExpand(true);
@Override
public boolean doDecode(IoSession iosession, IoBuffer iobuffer,
ProtocolDecoderOutput out) throws Exception {
public boolean doDecode(IoSession iosession, IoBuffer iobuffer,ProtocolDecoderOutput out) throws Exception {
boolean complete = false;
IoBuffer tBuffer = IoBuffer.allocate(320).setAutoExpand(true);
iobuffer.mark();
while (iobuffer.hasRemaining()) {
byte b = iobuffer.get();
/**
@ -49,16 +50,16 @@ public class ClientMessageDecoder extends CumulativeProtocolDecoder {
complete = true;
break;
} else {
buff.put(b);
tBuffer.put(b);
}
}
if (complete) {
buff.flip();
byte[] bytes = new byte[buff.limit()];
buff.get(bytes);
tBuffer.flip();
byte[] bytes = new byte[tBuffer.limit()];
tBuffer.get(bytes);
String message = new String(bytes, CIMConstant.UTF8);
buff.clear();
tBuffer.clear();
try
{
@ -68,6 +69,9 @@ public class ClientMessageDecoder extends CumulativeProtocolDecoder {
{
e.printStackTrace();
}
}else
{
iobuffer.reset();//如果消息没有接收完整对buffer进行重置下次继续读取
}
return complete;
@ -96,7 +100,7 @@ public class ClientMessageDecoder extends CumulativeProtocolDecoder {
NodeList items = doc.getElementsByTagName("data").item(0).getChildNodes();
for (int i = 0; i < items.getLength(); i++) {
Node node = items.item(i);
reply.getData().put(node.getNodeName(), node.getTextContent());
reply.put(node.getNodeName(), node.getTextContent());
}
return reply;
}

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/

View File

@ -28,10 +28,14 @@ import com.farsunset.cim.sdk.server.model.SentBody;
public class ServerMessageDecoder extends CumulativeProtocolDecoder {
protected final Logger logger = Logger.getLogger(ServerMessageDecoder.class);
private IoBuffer buff = IoBuffer.allocate(320).setAutoExpand(true);
@Override
public boolean doDecode(IoSession iosession, IoBuffer iobuffer, ProtocolDecoderOutput out) throws Exception {
boolean complete = false;
IoBuffer tBuffer = IoBuffer.allocate(320).setAutoExpand(true);
iobuffer.mark();
while (iobuffer.hasRemaining()) {
byte b = iobuffer.get();
/**
@ -48,19 +52,19 @@ public class ServerMessageDecoder extends CumulativeProtocolDecoder {
break;
}
else {
buff.put(b);
tBuffer.put(b);
}
}
if (complete) {
buff.flip();
byte[] bytes = new byte[buff.limit()];
buff.get(bytes);
tBuffer.flip();
byte[] bytes = new byte[tBuffer.limit()];
tBuffer.get(bytes);
String message = new String(bytes, CIMConstant.UTF8);
logger.debug(message);
buff.clear();
tBuffer.clear();
try{
Object body = getSentBody(message);
@ -70,6 +74,9 @@ public class ServerMessageDecoder extends CumulativeProtocolDecoder {
e.printStackTrace();
logger.warn(e.getMessage());
}
}else
{
iobuffer.reset();//如果消息没有接收完整对buffer进行重置下次继续读取
}
return complete;
}

View File

@ -81,20 +81,10 @@ public class CIMIoHandler extends IoHandlerAdapter {
/**
*/
public void sessionClosed(IoSession ios) throws Exception {
logger.warn(ios.getRemoteAddress());
CIMSession cimSession =new CIMSession(ios);
try{
logger.warn("sessionClosed()... from "+cimSession.getRemoteAddress());
CIMRequestHandler handler = handlers.get(CIMSESSION_CLOSED_HANDLER_KEY);
if(handler!=null && cimSession.containsAttribute(CIMConstant.SESSION_KEY))
{
handler.process(cimSession, null);
}
}
catch(Exception e)
{
e.printStackTrace();
}
CIMRequestHandler handler = handlers.get(CIMSESSION_CLOSED_HANDLER_KEY);
handler.process(cimSession, null);
}
/**

View File

@ -1,6 +1,6 @@
/**
* probject:cim-server-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/

View File

@ -6,7 +6,6 @@
<classpathentry kind="con" path="melibrary.com.genuitec.eclipse.j2eedt.core.MYECLIPSE_JAVAEE_5_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry combineaccessrules="false" kind="src" path="/cim-server-sdk"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/Spring.aop-3.0.2.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/Spring.asm-3.0.2.RELEASE.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/Spring.beans-3.0.2.RELEASE.jar"/>
@ -20,6 +19,7 @@
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/antlr-2.7.6.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/asm.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/aspectjweaver.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/cim-server-sdk-2.1.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-fileupload-1.2.1.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-io-2.4.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-lang-2.3.jar"/>
@ -30,6 +30,7 @@
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/httpcore-4.3.2.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/jstl-1.2.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/log4j.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/mina-core-2.0.13.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/ognl-2.7.3.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/slf4j-api-1.7.5.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/slf4j-nop-1.7.5.jar"/>
@ -37,6 +38,5 @@
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/struts2-core-2.1.8.1.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/xstream-1.3.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/xwork-core-2.1.6.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/mina-core-2.0.13.jar"/>
<classpathentry kind="output" path="WebRoot/WEB-INF/classes"/>
</classpath>

View File

@ -1,37 +0,0 @@
/**
* probject:cim
* @version 2.0
*
* @author 3979434@qq.com
*/
package com.farsunset.cim.handler;
import com.farsunset.cim.sdk.server.constant.CIMConstant;
import com.farsunset.cim.sdk.server.handler.CIMRequestHandler;
import com.farsunset.cim.sdk.server.model.ReplyBody;
import com.farsunset.cim.sdk.server.model.SentBody;
import com.farsunset.cim.sdk.server.session.CIMSession;
import com.farsunset.cim.sdk.server.session.DefaultSessionManager;
import com.farsunset.cim.util.ContextHolder;
/**
* 退出连接实现
*/
public class LogoutHandler implements CIMRequestHandler {
public ReplyBody process(CIMSession ios, SentBody message) {
DefaultSessionManager sessionManager = ((DefaultSessionManager) ContextHolder.getBean("CIMSessionManager"));
String account =ios.getAttribute(CIMConstant.SESSION_KEY).toString();
ios.removeAttribute(CIMConstant.SESSION_KEY);
ios.closeNow();
sessionManager.remove(account);
return null;
}
}

View File

@ -26,15 +26,12 @@ public class SessionClosedHandler implements CIMRequestHandler {
public ReplyBody process(CIMSession ios, SentBody message) {
DefaultSessionManager sessionManager = ((DefaultSessionManager) ContextHolder.getBean("CIMSessionManager"));
if(ios.getAttribute(CIMConstant.SESSION_KEY)==null)
{
return null;
}
DefaultSessionManager sessionManager = ((DefaultSessionManager) ContextHolder.getBean("CIMSessionManager"));
String account = ios.getAttribute(CIMConstant.SESSION_KEY).toString();
sessionManager.remove(account);
String account =ios.getAttribute(CIMConstant.SESSION_KEY).toString();
ios.removeAttribute(CIMConstant.SESSION_KEY);
ios.closeNow();
sessionManager.remove(account);
return null;
}

View File

@ -1,13 +1,13 @@
log4j.rootLogger=debug,console, file
log4j.rootLogger=info,console, file
#----------console----------------
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.Target=System.out
log4j.appender.console.layout.ConversionPattern=%C %p %d{yyyy-MM-dd HH:mm:ss}%n%m%n--------------------------------------------------------------------------------------------------------------------------%n
log4j.appender.console.layout.ConversionPattern=%C.%M() %p %d{yyyy-MM-dd HH:mm:ss}%n%m%n--------------------------------------------------------------------------------------------------------------------------%n
#----------file----------------
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=cim.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%C %p %d{yyyy-MM-dd HH\:mm\:ss} - %m%n
log4j.appender.file.layout.ConversionPattern=%C.%M() %p %d{yyyy-MM-dd HH:mm:ss}%n%m%n--------------------------------------------------------------------------------------------------------------------------%n

View File

@ -21,9 +21,7 @@
<entry key="client_bind">
<bean class="com.farsunset.cim.handler.BindHandler" />
</entry>
<entry key="client_logout">
<bean class="com.farsunset.cim.handler.LogoutHandler" />
</entry>
<entry key="client_cimsession_closed">
<bean class="com.farsunset.cim.handler.SessionClosedHandler"/>
</entry>

View File

@ -1,9 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="lib" path="libs/android-support-v4.jar"/>
<classpathentry kind="lib" path="libs/fastjson-1.1.47.android.jar"/>
<classpathentry kind="lib" path="libs/httpmime-4.1.1.jar"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.farsunset.ichat.example"
android:versionCode="2"
android:versionName="2.0.0" >
android:versionCode="3"
android:versionName="2.1.0" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

View File

@ -6,29 +6,14 @@
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-dontwarn
-keep public class com.adview.** {*;}
-keeppackagenames com.madhouse.android.ads
-keepclassmembers class * {public *;}
-keep public class com.wqmobile.sdk.** {*;}
-keep public class * {public *;}
-keep public class com.adwo.adsdk.AdwoAdBrowserActivity
-keep public class com.wooboo.** {*;}
-keep public class cn.aduu.adsdk.**{*;}
-keep class net.youmi.android.** {*;}
-keep public class org.apache.mina.** {*;}
-keep public class com.farsunset.cim.sdk.android.model.** {*;}
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class com.android.vending.licensing.ILicensingService
-keep public class MobWin.*
-keep public class MobWin.cnst.*
-keep class com.tencent.lbsapi.*
-keep class com.tencent.lbsapi.core.*
-keep class LBSAPIProtocol.*
-keep class com.tencent.lbsapi.core.QLBSJNI {
*;
}
-keepclasseswithmembernames class * {
native <methods>;
}

View File

@ -8,4 +8,4 @@
# project structure.
# Project target.
target=android-19
target=android-22

View File

@ -9,7 +9,7 @@ package com.farsunset.ichat.example.app;
public interface Constant {
//服务端IP地址
public static final String CIM_SERVER_HOST = "192.168.2.2";
public static final String CIM_SERVER_HOST = "192.168.191.1";
//服务端web地址
public static final String SERVER_URL = "http://"+CIM_SERVER_HOST+":8080/cim-server";

View File

@ -2,11 +2,11 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="C:/dev/Android-SDK-Windows/platforms/android-19/android.jar"/>
<classpathentry kind="lib" path="/cim-server/WebRoot/WEB-INF/lib/netty-codec-4.1.0.CR7.jar"/>
<classpathentry kind="lib" path="/cim-server/WebRoot/WEB-INF/lib/netty-handler-4.1.0.CR7.jar"/>
<classpathentry kind="lib" path="/cim-server/WebRoot/WEB-INF/lib/netty-buffer-4.1.0.CR7.jar"/>
<classpathentry kind="lib" path="/cim-server/WebRoot/WEB-INF/lib/netty-transport-4.1.0.CR7.jar"/>
<classpathentry kind="lib" path="/cim-server/WebRoot/WEB-INF/lib/netty-common-4.1.0.CR7.jar"/>
<classpathentry kind="lib" path="C:/dev/android-sdk-windows/platforms/android-22/android.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

Binary file not shown.

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/

View File

@ -94,7 +94,7 @@ class CIMConnectorManager extends SimpleChannelInboundHandler<Object> {
private CIMConnectorManager(Context ctx) {
context = ctx;
executor = Executors.newFixedThreadPool(3);
executor = Executors.newCachedThreadPool();
bootstrap = new Bootstrap();
loopGroup = new NioEventLoopGroup();
bootstrap.group(loopGroup);
@ -104,7 +104,7 @@ class CIMConnectorManager extends SimpleChannelInboundHandler<Object> {
@Override
public void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline pipeline = ch.pipeline();
pipeline.addLast(new ClientMessageDecoder(ClassResolvers.cacheDisabled(null)));
pipeline.addLast(new ClientMessageDecoder(ClassResolvers.cacheDisabled(CIMConnectorManager.class.getClassLoader())));
pipeline.addLast(new ClientMessageEncoder());
pipeline.addLast(new IdleStateHandler(READ_IDLE_TIME,0,0));
pipeline.addLast(CIMConnectorManager.this);

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/
@ -11,6 +11,7 @@ import android.content.Intent;
import android.os.IBinder;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.util.Log;
import com.farsunset.cim.sdk.android.model.SentBody;
@ -20,7 +21,7 @@ import com.farsunset.cim.sdk.android.model.SentBody;
*
*/
public class CIMPushService extends Service {
final static String TAG = CIMPushService.class.getSimpleName();
protected final static int DEF_CIM_PORT = 28888;
CIMConnectorManager manager;
WakeLock wakeLock;
@ -67,14 +68,22 @@ import com.farsunset.cim.sdk.android.model.SentBody;
android.os.Process.killProcess(android.os.Process.myPid());
}
if(CIMPushManager.ACTION_ACTIVATE_PUSH_SERVICE.equals(action) && !manager.isConnected())
if(CIMPushManager.ACTION_ACTIVATE_PUSH_SERVICE.equals(action) )
{
if(!manager.isConnected()){
boolean isManualStop = CIMCacheToolkit.getInstance(this).getBoolean(CIMCacheToolkit.KEY_MANUAL_STOP);
Log.d(TAG, "CIM.isConnected() == false, isManualStop == " + isManualStop);
CIMPushManager.connect(this);
}else
{
Log.d(TAG, "CIM.isConnected() == true");
}
String host = CIMCacheToolkit.getInstance(this).getString(CIMCacheToolkit.KEY_CIM_SERVIER_HOST);
int port =CIMCacheToolkit.getInstance(this).getInt( CIMCacheToolkit.KEY_CIM_SERVIER_PORT);
manager.connect(host,port);
}
try{
if(!wakeLock.isHeld())
{

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/
@ -52,7 +52,6 @@ public interface CIMConstant {
public static String CLIENT_BIND ="client_bind";
public static String CLIENT_LOGOUT ="client_logout";
public static String CLIENT_OFFLINE_MESSAGE ="client_get_offline_message";

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/

View File

@ -39,6 +39,8 @@ public class ClientMessageDecoder extends ObjectDecoder {
public Object decode(ChannelHandlerContext arg0, ByteBuf buffer) throws Exception {
int length = buffer.readableBytes();
buffer.markReaderIndex();
/**
* CIMConstant.MESSAGE_SEPARATE 为消息界限
* 当一次收到多个消息时以此分隔解析多个消息
@ -58,7 +60,8 @@ public class ClientMessageDecoder extends ObjectDecoder {
message = null;
return msg;
}
buffer.resetReaderIndex();
return null;
}

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/

View File

@ -1,6 +1,6 @@
/**
* probject:cim-android-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/

View File

@ -2,11 +2,11 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="/cim-server/WebRoot/WEB-INF/lib/log4j.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.7.0_80"/>
<classpathentry kind="lib" path="/cim-server/WebRoot/WEB-INF/lib/netty-buffer-4.1.0.CR7.jar"/>
<classpathentry kind="lib" path="/cim-server/WebRoot/WEB-INF/lib/netty-codec-4.1.0.CR7.jar"/>
<classpathentry kind="lib" path="/cim-server/WebRoot/WEB-INF/lib/netty-common-4.1.0.CR7.jar"/>
<classpathentry kind="lib" path="/cim-server/WebRoot/WEB-INF/lib/netty-handler-4.1.0.CR7.jar"/>
<classpathentry kind="lib" path="/cim-server/WebRoot/WEB-INF/lib/netty-transport-4.1.0.CR7.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -35,7 +35,7 @@ public class ServerMessageDecoder extends ObjectDecoder {
int length = buffer.readableBytes();
buffer.markReaderIndex();
/**
* CIMConstant.MESSAGE_SEPARATE 为消息界限
* 当一次收到多个消息时以此分隔解析多个消息
@ -81,6 +81,8 @@ public class ServerMessageDecoder extends ObjectDecoder {
return message;
}
buffer.resetReaderIndex();
return null;
}

View File

@ -62,7 +62,7 @@ public class CIMNioSocketAcceptor extends SimpleChannelInboundHandler<SentBody>{
public void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline pipeline = ch.pipeline();
pipeline.addLast(new ServerMessageDecoder(ClassResolvers.cacheDisabled(null)));
pipeline.addLast(new ServerMessageDecoder(ClassResolvers.cacheDisabled(CIMNioSocketAcceptor.class.getClassLoader())));
pipeline.addLast(new ServerMessageEncoder());
pipeline.addLast(new IdleStateHandler(READ_IDLE_TIME,WRITE_IDLE_TIME,0));
pipeline.addLast(CIMNioSocketAcceptor.this);
@ -93,10 +93,8 @@ public class CIMNioSocketAcceptor extends SimpleChannelInboundHandler<SentBody>{
*/
public void exceptionCaught( ChannelHandlerContext ctx, Throwable cause)
throws Exception {
logger.error("exceptionCaught()... from "+ctx.channel().remoteAddress());
ctx.channel().close();
CIMRequestHandler handler = handlers.get(CIMConstant.RequestKey.KEY_CLIENT_CIMSESSION_CLOSED);
handler.process(new CIMSession(ctx.channel()), null);
logger.error(ctx.channel().remoteAddress());
}
@ -163,7 +161,9 @@ public class CIMNioSocketAcceptor extends SimpleChannelInboundHandler<SentBody>{
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
logger.debug("channelInactive-----------"+ctx.channel().remoteAddress());
logger.warn(ctx.channel().remoteAddress());
CIMRequestHandler handler = handlers.get(CIMConstant.RequestKey.KEY_CLIENT_CIMSESSION_CLOSED);
handler.process(new CIMSession(ctx.channel()), null);
}

View File

@ -1,6 +1,6 @@
/**
* probject:cim-server-sdk
* @version 2.0.0
* @version 2.1.0
*
* @author 3979434@qq.com
*/

View File

@ -6,7 +6,6 @@
<classpathentry kind="con" path="melibrary.com.genuitec.eclipse.j2eedt.core.MYECLIPSE_JAVAEE_5_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry combineaccessrules="false" kind="src" path="/cim-server-sdk"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/Spring.aop-3.0.2.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/Spring.asm-3.0.2.RELEASE.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/Spring.beans-3.0.2.RELEASE.jar"/>
@ -22,6 +21,7 @@
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/aspectjweaver.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-fileupload-1.2.1.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-io-2.4.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-lang-2.3.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-logging-1.0.4.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/freemarker-2.3.15.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/gson-2.1.jar"/>
@ -29,14 +29,6 @@
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/httpcore-4.3.2.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/jstl-1.2.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/log4j.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/ognl-2.7.3.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/slf4j-api-1.7.5.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/slf4j-nop-1.7.5.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-context-support.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/struts2-core-2.1.8.1.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/xstream-1.3.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/xwork-core-2.1.6.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-lang-2.3.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/netty-buffer-4.1.0.CR7.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/netty-codec-4.1.0.CR7.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/netty-codec-memcache-4.1.0.CR7.jar"/>
@ -46,5 +38,13 @@
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/netty-handler-proxy-4.1.0.CR7.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/netty-resolver-4.1.0.CR7.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/netty-transport-4.1.0.CR7.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/ognl-2.7.3.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/slf4j-api-1.7.5.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/slf4j-nop-1.7.5.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-context-support.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/struts2-core-2.1.8.1.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/xstream-1.3.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/xwork-core-2.1.6.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/cim-server-sdk-2.1.jar"/>
<classpathentry kind="output" path="WebRoot/WEB-INF/classes"/>
</classpath>

View File

@ -1,13 +1,13 @@
log4j.rootLogger=debug,console, file
log4j.rootLogger=info,console, file
#----------console----------------
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.Target=System.out
log4j.appender.console.layout.ConversionPattern=%C %p %d{yyyy-MM-dd HH:mm:ss}%n%m%n--------------------------------------------------------------------------------------------------------------------------%n
log4j.appender.console.layout.ConversionPattern=%C.%M() %p %d{yyyy-MM-dd HH:mm:ss}%n%m%n--------------------------------------------------------------------------------------------------------------------------%n
#----------file----------------
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=cim.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%C %p %d{yyyy-MM-dd HH\:mm\:ss} - %m%n
log4j.appender.console.layout.ConversionPattern=%C.%M() %p %d{yyyy-MM-dd HH:mm:ss}%n%m%n--------------------------------------------------------------------------------------------------------------------------%n

View File

@ -21,9 +21,7 @@
<entry key="client_bind">
<bean class="com.farsunset.cim.handler.BindHandler" />
</entry>
<entry key="client_logout">
<bean class="com.farsunset.cim.handler.LogoutHandler" />
</entry>
<entry key="client_cimsession_closed">
<bean class="com.farsunset.cim.handler.SessionClosedHandler"/>
</entry>

View File

@ -1,37 +0,0 @@
/**
* probject:cim
* @version 2.0
*
* @author 3979434@qq.com
*/
package com.farsunset.cim.handler;
import com.farsunset.cim.sdk.server.constant.CIMConstant;
import com.farsunset.cim.sdk.server.handler.CIMRequestHandler;
import com.farsunset.cim.sdk.server.model.ReplyBody;
import com.farsunset.cim.sdk.server.model.SentBody;
import com.farsunset.cim.sdk.server.session.CIMSession;
import com.farsunset.cim.sdk.server.session.DefaultSessionManager;
import com.farsunset.cim.util.ContextHolder;
/**
* 退出连接实现
*/
public class LogoutHandler implements CIMRequestHandler {
public ReplyBody process(CIMSession ios, SentBody message) {
DefaultSessionManager sessionManager = ((DefaultSessionManager) ContextHolder.getBean("CIMSessionManager"));
String account =ios.getAttribute(CIMConstant.SESSION_KEY).toString();
ios.removeAttribute(CIMConstant.SESSION_KEY);
ios.closeNow();
sessionManager.remove(account);
return null;
}
}

View File

@ -26,16 +26,13 @@ public class SessionClosedHandler implements CIMRequestHandler {
public ReplyBody process(CIMSession ios, SentBody message) {
DefaultSessionManager sessionManager = ((DefaultSessionManager) ContextHolder.getBean("CIMSessionManager"));
if(ios.getAttribute(CIMConstant.SESSION_KEY)==null)
{
return null;
}
DefaultSessionManager sessionManager = ((DefaultSessionManager) ContextHolder.getBean("CIMSessionManager"));
String account =ios.getAttribute(CIMConstant.SESSION_KEY).toString();
ios.removeAttribute(CIMConstant.SESSION_KEY);
ios.closeNow();
sessionManager.remove(account);
String account = ios.getAttribute(CIMConstant.SESSION_KEY).toString();
sessionManager.remove(account);
return null;
}

View File

@ -1,13 +1,13 @@
log4j.rootLogger=debug,console, file
log4j.rootLogger=info,console, file
#----------console----------------
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.Target=System.out
log4j.appender.console.layout.ConversionPattern=%C %p %d{yyyy-MM-dd HH:mm:ss}%n%m%n--------------------------------------------------------------------------------------------------------------------------%n
log4j.appender.console.layout.ConversionPattern=%C.%M() %p %d{yyyy-MM-dd HH:mm:ss}%n%m%n--------------------------------------------------------------------------------------------------------------------------%n
#----------file----------------
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=cim.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%C %p %d{yyyy-MM-dd HH\:mm\:ss} - %m%n
log4j.appender.file.layout.ConversionPattern=%C.%M() %p %d{yyyy-MM-dd HH:mm:ss}%n%m%n--------------------------------------------------------------------------------------------------------------------------%n

View File

@ -21,9 +21,7 @@
<entry key="client_bind">
<bean class="com.farsunset.cim.handler.BindHandler" />
</entry>
<entry key="client_logout">
<bean class="com.farsunset.cim.handler.LogoutHandler" />
</entry>
<entry key="client_cimsession_closed">
<bean class="com.farsunset.cim.handler.SessionClosedHandler"/>
</entry>

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.farsunset.ichat.example"
android:versionCode="2"
android:versionName="2.0.0" >
android:versionCode="3"
android:versionName="2.1.0" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

View File

@ -6,29 +6,14 @@
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-dontwarn
-keep public class com.adview.** {*;}
-keeppackagenames com.madhouse.android.ads
-keepclassmembers class * {public *;}
-keep public class com.wqmobile.sdk.** {*;}
-keep public class * {public *;}
-keep public class com.adwo.adsdk.AdwoAdBrowserActivity
-keep public class com.wooboo.** {*;}
-keep public class cn.aduu.adsdk.**{*;}
-keep class net.youmi.android.** {*;}
-keep public class io.netty.** {*;}
-keep public class com.farsunset.cim.sdk.android.model.** {*;}
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class com.android.vending.licensing.ILicensingService
-keep public class MobWin.*
-keep public class MobWin.cnst.*
-keep class com.tencent.lbsapi.*
-keep class com.tencent.lbsapi.core.*
-keep class LBSAPIProtocol.*
-keep class com.tencent.lbsapi.core.QLBSJNI {
*;
}
-keepclasseswithmembernames class * {
native <methods>;
}

View File

@ -8,4 +8,4 @@
# project structure.
# Project target.
target=android-19
target=android-22

View File

@ -9,7 +9,7 @@ package com.farsunset.ichat.example.app;
public interface Constant {
//服务端IP地址
public static final String CIM_SERVER_HOST = "192.168.2.3";
public static final String CIM_SERVER_HOST = "192.168.191.1";
//服务端web地址
public static final String SERVER_URL = "http://"+CIM_SERVER_HOST+":8080/cim-server";