I know that this release is not intended for production purposes but I would like to know if this exception only happens to me. I have a testing application, and when I try to instantiate a BeaconManager I get the next exception:
Unable to instantiate activity ComponentInfo{com.example.radiustesting/com.example.radiustesting.MainActivity}: java.lang.NullPointerException
Caused by: java.lang.NullPointerException at android.content.ContextWrapper.getPackageManager(ContextWrapper.java:94)
at org.altbeacon.beacon.BeaconManager.verifyServiceDeclaration(BeaconManager.java:676)
at org.altbeacon.beacon.BeaconManager.<init>(BeaconManager.java:215)
This is my simple Activity class
public class MainActivity extends Activity implements BeaconConsumer{
protected static final String TAG = "RangingActivity";
private BeaconManager beaconManager = BeaconManager.getInstanceForApplication(this);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_layout);
beaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout("m:2-3=0216,i:4-19,i:20-21,i:22-23,p:24-24"));
// set the duration of the scan to be 1.1 seconds
beaconManager.setBackgroundScanPeriod(1100l);
// set the time between each scan to be 1 hour (3600 seconds)
beaconManager.setBackgroundBetweenScanPeriod(1000);
beaconManager.bind(this);
}
...
Is anyone getting same exception? Thx