cordova-plugin-mserviceinterface-2.0 1.0.95 → 1.0.96

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordova-plugin-mserviceinterface-2.0",
3
- "version": "1.0.95",
3
+ "version": "1.0.96",
4
4
  "description": "This plugin establishes the connection to the native interface and performs the requested task.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/plugin.xml CHANGED
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
3
- xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-mserviceinterface-2.0" version="1.0.95">
3
+ xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-mserviceinterface-2.0" version="1.0.96">
4
4
  <name>mserviceinterface-2.0</name>
5
5
  <description>This plugin establishes the connection to the native interface and performs the requested task.</description>
6
6
  <author>selfservit@gmail.com</author>
@@ -2367,7 +2367,7 @@
2367
2367
  double locationInterval = 0.0;
2368
2368
  NSString * directory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
2369
2369
  NSFileManager *fileManager = [NSFileManager defaultManager];
2370
- NSString *locConfgFilePath = [NSString stringWithFormat:@"%@/%@/app_controller.json.txt", directory, [self GetAppName]];
2370
+ NSString *locConfgFilePath = [NSString stringWithFormat:@"%@/%@/app_controller.json", directory, [self GetAppName]];
2371
2371
  if([fileManager fileExistsAtPath:locConfgFilePath]){
2372
2372
  NSData *user_data = [NSData dataWithContentsOfFile:locConfgFilePath];
2373
2373
  NSError *jsonError = nil;
@@ -2381,25 +2381,32 @@
2381
2381
  NSLog(@"No location update should not be happnened..");
2382
2382
  } else {
2383
2383
  self.locationManager = [[CLLocationManager alloc] init];
2384
- [self.locationManager setDelegate:self];
2385
- [self.locationManager setDistanceFilter:kCLDistanceFilterNone];
2386
- [self.locationManager setHeadingFilter:kCLHeadingFilterNone];
2387
- [self.locationManager requestAlwaysAuthorization];
2388
- [self.locationManager requestWhenInUseAuthorization];
2384
+ self.locationManager.delegate = self;
2385
+ self.locationManager.distanceFilter = kCLDistanceFilterNone;
2386
+ self.locationManager.headingFilter = kCLHeadingFilterNone;
2387
+
2388
+ // Foreground-only: When In Use authorization
2389
2389
  CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
2390
- if (status == kCLAuthorizationStatusAuthorizedAlways) {
2391
- // Location permission is granted, enable background location updates
2392
- if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9) {
2393
- _locationManager.allowsBackgroundLocationUpdates = YES;
2394
- }
2390
+
2391
+ if (status == kCLAuthorizationStatusNotDetermined) {
2392
+ // First time: ask for When In Use
2393
+ [self.locationManager requestWhenInUseAuthorization];
2394
+ } else if (status == kCLAuthorizationStatusAuthorizedWhenInUse ||
2395
+ status == kCLAuthorizationStatusAuthorizedAlways) {
2396
+ // Permission already granted
2397
+ [self.locationManager startUpdatingLocation];
2395
2398
  }
2396
- [self.locationManager startUpdatingLocation];
2399
+
2400
+ // No allowsBackgroundLocationUpdates here
2401
+
2397
2402
  [self KillTimers];
2398
2403
  self.LocationTimer = [NSTimer scheduledTimerWithTimeInterval:locationInterval
2399
- target:self
2404
+ target:self
2400
2405
  selector:@selector(SendLocation)
2401
2406
  userInfo:nil
2402
- repeats:YES];
2407
+ repeats:YES];
2408
+ [self.LocationTimer fire];
2409
+
2403
2410
  }
2404
2411
  } else {
2405
2412
  NSLog(@"'location_configuration' key not found in JSON.");