質問編集履歴
1
現状のコードとエラー情報の追加をしたため
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
javascriptによるandroidの
|
1
|
+
javascriptによるandroidのlocation.Locationの得かたについて
|
test
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
私、現在スマホの位置情報を利用したminecraftのmodを作成しようとしております。
|
2
2
|
|
3
|
-
現在、minecraftとblockLuncherに位置情報のパーミッションを追加することができ
|
3
|
+
現在、minecraftとblockLuncherのmanifestファイルに位置情報のパーミッションを追加することができたため緯度経度など位置情報の取得を試みようとしております。
|
4
4
|
|
5
|
+
しかし、30行目にあるLocationManager.requestLocationUpdatesにおいて
|
5
6
|
|
6
|
-
|
7
|
-
|
7
|
+
Can not find method android.location.LocationManager.requestLocationUpdates というエラーが発生しております。
|
8
|
-
|
9
|
-
|
10
8
|
|
11
9
|
このエラーの解決方法などありましたら教えていただければ幸いです。
|
12
10
|
|
@@ -28,30 +26,56 @@
|
|
28
26
|
|
29
27
|
|
30
28
|
|
31
|
-
|
29
|
+
const MainActivity=com.mojang.minecraftpe.MainActivity;
|
32
30
|
|
33
|
-
|
31
|
+
const Context=MainActivity.currentMainActivity.get().getApplicationContext();
|
34
32
|
|
35
|
-
|
33
|
+
const LocationManager = Context.getSystemService(Context.LOCATION_SERVICE);
|
34
|
+
|
35
|
+
clientMessage(LocationManager);
|
36
|
+
|
37
|
+
const Criteria=android.location.Criteria;
|
38
|
+
|
39
|
+
const criteria=new Criteria();
|
40
|
+
|
41
|
+
criteria.setAccuracy(Criteria.ACCURACY_COARSE);
|
42
|
+
|
43
|
+
criteria.setPowerRequirement(Criteria.POWER_LOW);
|
36
44
|
|
37
45
|
|
38
46
|
|
39
|
-
|
47
|
+
const Provider2= android.location.LocationManager.GPS_PROVIDER;
|
40
48
|
|
41
|
-
|
49
|
+
clientMessage(Provider2);
|
42
50
|
|
43
|
-
ac.requestPermissions(this,new String(mf.permission.ACCESS_FINE_LOCATION),1000)
|
44
51
|
|
45
|
-
}
|
46
52
|
|
47
|
-
e
|
53
|
+
const BestProvider=LocationManager.getBestProvider(criteria,true);
|
48
54
|
|
49
|
-
|
55
|
+
clientMessage(BestProvider);
|
50
56
|
|
51
|
-
clientMessage(x);
|
52
57
|
|
53
|
-
}
|
54
58
|
|
59
|
+
const LListener = android.location.LocationListener;
|
60
|
+
|
61
|
+
clientMessage(LListener);
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
const LL = android.location.Location;
|
66
|
+
|
55
|
-
|
67
|
+
clientMessage(LL);
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
// const lm = android.location.LocationManager;
|
72
|
+
|
73
|
+
// const lmre = lm.requestLocationUpdates();
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
const LocationUpdates=LocationManager.requestLocationUpdates(BestProvider,1000,50,Context);
|
78
|
+
|
79
|
+
clientMessage(LocationUpdates);
|
56
80
|
|
57
81
|
```
|