io.appium.settings 3.2.1 → 3.3.0

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.
Binary file
package/app/build.gradle CHANGED
@@ -7,8 +7,8 @@ android {
7
7
  defaultConfig {
8
8
  minSdkVersion 18
9
9
  targetSdkVersion 28
10
- versionCode 28
11
- versionName "3.2.1"
10
+ versionCode 29
11
+ versionName "3.3.0"
12
12
  applicationId "io.appium.settings"
13
13
  }
14
14
 
@@ -50,6 +50,7 @@ public class LocationService extends Service {
50
50
  private static final String LONGITUDE_PARAMETER_KEY = "longitude";
51
51
  private static final String LATITUDE_PARAMETER_KEY = "latitude";
52
52
  private static final String ALTITUDE_PARAMETER_KEY = "altitude";
53
+ private static final String SPEED_PARAMETER_KEY = "speed";
53
54
 
54
55
  private static final long UPDATE_INTERVAL_MS = 2000L;
55
56
 
@@ -197,6 +198,17 @@ public class LocationService extends Service {
197
198
  Log.e(TAG, String.format("altitude should be a valid number. '%s' is given instead",
198
199
  intent.getStringExtra(ALTITUDE_PARAMETER_KEY)));
199
200
  }
201
+ try {
202
+ if (intent.hasExtra(SPEED_PARAMETER_KEY)) {
203
+ float speed = Float.valueOf(intent.getStringExtra(SPEED_PARAMETER_KEY));
204
+
205
+ locationFactory.setLocation(latitude, longitude, altitude, speed);
206
+ return;
207
+ }
208
+ } catch (NumberFormatException e) {
209
+ Log.e(TAG, String.format("speed should be a valid number larger then 0.0. '%s' is given instead",
210
+ intent.getStringExtra(SPEED_PARAMETER_KEY)));
211
+ }
200
212
 
201
213
  locationFactory.setLocation(latitude, longitude, altitude);
202
214
  }
@@ -25,6 +25,8 @@ public class LocationFactory {
25
25
  private double latitude;
26
26
  private double longitude;
27
27
  private double altitude;
28
+ private float speed;
29
+ private boolean hasSpeed = false;
28
30
 
29
31
 
30
32
  public synchronized Location createLocation(String providerName, float accuracy) {
@@ -34,7 +36,9 @@ public class LocationFactory {
34
36
  l.setLatitude(latitude);
35
37
  l.setLongitude(longitude);
36
38
  l.setAltitude(altitude);
37
- l.setSpeed(0);
39
+ if (hasSpeed) {
40
+ l.setSpeed(speed);
41
+ }
38
42
  l.setBearing(0);
39
43
 
40
44
  l.setTime(System.currentTimeMillis());
@@ -44,9 +48,16 @@ public class LocationFactory {
44
48
  return l;
45
49
  }
46
50
 
51
+ public synchronized void setLocation(double latitude, double longitude, double altitude, float speed) {
52
+ this.setLocation(latitude, longitude, altitude);
53
+ this.speed = speed;
54
+ this.hasSpeed = true;
55
+ }
56
+
47
57
  public synchronized void setLocation(double latitude, double longitude, double altitude) {
48
58
  this.latitude = latitude;
49
59
  this.longitude = longitude;
50
60
  this.altitude = altitude;
61
+ this.hasSpeed = false;
51
62
  }
52
63
  }
@@ -45,7 +45,7 @@ public class LocationInfoReceiver extends BroadcastReceiver
45
45
  if (location != null) {
46
46
  setResultCode(Activity.RESULT_OK);
47
47
  // Decimal separator is a dot
48
- setResultData(String.format(Locale.US, "%.5f %.5f %.5f",
48
+ setResultData(String.format(Locale.US, "%.7f %.7f %.7f",
49
49
  location.getLatitude(), location.getLongitude(), location.getAltitude()));
50
50
  } else {
51
51
  setResultCode(Activity.RESULT_CANCELED);
@@ -58,7 +58,10 @@ public class SmsReader extends BroadcastReceiver implements HasAction {
58
58
  do {
59
59
  JSONObject item = new JSONObject();
60
60
  for (String[] entry : SMS_INFO_MAPPING) {
61
- item.put(entry[1], formatJsonNull(cursor.getString(cursor.getColumnIndex(entry[0]))));
61
+ int columnIndex = cursor.getColumnIndex(entry[0]);
62
+ if (columnIndex >= 0) {
63
+ item.put(entry[1], formatJsonNull(cursor.getString(columnIndex)));
64
+ }
62
65
  }
63
66
  items.put(item);
64
67
  } while (cursor.moveToNext() && items.length() < maxCount);
package/build.gradle CHANGED
@@ -5,7 +5,7 @@ buildscript {
5
5
  jcenter()
6
6
  }
7
7
  dependencies {
8
- classpath 'com.android.tools.build:gradle:4.0.1'
8
+ classpath 'com.android.tools.build:gradle:4.0.2'
9
9
  }
10
10
  }
11
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "io.appium.settings",
3
- "version": "3.2.1",
3
+ "version": "3.3.0",
4
4
  "description": "App for dealing with Android settings",
5
5
  "main": "index.js",
6
6
  "scripts": {