Skip to content

Commit

Permalink
Post notification permission to allow icon to be shown for Android 13+ (
Browse files Browse the repository at this point in the history
#187)

* Initial commit to add the push notification permission and some cleanup

* Improve conributors text

* Fix build

* Fix push to post

* Add permissions in the right places

* Note on capacitor in readme

* Make notification onGoing

* Bump version to 2.1.0
  • Loading branch information
HarelM authored May 22, 2024
1 parent 0e989d1 commit 98f4ab1
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 150 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@v2
- uses: actions/checkout@mv2
- uses: actions/setup-node@v4
with:
node-version: 12
node-version: 20
registry-url: https://registry.npmjs.org/

- run: npm install
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributors

Many thanks to all contributors and special thanks to [christocracy](https://github.com/christocracy) as former author, and [mauron85](https://github.com/mauron85).
Many thanks to all contributors and special thanks to [christocracy](https://github.com/christocracy) and [mauron85](https://github.com/mauron85) as former authors.

* [mauron85](https://github.com/mauron85)
* [christocracy](https://github.com/christocracy)
Expand Down
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
# Cordova Background Geolocation Plugin

[![npm](https://img.shields.io/npm/v/cordova-background-geolocation-plugin?style=flat-square)](https://www.npmjs.com/package/cordova-background-geolocation-plugin)
![npm bundle size](https://img.shields.io/bundlephobia/min/cordova-background-geolocation-plugin?style=flat-square)
![npm](https://img.shields.io/npm/dm/cordova-background-geolocation-plugin?style=flat-square)
![npm downloads](https://img.shields.io/npm/dm/cordova-background-geolocation-plugin?style=flat-square)

[![GitHub issues](https://img.shields.io/github/issues/HaylLtd/cordova-background-geolocation-plugin?style=flat-square)](https://github.com/HaylLtd/cordova-background-geolocation-plugin/issues)
[![GitHub stars](https://img.shields.io/github/stars/HaylLtd/cordova-background-geolocation-plugin?style=flat-square)](https://github.com/HaylLtd/cordova-background-geolocation-plugin/stargazers)
![GitHub last commit](https://img.shields.io/github/last-commit/HaylLtd/cordova-background-geolocation-plugin?style=flat-square)

![cordova](https://img.shields.io/badge/cordova-ios%20%7C%20android-blue?style=flat-square)

## Introduction

*Cross-platform geolocation for Cordova with battery-saving "circular region monitoring" and "stop detection"*
*Cross-platform geolocation for Cordova and Capacitor with battery-saving "circular region monitoring" and "stop detection"*

This plugin can be used for geolocation when the app is running in the foreground or background. It is more battery and data efficient than html5 geolocation or cordova-geolocation plugin. It can be used side by side with other geolocation providers (eg. html5 navigator.geolocation).
This plugin can be used for geolocation when the app is running in the foreground or background. It is more battery and data efficient than html5 geolocation. It can be used side by side with other geolocation providers (eg. html5 navigator.geolocation).

This project is based on [@mauron85/cordova-plugin-background-geolocation](https://github.com/mauron85/cordova-plugin-background-geolocation), which in turn was based on the original [cordova-background-geolocation plugin](https://github.com/christocracy/cordova-plugin-background-geolocation) by [christocracy](https://github.com/christocracy). Hayl Ltd have taken on responsibility for hosting it and will be maintaining it and merging PRs from the community. If you have any fixes, features or updates that you would like included, please do raise a PR or issue on the GitHub repository.

Expand All @@ -30,6 +27,8 @@ The NPM package can be found at [cordova-background-geolocation-plugin](https://

**Note:** for non AndroidX project please use version 1.x of this plugin. Version 2.x and on will support AndroidX.

**Note:** this plugin can be installed on a Capacitor project and it is tested to be working as expected, some configuration may need to be done differently than below according to how Capacitor configuration is implemented.

```bash
cordova plugin add cordova-background-geolocation-plugin
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

<application android:label="@string/app_name">
</application>
Expand Down
83 changes: 0 additions & 83 deletions android/common/.circleci/config.yml

This file was deleted.

Binary file removed android/common/ci/res/dummy.apk
Binary file not shown.
52 changes: 0 additions & 52 deletions android/common/ci/scripts/google_cloud.sh

This file was deleted.

1 change: 1 addition & 0 deletions android/common/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,5 @@
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS"/>
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public class BackgroundGeolocationFacade {

public static final String[] PERMISSIONS = {
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_FINE_LOCATION
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.POST_NOTIFICATIONS,
};

private boolean mServiceBroadcastReceiverRegistered = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public Notification getNotification(String title, String text, String largeIcon,

builder.setContentTitle(title);
builder.setContentText(text);
builder.setOngoing(true);
if (smallIcon != null && !smallIcon.isEmpty()) {
builder.setSmallIcon(mResolver.getDrawable(smallIcon));
} else {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-background-geolocation-plugin",
"version": "2.0.10",
"version": "2.1.0",
"description": "Cordova Background Geolocation Plugin",
"main": "./www/BackgroundGeolocation.js",
"types": "./www/BackgroundGeolocation.d.ts",
Expand Down
3 changes: 2 additions & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-background-geolocation-plugin"
version="2.0.10">
version="2.1.0">
<name>cordova-background-geolocation-plugin</name>
<description>Cordova Background Geolocation Plugin</description>
<license>Apache-2.0</license>
Expand Down Expand Up @@ -183,6 +183,7 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.hardware.location" />
</config-file>
<config-file target="res/xml/config.xml" parent="/*">
Expand Down

0 comments on commit 98f4ab1

Please sign in to comment.