Delphi XE7里面 SharedActivityContext怎么提示错误?


本文整理自网络,侵删。

 如题:学习网上的判断网络是否连接的JNI编程,从网上拷贝程序测试一下,提示 SharedActivityContext 找不到,请问在哪个unit里面有这个?程序如下:
function GetConnectivityManager: JConnectivityManager;var  ConnectivityServiceNative: JObject;
begin
  ConnectivityServiceNative := SharedActivityContext.getSystemService(TJContext.JavaClass.CONNECTIVITY_SERVICE);
  if not Assigned(ConnectivityServiceNative) then
    raise Exception.Create('Could not locate Connectivity Service');
  Result := TJConnectivityManager.Wrap(    (ConnectivityServiceNative as ILocalObject).GetObjectID);
  if not Assigned(Result) then
    raise Exception.Create('Could not access Connectivity Manager');

end;


解决:

uses
   Androidapi.Helpers;

相关阅读 >>

winsock 实现telnet后门

Delphi sysutils.comparestr、sysutils.comparetext - 字符串比较

Delphi判断系统是否64位

Delphi 在减少占用资源的情况下,等待msecs毫秒

Delphi idftp 使用被动连接

Delphi使用xmlhttp获取时间

Delphi tchart 的使用

Delphi fmx 截图

Delphi 工程判断内存溢出reportmemoryleaksonshutdown := true;

Delphi word文档内容批量替换

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...