消息发送失败或者延迟定位

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq_38208038/article/details/69524456

要分两种情况:已经接入,或者还在接入中
如果已经接入,多半是服务器的问题

  • 已经接入情况:

    1. 用Demo尝试,是否服务器有问题
    2. 找服务器同学
  • 还未接入情况:

    1. 服务器是否OK(用DEMO测试)
    2. 初始化,登录是否成功
    3. 接受者是否指定正确(房间要求该房间有人)
    4. 聊天类型是否正确(私聊/房间)
展开阅读全文

android GPS或者NET_Work在室内很多情况下定位失败

05-04

下面是我的GPS定位代码,在室外一般都可以获取当前经纬度的,请大侠指点在内室能够更块获取当前位置的方法!非我自己使用大众点评或者新浪微博,在室内都能较快的获取当前的位置!请大侠不吝赐教! rn//位置监听器rn locationListener = new LocationListener() rn rn public void onStatusChanged(String provider, int status, Bundle extras)rn rn rn public void onProviderEnabled(String provider)rn rn rn public void onProviderDisabled(String provider) rn rn //当位置变化时触发rn public void onLocationChanged(Location location)rn rn //使用新的location更新TextView显示rn updateLocation(location);rn rn ;rn rn String contextService=Context.LOCATION_SERVICE;rn //通过系统服务,取得LocationManager对象rn lm=(LocationManager) getSystemService(contextService);rn rn LoginStateSetting lss=(LoginStateSetting)getApplicationContext();rn location=lss.getLocation();rn if(location!=null)rn rn updateLocation(location);rn rn else if(isGPSEnable(this))rn rn rn rn rn //使用标准集合,让系统自动选择可用的最佳位置提供器,提供位置rn Criteria criteria = new Criteria();rn criteria.setAccuracy(Criteria.ACCURACY_FINE);//高精度rn criteria.setAltitudeRequired(false);//不要求海拔rn criteria.setBearingRequired(false);//不要求方位rn criteria.setCostAllowed(true);//允许有花费rn criteria.setPowerRequirement(Criteria.POWER_LOW);//低功耗rn rn tryrn rn //从可用的位置提供器中,匹配以上标准的最佳提供器rn String provider = lm.getBestProvider(criteria, true);rn //获得最后一次变化的位置rn location = lm.getLastKnownLocation(provider);rn //显示在TextView中rn updateLocation(location);rn //监听位置变化,2秒一次,距离10米以上rn lm.requestLocationUpdates(provider, 1000, 0, locationListener);rn rn catch(Exception e)rn rn e.printStackTrace();rn rn rn elsern rn Toast.makeText(this, "请先启动GPS,再查看附近的商家!",Toast.LENGTH_SHORT).show();rn //进入GPS设置页面rn Intent intent = new Intent();rn intent.setAction(Settings.ACTION_LOCATION_SOURCE_SETTINGS);rn intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);rn try rn rn startActivityForResult(intent,0); //此为设置完成后返回到获取界面 rn rn catch(ActivityNotFoundException ex) rn rn intent.setAction(Settings.ACTION_SETTINGS);rn try rn rn startActivity(intent);rn rn catch (Exception e) rn rn rn rnrn //更新位置信息 展示到tv中rn private void updateLocation(Location location) rn if (location != null)rn rn LoginStateSetting lss=(LoginStateSetting)getApplicationContext();rn lss.setLocation(location);rn Log.i("gps succ"," gps succ");rn Log.i("start parser "," parser location to street");rn double latitude = location.getLatitude();rn double longitude = location.getLongitude();rn //因为地址解析比较耗时,所以开启一个异步线程去解析地址rn String[] params=latitude+"",longitude+"";rn new AsyncAddrParser().execute(params);rn rn rn elsern rn System.out.println("没有获取到定位对象Location");rn rn 论坛

消息发送的问题

12-19

