@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); bstacInstance = Beaconstac.getInstance(this); bstacInstance.setRegionParams( "F94DBB23-2266-7822-3782-57BEAC0952AC", "com.mobstac.beaconstacexample"); bstacInstance.syncRules(); try { bstacInstance.startRangingBeacons(); } catch (MSException e) { e.printStackTrace(); } button1 = (RadioButton) findViewById(R.id.button_home); button1.setOnCheckedChangeListener(this); button2 = (RadioButton) findViewById(R.id.button_messages); button2.setOnCheckedChangeListener(this); button3 = (RadioButton) findViewById(R.id.button_settings); button3.setOnCheckedChangeListener(this); button4 = (RadioButton) findViewById(R.id.button_todolist); button4.setOnCheckedChangeListener(this); if (savedInstanceState == null) { registerBroadcast(); } actionBar = getSupportActionBar(); actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#03A9F4"))); fragmentManager = getSupportFragmentManager(); button1.setChecked(true); }
@Override protected void onDestroy() { super.onDestroy(); unregisterBroadcast(); // stop scanning when the app closes if (bstacInstance != null) { try { bstacInstance.stopRangingBeacons(); } catch (MSException e) { // handle for older devices e.printStackTrace(); } } }