質問編集履歴
4
log文の位置を修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -236,7 +236,7 @@
|
|
236
236
|
|
237
237
|
for (Beacon beacon : beacons) {
|
238
238
|
|
239
|
-
Log.d("log", "didEnterRegion5-2");
|
239
|
+
Log.d("log", "didEnterRegion5-2");
|
240
240
|
|
241
241
|
// ログの出力
|
242
242
|
|
3
ログ文の追加、本文を間違って消してしまったため再度記述
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,7 +1,15 @@
|
|
1
|
+
Beaconの情報をandroidで受信しようとしています。
|
2
|
+
|
3
|
+
その前段階として、log文で情報が出力されているか確認しているところです。
|
4
|
+
|
5
|
+
エラーはおきていないのですが、情報を出力するログが出ず困っています。
|
6
|
+
|
7
|
+
詳しい方がいらっしゃいましたらお願いします。
|
8
|
+
|
9
|
+
```java
|
10
|
+
|
1
11
|
package com.example.beacontest12;
|
2
12
|
|
3
|
-
```ここに言語を入力
|
4
|
-
|
5
13
|
import android.os.Bundle;
|
6
14
|
|
7
15
|
import android.os.RemoteException;
|
2
ログ文の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
package com.example.beacontest12;
|
2
2
|
|
3
|
-
|
3
|
+
```ここに言語を入力
|
4
4
|
|
5
5
|
import android.os.Bundle;
|
6
6
|
|
@@ -228,6 +228,8 @@
|
|
228
228
|
|
229
229
|
for (Beacon beacon : beacons) {
|
230
230
|
|
231
|
+
Log.d("log", "didEnterRegion5-2");
|
232
|
+
|
231
233
|
// ログの出力
|
232
234
|
|
233
235
|
Log.d("log", "UUID:" + beacon.getId1() + ", major:" + beacon.getId2() + ", minor:" );
|
@@ -337,3 +339,5 @@
|
|
337
339
|
}
|
338
340
|
|
339
341
|
}
|
342
|
+
|
343
|
+
```
|
1
ログ文の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,18 +1,4 @@
|
|
1
|
-
androidでbeaconの情報を取得したいと思っています。
|
2
|
-
|
3
|
-
最終的には情報をデータベースに情報を出力したいのですが、その前段階として情報をログに出力するアプリを作っています。
|
4
|
-
|
5
|
-
エラーは出ていないのですが、ログが出力されず困っています。
|
6
|
-
|
7
|
-
誰か詳しい方がいたらお願いします。
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
以下コード
|
12
|
-
|
13
|
-
```java
|
14
|
-
|
15
|
-
package com.example.beacon1
|
1
|
+
package com.example.beacontest12;
|
16
2
|
|
17
3
|
|
18
4
|
|
@@ -68,6 +54,8 @@
|
|
68
54
|
|
69
55
|
public static final String UUID = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX";
|
70
56
|
|
57
|
+
|
58
|
+
|
71
59
|
|
72
60
|
|
73
61
|
|
@@ -142,9 +130,11 @@
|
|
142
130
|
|
143
131
|
public void onBeaconServiceConnect() {
|
144
132
|
|
133
|
+
//受信するbeaconのuuid,major,minor設定
|
134
|
+
|
145
135
|
//Identifier uuid = Identifier.parse(UUID);
|
146
136
|
|
147
|
-
Identifier uuid = Identifier.parse("
|
137
|
+
Identifier uuid = Identifier.parse("00000000-5896-1001-B000-001C4DE59704");
|
148
138
|
|
149
139
|
Identifier major = Identifier.parse("1");
|
150
140
|
|
@@ -156,7 +146,7 @@
|
|
156
146
|
|
157
147
|
|
158
148
|
|
159
|
-
|
149
|
+
|
160
150
|
|
161
151
|
beaconManager.addMonitorNotifier(new MonitorNotifier() {
|
162
152
|
|
@@ -166,7 +156,7 @@
|
|
166
156
|
|
167
157
|
public void didEnterRegion(Region region) {
|
168
158
|
|
169
|
-
|
159
|
+
Log.d("log", "didEnterRegion1");
|
170
160
|
|
171
161
|
try {
|
172
162
|
|
@@ -190,7 +180,9 @@
|
|
190
180
|
|
191
181
|
public void didExitRegion(Region region) {
|
192
182
|
|
193
|
-
|
183
|
+
Log.d("log", "didEnterRegion2");
|
184
|
+
|
185
|
+
|
194
186
|
|
195
187
|
// 領域退出
|
196
188
|
|
@@ -202,7 +194,9 @@
|
|
202
194
|
|
203
195
|
public void didDetermineStateForRegion(int i, Region region) {
|
204
196
|
|
205
|
-
|
197
|
+
Log.d("log", "didEnterRegion3");
|
198
|
+
|
199
|
+
|
206
200
|
|
207
201
|
//レンジング開始
|
208
202
|
|
@@ -220,14 +214,18 @@
|
|
220
214
|
|
221
215
|
}
|
222
216
|
|
223
|
-
|
217
|
+
Log.d("log", "didEnterRegion4");
|
224
218
|
|
225
219
|
beaconManager.addRangeNotifier(new RangeNotifier() {
|
226
220
|
|
221
|
+
|
222
|
+
|
227
223
|
@Override
|
228
224
|
|
229
225
|
public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) {
|
230
226
|
|
227
|
+
Log.d("log", "didEnterRegion5");
|
228
|
+
|
231
229
|
for (Beacon beacon : beacons) {
|
232
230
|
|
233
231
|
// ログの出力
|
@@ -236,33 +234,41 @@
|
|
236
234
|
|
237
235
|
|
238
236
|
|
239
|
-
//@Override
|
237
|
+
//@Override
|
240
|
-
|
238
|
+
|
241
|
-
//public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) {
|
239
|
+
//public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) {
|
242
|
-
|
243
|
-
|
244
|
-
|
240
|
+
|
241
|
+
|
242
|
+
|
245
|
-
// 検出したビーコンの情報
|
243
|
+
// 検出したビーコンの情報
|
246
244
|
|
247
245
|
}
|
248
246
|
|
247
|
+
Log.d("log", "didEnterRegion6");
|
248
|
+
|
249
249
|
}
|
250
250
|
|
251
251
|
|
252
252
|
|
253
253
|
|
254
254
|
|
255
|
+
|
256
|
+
|
255
257
|
});
|
256
258
|
|
259
|
+
Log.d("log", "didEnterRegion7");
|
260
|
+
|
257
261
|
|
258
262
|
|
259
263
|
}
|
260
264
|
|
265
|
+
|
266
|
+
|
261
267
|
});
|
262
268
|
|
263
269
|
|
264
270
|
|
265
|
-
|
271
|
+
Log.d("log", "didEnterRegion8");
|
266
272
|
|
267
273
|
try {
|
268
274
|
|
@@ -276,24 +282,34 @@
|
|
276
282
|
|
277
283
|
}
|
278
284
|
|
285
|
+
Log.d("log", "didEnterRegion9");
|
286
|
+
|
279
287
|
beaconManager.addRangeNotifier(new RangeNotifier() {
|
280
288
|
|
289
|
+
|
290
|
+
|
281
291
|
@Override
|
282
292
|
|
283
293
|
public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) {
|
284
294
|
|
285
|
-
|
295
|
+
Log.d("log", "didEnterRegion10");
|
286
296
|
|
287
297
|
for (Beacon beacon : beacons) {
|
288
298
|
|
299
|
+
Log.d("log", "didEnterRegion11");
|
300
|
+
|
289
301
|
// ログの出力
|
290
302
|
|
291
|
-
|
303
|
+
|
292
304
|
|
293
305
|
Log.d("log", "UUID:" + beacon.getId1() + ", major:" + beacon.getId2() + ", minor:" + beacon.getId3());
|
294
306
|
|
295
307
|
}
|
296
308
|
|
309
|
+
|
310
|
+
|
311
|
+
Log.d("log", "didEnterRegion12");
|
312
|
+
|
297
313
|
//@Override
|
298
314
|
|
299
315
|
//public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) {
|
@@ -302,7 +318,7 @@
|
|
302
318
|
|
303
319
|
// 検出したビーコンの情報
|
304
320
|
|
305
|
-
|
321
|
+
|
306
322
|
|
307
323
|
|
308
324
|
|
@@ -316,10 +332,8 @@
|
|
316
332
|
|
317
333
|
});
|
318
334
|
|
319
|
-
|
335
|
+
Log.d("log", "didEnterRegion13");
|
320
336
|
|
321
337
|
}
|
322
338
|
|
323
339
|
}
|
324
|
-
|
325
|
-
```
|