大家帮我看一下以下的这个发送代码。为什么接收不到呢?rn——————————————————————————————————————rnprocedure HKSendread.Execute;rnbeginrn Self.NetSend('newp4','127.0.0.1','哈哈');rnend;rnrnfunction HKSendread.NetSend(dest, Source, Msg: string): Longint;rntypern TNetMessageBufferSendFunction = function(servername, msgname, fromname: PWideChar;rn buf: PWideChar; buflen: Cardinal): Longint;rn stdcall;rnvarrn NetMessageBufferSend: TNetMessageBufferSendFunction;rn SourceWideChar: PWideChar;rn DestWideChar: PWideChar;rn MessagetextWideChar: PWideChar;rn Handle: THandle;rnbeginrn Handle := LoadLibrary('NETAPI32.DLL');rn if Handle = 0 thenrn beginrn Result := GetLastError;rn Exit;rn end;rn @NetMessageBufferSend := GetProcAddress(Handle, 'NetMessageBufferSend');rn if @NetMessageBufferSend = nil thenrn beginrn Result := GetLastError;rn Exit;rn end;rnrn MessagetextWideChar := nil;rn SourceWideChar := nil;rn DestWideChar := nil;rnrn tryrn GetMem(MessagetextWideChar, Length(Msg) * SizeOf(WideChar) + 1);rn GetMem(DestWideChar, 20 * SizeOf(WideChar) + 1);rn StringToWideChar(Msg, MessagetextWideChar, Length(Msg) * SizeOf(WideChar) + 1);rn StringToWideChar(Dest, DestWideChar, 20 * SizeOf(WideChar) + 1);rnrn if Source = '' thenrn Result := NetMessageBufferSend(nil, DestWideChar, nil,rn MessagetextWideChar, Length(Msg) * SizeOf(WideChar) + 1)rn elsern beginrn GetMem(SourceWideChar, 20 * SizeOf(WideChar) + 1);rn StringToWideChar(Source, SourceWideChar, 20 * SizeOf(WideChar) + 1);rn Result := NetMessageBufferSend(nil, DestWideChar, SourceWideChar,rn MessagetextWideChar, Length(Msg) * SizeOf(WideChar) + 1);rn FreeMem(SourceWideChar);rn end;rn finallyrn FreeMem(MessagetextWideChar);rn FreeLibrary(Handle);rn end;rnend; 论坛

消息发送与接收

05-17

<p>rn <span style="color:#3D3D3D;"></span> rn</p>rn<span style="font-size:18px;">&nbsp; &nbsp; &nbsp;本课程为JavaSE基础阶段的项目实战视频,主要使用技术均为JavaSE基础,手把手带你构建在线聊天室,需要JavaSE基础才能进行实战与开发,学习前需要掌握的技能有:逻辑基础、面向对象、异常处理、集合框架、IO流、网络编程、多线程、GUI技术,学完本套课程,你会对JavaSE有一个更深入的认知,为后续课程的学习打下一个坚实的基础。<br />rn</span> rn<p>rn <br />rn</p>rn<p>rn <br />rn</p>rn<p>rn <span style="color:#3D3D3D;"><strong>课程大纲</strong></span> rn</p>rn<span style="color:#3D3D3D;"> </span> rn<div style="text-align:left;">rn <span style="font-size:18px;">1. </span><span style="color:#222222;">网络聊天室认知及原理</span><span style="font-size:18px;">;</span> rn</div>rn<span style="color:#3D3D3D;"> </span> rn<div style="text-align:left;">rn <span style="font-size:18px;">2. 登录、</span><span style="color:#222222;">聊天室、服务端界面制作</span><span style="font-size:18px;">;</span> rn</div>rn<span style="color:#3D3D3D;"> </span> rn<div style="text-align:left;">rn <span style="font-size:18px;">3. 客户端/服务端</span><span style="color:#222222;">网络通信实现</span><span style="font-size:18px;">;</span> rn</div>rn<span style="color:#3D3D3D;"> </span> rn<div style="text-align:left;">rn 4. 通信机制设计;rn</div>rn<span style="color:#3D3D3D;"> </span> rn<div style="text-align:left;">rn 5. 在线统计、消息收发主功能实现;rn</div>rn<span style="color:#3D3D3D;"> </span> rn<div style="text-align:left;">rn <span style="font-size:18px;">6. 服务端主功能实现;</span> rn</div>rn<span style="color:#3D3D3D;"> </span> rn<div style="text-align:left;">rn 7. 字体及图片样式发送;rn</div>

没有更多推荐了,返回首页