react-native-background-geolocation: MainActivity class detection not working with Android product flavors
Your Environment
- Plugin version: 3.9.0
- Platform: Android
- OS version: 9
- Device manufacturer / model: Samsung Galaxy S8
- React Native version (
react-native -v): 4.4.0 - Plugin config
{
distanceFilter: 0,
showsBackgroundLocationIndicator: true,
locationUpdateInterval: 15000,
allowIdenticalLocations: true,
foregroundService: true,
notification: {
title: "title",
text: "text",
color: "#FFFFFF",
largeIcon: "mipmap/notification_icon",
smallIcon: "mipmap/notification_icon",
},
logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
}
Expected Behavior
Main android manifest declares package="com.test" and activity android:name="com.test.MainActivity".
Product flavor declares applicationIdSuffix ".flavor".
Android product id and final package name is com.test.flavor and MainActivity class is com.test.MainActivity by default.
You can start a project like this by running react-native run-android --appIdSuffix=flavor --variant=flavorNameDebug which launches com.test.flavor/com.test.MainActivity` correctly. Release build works fine.
Expect library to work with android product flavors without assuming MainActivity class location or allow class configuration.
Actual Behavior
When using this library, the plugin instantly stops unless stopOnTerminate: false is used because it detects that the main activity is not running even when the app is on. BackgroundGeolocation isMainActivityActive NO repeats in logs. When not using an Android product flavor the library works correctly. Library should detect or allow configuring of MainActivity class, the default detection does not work when using product flavors.
Steps to Reproduce
- Add flavor dimension to react native project
- Add product flavor
- Add applicationIdSuffix to product flavor
- Configure the project to use this library
- Run react native app with
react-native run-android --appIdSuffix=yourSuffix --variant=yourFlavorDebug
Context
Debug logs
Logs
PASTE_YOUR_LOGS_HERE
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (7 by maintainers)
I meant that is was doing it correctly in the new version, sorry for the confusion.