Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vs/ProjectSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": "Keine Konfigurationen"
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .vs/slnx.sqlite
Binary file not shown.
163 changes: 79 additions & 84 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,86 @@
[![CircleCI](https://circleci.com/gh/mauron85/react-native-background-geolocation/tree/master.svg?style=shield)](https://circleci.com/gh/mauron85/react-native-background-geolocation/tree/master)
[![issuehunt-shield-v1](issuehunt-shield-v1.svg)](https://issuehunt.io/r/mauron85/react-native-background-geolocation/)

## We're moving
Forked from [@maruon85/react-native-background-geolocation](https://github.com/mauron85/react-native-background-geolocation) due to inactivity.

Npm package is now [@mauron85/react-native-background-geolocation](https://www.npmjs.com/package/@mauron85/react-native-background-geolocation)!
## Installation

```
yarn add @mauron85/react-native-background-geolocation
```

### Automatic setup

Since version 0.60 React Native does linking of modules [automatically](https://github.com/react-native-community/cli/blob/master/docs/autolinking.md). However it does it only for single module.
As plugin depends on additional 'common' module, it is required to link it with:

```
node ./node_modules/@mauron85/react-native-background-geolocation/scripts/postlink.js
```

### Manual setup

#### Android setup

In `android/settings.gradle`

```gradle
...
include ':@mauron85_react-native-background-geolocation-common'
project(':@mauron85_react-native-background-geolocation-common').projectDir = new File(rootProject.projectDir, '../node_modules/@mauron85/react-native-background-geolocation/android/common')
include ':@mauron85_react-native-background-geolocation'
project(':@mauron85_react-native-background-geolocation').projectDir = new File(rootProject.projectDir, '../node_modules/@mauron85/react-native-background-geolocation/android/lib')
...
```

In `android/app/build.gradle`

```gradle
dependencies {
...
compile project(':@mauron85_react-native-background-geolocation')
...
}
```

Register the module (in `MainApplication.java`)

```java
import com.marianhello.bgloc.react.BackgroundGeolocationPackage; // <--- Import Package

public class MainApplication extends Application implements ReactApplication {
...
/**
* A list of packages used by the app. If the app uses additional views
* or modules besides the default ones, add more packages here.
*/
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new BackgroundGeolocationPackage() // <---- Add the Package
);
}
...
}
```

#### iOS setup

1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`
2. Add `./node_modules/@mauron85/react-native-background-geolocation/ios/RCTBackgroundGeolocation.xcodeproj`
3. In the XCode project navigator, select your project, select the `Build Phases` tab and in the `Link Binary With Libraries` section add **libRCTBackgroundGeolocation.a**
4. Add `UIBackgroundModes` **location** to `Info.plist`
5. Add `NSMotionUsageDescription` **App requires motion tracking** to `Info.plist` (required by ACTIVITY_PROVIDER)

For iOS before version 11:

6. Add `NSLocationAlwaysUsageDescription` **App requires background tracking** to `Info.plist`

For iOS 11:

6. Add `NSLocationWhenInUseUsageDescription` **App requires background tracking** to `Info.plist`
7. Add `NSLocationAlwaysAndWhenInUseUsageDescription` **App requires background tracking** to `Info.plist`

## Submitting issues

Expand Down Expand Up @@ -210,88 +287,6 @@ class BgTracking extends Component {
export default BgTracking;
```

## Instalation

### Installation

Add the package to your project

```
yarn add @mauron85/react-native-background-geolocation
```

### Automatic setup

Since version 0.60 React Native does linking of modules [automatically](https://github.com/react-native-community/cli/blob/master/docs/autolinking.md). However it does it only for single module.
As plugin depends on additional 'common' module, it is required to link it with:

```
node ./node_modules/@mauron85/react-native-background-geolocation/scripts/postlink.js
```

### Manual setup

#### Android setup

In `android/settings.gradle`

```gradle
...
include ':@mauron85_react-native-background-geolocation-common'
project(':@mauron85_react-native-background-geolocation-common').projectDir = new File(rootProject.projectDir, '../node_modules/@mauron85/react-native-background-geolocation/android/common')
include ':@mauron85_react-native-background-geolocation'
project(':@mauron85_react-native-background-geolocation').projectDir = new File(rootProject.projectDir, '../node_modules/@mauron85/react-native-background-geolocation/android/lib')
...
```

In `android/app/build.gradle`

```gradle
dependencies {
...
compile project(':@mauron85_react-native-background-geolocation')
...
}
```

Register the module (in `MainApplication.java`)

```java
import com.marianhello.bgloc.react.BackgroundGeolocationPackage; // <--- Import Package

public class MainApplication extends Application implements ReactApplication {
...
/**
* A list of packages used by the app. If the app uses additional views
* or modules besides the default ones, add more packages here.
*/
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new BackgroundGeolocationPackage() // <---- Add the Package
);
}
...
}
```

#### iOS setup

1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`
2. Add `./node_modules/@mauron85/react-native-background-geolocation/ios/RCTBackgroundGeolocation.xcodeproj`
3. In the XCode project navigator, select your project, select the `Build Phases` tab and in the `Link Binary With Libraries` section add **libRCTBackgroundGeolocation.a**
4. Add `UIBackgroundModes` **location** to `Info.plist`
5. Add `NSMotionUsageDescription` **App requires motion tracking** to `Info.plist` (required by ACTIVITY_PROVIDER)

For iOS before version 11:

6. Add `NSLocationAlwaysUsageDescription` **App requires background tracking** to `Info.plist`

For iOS 11:

6. Add `NSLocationWhenInUseUsageDescription` **App requires background tracking** to `Info.plist`
7. Add `NSLocationAlwaysAndWhenInUseUsageDescription` **App requires background tracking** to `Info.plist`

## API

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.marianhello.bgloc.react;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import android.support.test.filters.SmallTest;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import androidx.test.filters.SmallTest;

import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.ReadableMap;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package com.marianhello.bgloc.react;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class BackgroundGeolocationPackage implements ReactPackage {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;

import com.facebook.react.HeadlessJsTaskService;
import com.facebook.react.bridge.Arguments;
Expand Down
2 changes: 1 addition & 1 deletion android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
include ':lib'
include ':@mauron85_react-native-background-geolocation-common'
project(':@mauron85_react-native-background-geolocation-common').projectDir = new File(rootProject.projectDir, './common')
project(':@mauron85_react-native-background-geolocation-common').projectDir = new File(rootProject.projectDir, './common')
79 changes: 58 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,44 @@
{
"name": "@mauron85/react-native-background-geolocation",
"version": "0.6.3",
"description": "optimized background location tracking",
"main": "./index.js",
"types": "./index.d.ts",
"scripts": {
"link": "@mauron85/react-native-background-geolocation/scripts/postlink.js",
"unlink": "@mauron85/react-native-background-geolocation/scripts/postunlink.js",
"test": "echo \"Error: no test specified\" && exit 1"
"_args": [
[
"@mauron85/[email protected]",
"C:\\Users\\Denni\\source\\repos\\CronosZone\\smartphoneApp\\kuckuck"
]
],
"_from": "@mauron85/[email protected]",
"_id": "@mauron85/[email protected]",
"_inBundle": false,
"_integrity": "sha512-IQHSg4ybq8qDdf4mNZPqvV5Z2vTBKp1ehuqrc2zDdtJr7ihLTsQMGjhiGZ0BLVL+pwdOKrp0Q/TP3lFVfpyRKA==",
"_location": "/@mauron85/react-native-background-geolocation",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@mauron85/[email protected]",
"name": "@mauron85/react-native-background-geolocation",
"escapedName": "@mauron85%2freact-native-background-geolocation",
"scope": "@mauron85",
"rawSpec": "0.6.6",
"saveSpec": null,
"fetchSpec": "0.6.6"
},
"repository": {
"type": "git",
"url": "git+https://github.com/mauron85/react-native-background-geolocation.git"
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npmjs.org/@mauron85/react-native-background-geolocation/-/react-native-background-geolocation-0.6.6.tgz",
"_spec": "0.6.6",
"_where": "C:\\Users\\Denni\\source\\repos\\CronosZone\\smartphoneApp\\kuckuck",
"author": {
"name": "Marian Hello"
},
"bugs": {
"url": "https://github.com/mauron85/react-native-background-geolocation/issues"
},
"dependencies": {
"plist": "^3.0.1"
},
"description": "optimized background location tracking",
"homepage": "https://github.com/mauron85/react-native-background-geolocation#readme",
"keywords": [
"gps",
"geolocation",
Expand All @@ -26,16 +52,27 @@
"android",
"ios"
],
"author": "Marian Hello",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/mauron85/react-native-background-geolocation/issues"
},
"homepage": "https://github.com/mauron85/react-native-background-geolocation#readme",
"dependencies": {
"plist": "^3.0.1"
},
"main": "./index.js",
"maintainers": [
{
"name": "Darron Park",
"email": "[email protected]"
}
],
"name": "@mauron85/react-native-background-geolocation",
"peerDependencies": {
"react-native": ">=0.60.5"
}
},
"repository": {
"type": "git",
"url": "git+https://github.com/mauron85/react-native-background-geolocation.git"
},
"scripts": {
"link": "@mauron85/react-native-background-geolocation/scripts/postlink.js",
"test": "echo \"Error: no test specified\" && exit 1",
"unlink": "@mauron85/react-native-background-geolocation/scripts/postunlink.js"
},
"types": "./index.d.ts",
"version": "0.6.6"
}
2 changes: 1 addition & 1 deletion react-native.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ module.exports = {
postunlink: "node ./node_modules/@mauron85/react-native-background-geolocation/scripts/postunlink.js"
}
}
};
};