4

I get java.lang.UnsupportedOperationException and the app crashes on following line:

this.beaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));

This is part of the stack trace:

java.lang.UnsupportedOperationException
            at java.util.Collections$UnmodifiableCollection.add(Collections.java:928)
            at com.cc.office.BeaconMonitoring.BeaconMonitoringCoordinator.detectBeaconsUsingMonitorNotifier(BeaconMonitoringCoordinator.java:75)
user2189878
  • 257
  • 3
  • 10

1 Answers1

0

The line

this.beaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));

was being called after

beaconManager.bind(this);

The issue was fixed by calling the add function before bind.

user2189878
  • 257
  • 3
  • 10