cordova-plugin-mserviceinterface-2.0 1.0.52 → 1.0.54
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 +1 -1
- package/plugin.xml +1 -1
- package/src/android/mInterface.java +1 -1
- package/src/ios/mInterface.m +20 -10
package/package.json
CHANGED
package/plugin.xml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
|
3
3
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
4
4
|
id="cordova-plugin-mserviceinterface-2.0"
|
|
5
|
-
version="1.0.
|
|
5
|
+
version="1.0.54">
|
|
6
6
|
<name>mserviceinterface-2.0</name>
|
|
7
7
|
<description>This plugin establishes the connection to the native interface and performs the requested task.</description>
|
|
8
8
|
<author>selfservit@gmail.com</author>
|
|
@@ -2105,7 +2105,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
2105
2105
|
return false;
|
|
2106
2106
|
}
|
|
2107
2107
|
|
|
2108
|
-
private void
|
|
2108
|
+
private void EnableGPSAutomatically(CallbackContext callbackContext) {
|
|
2109
2109
|
callback = callbackContext;
|
|
2110
2110
|
createLocationRequest1();
|
|
2111
2111
|
mGoogleApiClient1 = new GoogleApiClient.Builder(cordova.getActivity())
|
package/src/ios/mInterface.m
CHANGED
|
@@ -937,9 +937,12 @@
|
|
|
937
937
|
[self.locationManager setHeadingFilter:kCLHeadingFilterNone];
|
|
938
938
|
[self.locationManager requestAlwaysAuthorization];
|
|
939
939
|
[self.locationManager requestWhenInUseAuthorization];
|
|
940
|
-
|
|
941
|
-
if (
|
|
942
|
-
|
|
940
|
+
CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
|
|
941
|
+
if (status == kCLAuthorizationStatusAuthorizedAlways) {
|
|
942
|
+
// Location permission is granted, enable background location updates
|
|
943
|
+
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9) {
|
|
944
|
+
_locationManager.allowsBackgroundLocationUpdates = YES;
|
|
945
|
+
}
|
|
943
946
|
}
|
|
944
947
|
[self.locationManager startUpdatingLocation];
|
|
945
948
|
double lat = self.locationManager.location.coordinate.latitude;
|
|
@@ -1015,13 +1018,12 @@
|
|
|
1015
1018
|
if(networkStatus == NotReachable){
|
|
1016
1019
|
} else {
|
|
1017
1020
|
NSError *error;
|
|
1018
|
-
NSArray *myAccountsArray = [NSJSONSerialization JSONObjectWithData:[[NSString stringWithContentsOfFile:[NSString stringWithFormat:@"%@/%@/
|
|
1021
|
+
NSArray *myAccountsArray = [NSJSONSerialization JSONObjectWithData:[[NSString stringWithContentsOfFile:[NSString stringWithFormat:@"%@/%@/my_accounts_encrypted.txt", directory, [self GetAppName]] encoding:NSUTF8StringEncoding error:&error] dataUsingEncoding:NSUTF8StringEncoding] options: NSJSONReadingMutableContainers error:&error];
|
|
1019
1022
|
for( int index = 0; index < [myAccountsArray count]; index++ ) {
|
|
1020
1023
|
NSString *locationUpdateInd = [myAccountsArray[index] valueForKey:@"location_update_ind"];
|
|
1021
1024
|
if([locationUpdateInd isEqual: @"true"]) {
|
|
1022
1025
|
NSString *clientId = [myAccountsArray[index] valueForKey:@"client_id"];
|
|
1023
1026
|
NSString *countryCode = [myAccountsArray[index] valueForKey:@"country_code"];
|
|
1024
|
-
NSString *deviceID = [myAccountsArray[index] valueForKey:@"device_id"];
|
|
1025
1027
|
NSString *clientUrl = [myAccountsArray[index] valueForKey:@"client_url"];
|
|
1026
1028
|
NSString *locationData = [NSString stringWithContentsOfFile:locationFilePath encoding:NSUTF8StringEncoding error:&error];
|
|
1027
1029
|
NSString *baseURL = [NSString stringWithFormat:@"%@/common/components/GeoLocation/update_device_location_offline.aspx", clientUrl];
|
|
@@ -1031,7 +1033,12 @@
|
|
|
1031
1033
|
[request setValue:@"text/xml" forHTTPHeaderField:@"Content-type"];
|
|
1032
1034
|
[request setHTTPMethod : @"POST"];
|
|
1033
1035
|
[request setHTTPBody : inputData];
|
|
1034
|
-
|
|
1036
|
+
NSError *jsonError;
|
|
1037
|
+
NSURLResponse *response = nil;
|
|
1038
|
+
//[NSURLConnection connectionWithRequest:fileRequest delegate:self];
|
|
1039
|
+
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&jsonError];
|
|
1040
|
+
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
|
|
1041
|
+
|
|
1035
1042
|
} else {
|
|
1036
1043
|
NSLog(@"The locationUpdateInd indication is set to false");
|
|
1037
1044
|
}
|
|
@@ -1566,10 +1573,13 @@
|
|
|
1566
1573
|
[self.locationManager setHeadingFilter:kCLHeadingFilterNone];
|
|
1567
1574
|
[self.locationManager requestAlwaysAuthorization];
|
|
1568
1575
|
[self.locationManager requestWhenInUseAuthorization];
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1576
|
+
CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
|
|
1577
|
+
if (status == kCLAuthorizationStatusAuthorizedAlways) {
|
|
1578
|
+
// Location permission is granted, enable background location updates
|
|
1579
|
+
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9) {
|
|
1580
|
+
_locationManager.allowsBackgroundLocationUpdates = YES;
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1573
1583
|
[self.locationManager startUpdatingLocation];
|
|
1574
1584
|
[self KillTimers];
|
|
1575
1585
|
self.LocationTimer = [NSTimer scheduledTimerWithTimeInterval:locationInterval
|