You are here: Forum Home → ANT Developers Forums → ANT in Mobile Phones → Thread
public static PccReleaseHandle<AntPlusHeartRatePcc> requestAccess(Context bindToContext, int antDeviceNumber, int searchProximityThreshold, IPluginAccessResultReceiver<AntPlusHeartRatePcc> resultReceiver, IDeviceStateChangeReceiver stateReceiver)
public class TrainingActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.training);
// connect 8 sensors with an 8-channel adapter
for (String sensorNumber : sensorsToConnect()) {
releaseHandles.add(AntPlusHeartRatePcc.requestAccess(activity, sensorNumber, 0, accessResultReceiver, deviceStateChangeReceiver););
}
}
@Override
protected void onDestroy()
for (PccReleaseHandle releaseHandle : releaseHandles) {
releaseHandle.close();
}
releaseHandles.clear();
super.onDestroy();
blackramlabs.com
Yes, this is a known issue. You should not use the release handle returned from requestAccess() because of this problem.
As a side note, you probably don't want to be managing your ANT+ connections from an Activity because of this. Use a Service.