getBeaconParsers().add throws java.lang.UnsupportedOperationException… here is a solution to the problem.
getBeaconParsers().add throws java.lang.UnsupportedOperationException
I get java.lang.UnsupportedOperationException
and the application crashes on the 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)
Solution
line
this.beaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));
Called after
that
beaconManager.bind(this);
This problem is solved by calling the add function before bind.