Kaynağa Gözat

added cordova and ionic native plugins for geolocation

Kris Blassingame 6 yıl önce
ebeveyn
işleme
851b2c00df

+ 6
- 0
frontEnd/config.xml Dosyayı Görüntüle

@@ -81,4 +81,10 @@
81 81
     <plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
82 82
     <plugin name="cordova-plugin-ionic-webview" spec="1.1.19" />
83 83
     <plugin name="cordova-plugin-ionic-keyboard" spec="2.0.5" />
84
+    <plugin name="cordova-plugin-geolocation" spec="^4.0.1">
85
+        <variable name="GEOLOCATION_USAGE_DESCRIPTION" value="To locate you" />
86
+    </plugin>
87
+    <edit-config file="*-Info.plist" mode="merge" target="NSLocationWhenInUseUsageDescription">
88
+   <string>We want your location! Best regards NSA</string>
89
+</edit-config>
84 90
 </widget>

+ 10
- 0
frontEnd/package-lock.json Dosyayı Görüntüle

@@ -104,6 +104,11 @@
104 104
       "resolved": "https://registry.npmjs.org/@ionic-native/core/-/core-4.9.2.tgz",
105 105
       "integrity": "sha512-dWV08EjK82KCDU9CM4UVEZ5yrNj9Uz7GoL818MHeJfDS4uBZT+U7qqcHEklc3+R+lMLBuTnoWe+TX3O5SwmW9A=="
106 106
     },
107
+    "@ionic-native/geolocation": {
108
+      "version": "4.10.1",
109
+      "resolved": "https://registry.npmjs.org/@ionic-native/geolocation/-/geolocation-4.10.1.tgz",
110
+      "integrity": "sha512-ez5cYHxpsdeDn5DhGhKmOIR/ohT1wTGhAZTIzK9RU+1ZAMgK0q2m10eDTa/Xs/VCW5BNdrSWnLjMPteTNR8ozw=="
111
+    },
107 112
     "@ionic-native/splash-screen": {
108 113
       "version": "4.9.2",
109 114
       "resolved": "https://registry.npmjs.org/@ionic-native/splash-screen/-/splash-screen-4.9.2.tgz",
@@ -1117,6 +1122,11 @@
1117 1122
       "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=",
1118 1123
       "dev": true
1119 1124
     },
1125
+    "cordova-plugin-geolocation": {
1126
+      "version": "4.0.1",
1127
+      "resolved": "https://registry.npmjs.org/cordova-plugin-geolocation/-/cordova-plugin-geolocation-4.0.1.tgz",
1128
+      "integrity": "sha1-RwP6ZJ0kBdJamnMsmev4aHVKLAQ="
1129
+    },
1120 1130
     "core-util-is": {
1121 1131
       "version": "1.0.2",
1122 1132
       "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",

+ 10
- 1
frontEnd/package.json Dosyayı Görüntüle

@@ -21,10 +21,12 @@
21 21
     "@angular/platform-browser": "5.2.11",
22 22
     "@angular/platform-browser-dynamic": "5.2.11",
23 23
     "@ionic-native/core": "~4.9.2",
24
+    "@ionic-native/geolocation": "^4.10.1",
24 25
     "@ionic-native/splash-screen": "~4.9.2",
25 26
     "@ionic-native/status-bar": "~4.9.2",
26 27
     "@ionic/storage": "2.1.3",
27 28
     "@types/google-maps": "^3.2.0",
29
+    "cordova-plugin-geolocation": "^4.0.1",
28 30
     "ionic-angular": "3.9.2",
29 31
     "ionicons": "3.0.0",
30 32
     "rxjs": "5.5.11",
@@ -35,5 +37,12 @@
35 37
     "@ionic/app-scripts": "3.1.11",
36 38
     "typescript": "~2.6.2"
37 39
   },
38
-  "description": "An Ionic project"
40
+  "description": "An Ionic project",
41
+  "cordova": {
42
+    "plugins": {
43
+      "cordova-plugin-geolocation": {
44
+        "GEOLOCATION_USAGE_DESCRIPTION": "To locate you"
45
+      }
46
+    }
47
+  }
39 48
 }

+ 8
- 0
frontEnd/src/components/components.module.ts Dosyayı Görüntüle

@@ -0,0 +1,8 @@
1
+import { NgModule } from '@angular/core';
2
+import { GeolocationComponent } from './geolocation/geolocation';
3
+@NgModule({
4
+	declarations: [GeolocationComponent],
5
+	imports: [],
6
+	exports: [GeolocationComponent]
7
+})
8
+export class ComponentsModule {}

+ 4
- 0
frontEnd/src/components/geolocation/geolocation.html Dosyayı Görüntüle

@@ -0,0 +1,4 @@
1
+<!-- Generated template for the GeolocationComponent component -->
2
+<div>
3
+  {{text}}
4
+</div>

+ 3
- 0
frontEnd/src/components/geolocation/geolocation.scss Dosyayı Görüntüle

@@ -0,0 +1,3 @@
1
+geolocation {
2
+
3
+}

+ 22
- 0
frontEnd/src/components/geolocation/geolocation.ts Dosyayı Görüntüle

@@ -0,0 +1,22 @@
1
+import { Component } from '@angular/core';
2
+
3
+/**
4
+ * Generated class for the GeolocationComponent component.
5
+ *
6
+ * See https://angular.io/api/core/Component for more info on Angular
7
+ * Components.
8
+ */
9
+@Component({
10
+  selector: 'geolocation',
11
+  templateUrl: 'geolocation.html'
12
+})
13
+export class GeolocationComponent {
14
+
15
+  text: string;
16
+
17
+  constructor() {
18
+    console.log('Hello GeolocationComponent Component');
19
+    this.text = 'Hello World';
20
+  }
21
+
22
+}

+ 2
- 0
frontEnd/src/index.html Dosyayı Görüntüle

@@ -39,6 +39,8 @@
39 39
   <script src="build/polyfills.js"></script>
40 40
 
41 41
   <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCP_RWvkwJQWlH3MLuHZm3zcgCQfagWQio"></script>
42
+  <script src="//www.googleapis.com/geolocation/v1/geolocate?key=AIzaSyCP_RWvkwJQWlH3MLuHZm3zcgCQfagWQio"></script>
43
+
42 44
 
43 45
   <!-- The vendor js is generated during the build process
44 46
        It contains all of the dependencies in node_modules -->