react-native-background-geolocation
react-native-background-geolocation copied to clipboard
Possibility on Android to pass notification channel ID
Possibility on Android to pass notification channel ID. In case the channel ID is not found the SDK should create a new one.
Your Environment
- Plugin version: 4.8.2
- Platform: Android
- OS version: 12
- Device manufacturer / model: Samsung S20FE 5G
- React Native version (
react-native -v): 0.68 - Plugin config
await BackgroundGeolocation.ready({
// Geolocation Config
enableHeadless: true,
desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
distanceFilter: 10,
stopTimeout: 10,
// Application config
debug: false,
logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
stopOnTerminate: false,
startOnBoot: true,
isMoving: true,
url: `${baseUrl}/location`,
batchSync: false,
autoSync: true,
headers: {
"Content-Type": "application/json",
"Authorization": `${authorization}`
},
disableLocationAuthorizationAlert: false,
locationAuthorizationRequest: "Any",
backgroundPermissionRationale: {
message: I18n.t("request_permissions_bk_location"),
negativeAction: I18n.t("no_label"),
positiveAction: I18n.t("yes_label")
},
locationTemplate: '{"latitude":<%= latitude %>,"longitude":<%= longitude %>, "activity": "<%= activity.type %>"}',
httpRootProperty: ".",
notification: {
smallIcon: "mipmap/ic_notification",
color: "#02d1bb",
channelName: "Location tracking"
}
});
Expected Behavior
To add channelID parameter to the notification and use it as the notification channel. If the notification manager does not find the channel ID then create a new one as is implemented currently.
await BackgroundGeolocation.ready({
// Geolocation Config
enableHeadless: true,
desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
distanceFilter: 10,
stopTimeout: 10,
// Application config
debug: false,
logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
stopOnTerminate: false,
startOnBoot: true,
isMoving: true,
url: `${baseUrl}/location`,
batchSync: false,
autoSync: true,
headers: {
"Content-Type": "application/json",
"Authorization": `${authorization}`
},
disableLocationAuthorizationAlert: false,
locationAuthorizationRequest: "Any",
backgroundPermissionRationale: {
message: I18n.t("request_permissions_bk_location"),
negativeAction: I18n.t("no_label"),
positiveAction: I18n.t("yes_label")
},
locationTemplate: '{"latitude":<%= latitude %>,"longitude":<%= longitude %>, "activity": "<%= activity.type %>"}',
httpRootProperty: ".",
notification: {
smallIcon: "mipmap/ic_notification",
color: "#02d1bb",
channelD: CHANNEL_ID
}
});
So are you creating your own NotificationChannel, and hoping to have the plugin use your own channel?
So are you creating your own
NotificationChannel, and hoping to have the plugin use your own channel?
Yes indeed.
I will look into adding Notification.channelId.
I will look into adding
Notification.channelId.
We would appreciate if you can add it. We are using it commercially (with license) and having two foreground services in the notification bar on Android doesn't look professional. And we can't reuse your channel as these two use-cases don't overlap 100% in terms of when they are used.
Thanks
Authorization.channelId has been pushed to branch release-4.8.3. Please test by installing the plugin from the private repo
yarn add https://github.com/transistorsoft/react-native-background-geolocation-android#release-4.8.3
Tagged in private repo as 4.9.0
Authorization.channelIdhas been pushed to branchrelease-4.8.3. Please test by installing the plugin from the private repoyarn add https://github.com/transistorsoft/react-native-background-geolocation-android#release-4.8.3
update status: Sorry for the delay, we are stuck in some 'notification group' related issues/arhitecture. We'll provide feedback soon. Thanks
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.