Skip to content
This repository was archived by the owner on Jul 28, 2022. It is now read-only.

Conversation

tpucci
Copy link
Contributor

@tpucci tpucci commented Jan 4, 2018

This PR aims to add two new methods:

  • setAttribute in order to set custom attribute using Batch SDK
  • trackLocation in order to send one user's location using Batch SDK

@tpucci tpucci changed the title WIP: Add setAttribute and trackLocation methods 🚧 WIP: Add setAttribute and trackLocation methods Jan 4, 2018
@tpucci tpucci force-pushed the feature/set-attribute-and-track-location branch from 437565b to c5a3f44 Compare January 5, 2018 10:36
@tpucci tpucci changed the title 🚧 WIP: Add setAttribute and trackLocation methods Add setAttribute and trackLocation methods Jan 5, 2018
@tpucci tpucci requested a review from Minishlink January 5, 2018 10:42
Copy link
Contributor

@Minishlink Minishlink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

README.md Outdated
```js
import BatchPush from 'react-native-batch-push';

// if you want to track one user's location
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the user's location?

@@ -1,4 +1,5 @@
#import "RNBatchPush.h"
#import <React/RCTConvert.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are framework imports, typically they are at the top of the file ;)

@ReactMethod
public void trackLocation(ReadableMap locationMap) {
Location location = new Location("reactNative");
location.setAccuracy((float) locationMap.getDouble("accuracy"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the docs there are no mentions of accuracy, altitude and speed, would you not rather not set the accuracy, altitude and speed of the Location? So that's the same as iOS

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Batch uses Android Location class. As a result, I am not sure which parameters Batch use. So I decided to construct the best Android Location instance with all details I have from the returned value of RN.geolocation.getCurrentPosition().
For example, in the Batch Dashboard, I see these values:

  "geo_accuracy": 17.65,
  "geo_last_update": "2018-01-09T17:00:06",
  "geo_latitude": 48.8827743,
  "geo_longitude": 2.3222816

Would you like to remove these lines anyway ?

Copy link
Contributor

@Minishlink Minishlink Jan 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it doesn't crash if you doesn't provide any accuracy/altitude/speed to the location javascript object, it's fine 👍

Copy link
Contributor

@Minishlink Minishlink Jan 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it crashes, maybe update the doc to say that these keys are mandatory on Android

Copy link
Contributor

@Minishlink Minishlink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 👍

@Minishlink Minishlink merged commit 7f105a9 into master Jan 18, 2018
@Minishlink Minishlink deleted the feature/set-attribute-and-track-location branch January 18, 2018 14:43
@Minishlink Minishlink restored the feature/set-attribute-and-track-location branch January 18, 2018 14:43
@yleflour yleflour deleted the feature/set-attribute-and-track-location branch August 30, 2018 16:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants