cordova-plugin-mserviceinterface-2.0 1.0.106 → 1.0.107

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.106",
3
+ "version": "1.0.107",
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.106">
3
+ xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-mserviceinterface-2.0" version="1.0.107">
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>
@@ -2358,7 +2358,6 @@
2358
2358
  - (void)StartService:(CDVInvokedUrlCommand*)command
2359
2359
  {
2360
2360
  @try {
2361
- [self KillTimers];
2362
2361
  [self ValidateAppStateInfo];
2363
2362
  self.QueueToServerTimer = [NSTimer scheduledTimerWithTimeInterval:5.0
2364
2363
  target:self
@@ -2368,7 +2367,7 @@
2368
2367
  double locationInterval = 0.0;
2369
2368
  NSString * directory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
2370
2369
  NSFileManager *fileManager = [NSFileManager defaultManager];
2371
- NSString *locConfgFilePath = [NSString stringWithFormat:@"%@/%@/app_controller.json", directory, [self GetAppName]];
2370
+ NSString *locConfgFilePath = [NSString stringWithFormat:@"%@/%@/app_controller.json.txt", directory, [self GetAppName]];
2372
2371
  if([fileManager fileExistsAtPath:locConfgFilePath]){
2373
2372
  NSData *user_data = [NSData dataWithContentsOfFile:locConfgFilePath];
2374
2373
  NSError *jsonError = nil;
@@ -2382,32 +2381,25 @@
2382
2381
  NSLog(@"No location update should not be happnened..");
2383
2382
  } else {
2384
2383
  self.locationManager = [[CLLocationManager alloc] init];
2385
- self.locationManager.delegate = self;
2386
- self.locationManager.distanceFilter = kCLDistanceFilterNone;
2387
- self.locationManager.headingFilter = kCLHeadingFilterNone;
2388
-
2389
- // Foreground-only: When In Use authorization
2384
+ [self.locationManager setDelegate:self];
2385
+ [self.locationManager setDistanceFilter:kCLDistanceFilterNone];
2386
+ [self.locationManager setHeadingFilter:kCLHeadingFilterNone];
2387
+ [self.locationManager requestAlwaysAuthorization];
2388
+ [self.locationManager requestWhenInUseAuthorization];
2390
2389
  CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
2391
-
2392
- if (status == kCLAuthorizationStatusNotDetermined) {
2393
- // First time: ask for When In Use
2394
- [self.locationManager requestWhenInUseAuthorization];
2395
- } else if (status == kCLAuthorizationStatusAuthorizedWhenInUse ||
2396
- status == kCLAuthorizationStatusAuthorizedAlways) {
2397
- // Permission already granted
2398
- [self.locationManager startUpdatingLocation];
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
+ }
2399
2395
  }
2400
-
2401
- // No allowsBackgroundLocationUpdates here
2402
-
2403
-
2396
+ [self.locationManager startUpdatingLocation];
2397
+ [self KillTimers];
2404
2398
  self.LocationTimer = [NSTimer scheduledTimerWithTimeInterval:locationInterval
2405
- target:self
2399
+ target:self
2406
2400
  selector:@selector(SendLocation)
2407
2401
  userInfo:nil
2408
- repeats:YES];
2409
- [self.LocationTimer fire];
2410
-
2402
+ repeats:YES];
2411
2403
  }
2412
2404
  } else {
2413
2405
  NSLog(@"'location_configuration' key not found in JSON.");