2012-08-06 47 views
0

我对android或phonegap不太了解,但我们的应用程序是在sencha touch 2中,这里我们试图将蓝牙数据从一个设备传输到其他使用手机间隙的设备。下面的代码示例正在研究的PhoneGap 1.5,Android标签上的蓝牙数据传输问题

 IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND); 
        this.ctx.registerReceiver(mReceiver, filter); 

但是当我升级的PhoneGap到2.0,ctx.registerReceiver不存在,并给予错误。

回答

1

“ctx”在最新的phonegap中已弃用,我们需要用“cordova.getActivity()。getApplicationContext()”替换它。