19
19
import android .support .v7 .widget .Toolbar ;
20
20
import android .view .MenuItem ;
21
21
22
- import com .estimote .sdk .BeaconManager ;
23
- import com .estimote .sdk .Region ;
24
-
25
22
import io .github .project_travel_mate .destinations .CityFragment ;
26
23
import io .github .project_travel_mate .login .LoginActivity ;
27
24
import io .github .project_travel_mate .travel .TravelFragment ;
35
32
public class MainActivity extends AppCompatActivity implements NavigationView .OnNavigationItemSelectedListener {
36
33
37
34
private SharedPreferences sharedPreferences ;
38
- private Boolean discovered = false ;
39
- private String beaconmajor ;
40
- private BeaconManager beaconManager ;
41
- private Region region ;
42
35
43
36
@ Override
44
37
protected void onCreate (Bundle savedInstanceState ) {
@@ -56,43 +49,6 @@ protected void onCreate(Bundle savedInstanceState) {
56
49
fragment = new CityFragment ();
57
50
fragmentManager .beginTransaction ().replace (R .id .inc , fragment ).commit ();
58
51
59
- // If beacon detected, open activity
60
- final Intent intent = getIntent ();
61
- if (intent .getBooleanExtra (Constants .IS_BEACON , false )) {
62
- Intent intent1 = new Intent (MainActivity .this , DetectedBeacon .class );
63
- intent1 .putExtra (Constants .CUR_UID , intent .getStringExtra (Constants .CUR_UID ));
64
- intent1 .putExtra (Constants .CUR_MAJOR , intent .getStringExtra (Constants .CUR_MAJOR ));
65
- intent1 .putExtra (Constants .CUR_MINOR , intent .getStringExtra (Constants .CUR_MINOR ));
66
- intent1 .putExtra (Constants .IS_BEACON , true );
67
- startActivity (intent1 );
68
- }
69
-
70
-
71
- /*// Start beacon ranging
72
- beaconManager = new BeaconManager(this);
73
- region = new Region("Minion region", UUID.fromString(Constants.UID), null, null);
74
-
75
- beaconManager.connect(() -> beaconManager.startRanging(region));
76
-
77
- beaconManager.setRangingListener(new BeaconManager.RangingListener() {
78
- @Override
79
- public void onBeaconsDiscovered(Region region1, List<Beacon> list) {
80
- if (!discovered && list.size() > 0) {
81
- Beacon nearestBeacon = list.get(0);
82
- beaconmajor = Integer.toString(nearestBeacon.getMajor());
83
- Log.e("Discovered", "Nearest places: " + nearestBeacon.getMajor());
84
- discovered = true;
85
- Intent intent1 = new Intent(MainActivity.this, DetectedBeacon.class);
86
- intent1.putExtra(Constants.CUR_UID, " ");
87
- intent1.putExtra(Constants.CUR_MAJOR, beaconmajor);
88
- intent1.putExtra(Constants.CUR_MINOR, " ");
89
- intent1.putExtra(Constants.IS_BEACON, true);
90
- MainActivity.this.startActivity(intent1);
91
- }
92
- }
93
-
94
- });*/
95
-
96
52
// Get runtime permissions for Android M
97
53
if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .M ) {
98
54
if (ContextCompat .checkSelfPermission (MainActivity .this ,
@@ -112,7 +68,6 @@ public void onBeaconsDiscovered(Region region1, List<Beacon> list) {
112
68
Manifest .permission .ACCESS_FINE_LOCATION ,
113
69
Manifest .permission .ACCESS_COARSE_LOCATION ,
114
70
Manifest .permission .VIBRATE ,
115
-
116
71
}, 0 );
117
72
}
118
73
}
0 commit comments