transistorsoft / react-native-background-geolocation

Sophisticated, battery-conscious background-geolocation with motion-detection
http://shop.transistorsoft.com/pages/react-native-background-geolocation
MIT License
2.66k stars 426 forks source link

`LICENSE_VALIDATION_FAILURE` expo development build. #1838

Closed premdasvm closed 1 year ago

premdasvm commented 1 year ago

Your Environment


# app.config.ts
```ts
import type { ConfigContext, ExpoConfig } from "@expo/config";
import { ClientEnv, Env } from "./env";

export default ({ config }: ConfigContext): ExpoConfig => ({
    ...config,
    name: Env.NAME,
    description: `${Env.NAME} Mobile app`,
    owner: Env.EXPO_ACCOUNT_OWNER,
    slug: "rnapp",
    version: Env.VERSION.toString(),
    orientation: "portrait",
    icon: "./assets/icon.png",
    userInterfaceStyle: "light",
    splash: {
        image: "./assets/splash.png",
        resizeMode: "contain",
        backgroundColor: "#ffffff",
    },
    assetBundlePatterns: ["**/*"],
    ios: {
        supportsTablet: true,
        bundleIdentifier: Env.BUNDLE_ID,
    },
    android: {
        adaptiveIcon: {
            foregroundImage: "./assets/adaptive-icon.png",
            backgroundColor: "#ffffff",
        },
        package: Env.PACKAGE,
    },
    web: {
        favicon: "./assets/favicon.png",
    },
    plugins: [
        ["@bacons/link-assets", ["./assets/fonts/Inter.ttf"]],
        [
            "expo-build-properties",
            {
                android: {
                    compileSdkVersion: 33,
                    targetSdkVersion: 33,
                    buildToolsVersion: "33.0.0",
                    kotlinVersion: "1.8.10",
                },
                ios: {
                    deploymentTarget: "13.0",
                },
            },
        ],
        [
            "react-native-background-geolocation",
            {
                license: "YOUR_LICENSE_KEY_HERE",
            },
        ],
        [
            "expo-gradle-ext-vars",
            {
                googlePlayServicesLocationVersion: "20.0.0",
                appCompatVersion: "1.4.2",
            },
        ],
        "react-native-background-fetch",
    ],
    extra: {
        ...ClientEnv,
        eas: {
            projectId: Env.EAS_PROJECT_ID,
        },
    },
});

Expected Behavior

React Functional component example from the documentation to work on the dev-client.

Actual Behavior

Pressing the enable background geo location button shows an error. Also Permission popups not showing, had to manually go to settings and allow permissions. App is on debug mode, still showing LICENSE_VALIDATION_FAILURE when i call start() function.

Showing [onLocation] {"error": 1} on IOS.

 WARN  Possible Unhandled Promise Rejection (id: 1):
"LICENSE_VALIDATION_FAILURE"
<meta-data android:name="com.transistorsoft.locationmanager.hms.license" android:value="UNDEFINED"/>
<meta-data android:name="com.transistorsoft.locationmanager.license" android:value="YOUR_LICENSE_KEY_HERE"/>

Steps to Reproduce

  1. New project using this template Obytes Starter
  2. Install and configure react-native-background-geolocation as per documentation.
  3. pnpm expo prebuild
  4. EXPO_NO_DOTENV=1 pnpm expo run:android
  5. Use the React functional component example
Logs ``` ReactNativeJS com.padaz.fieldsync.development W Possible Unhandled Promise Rejection (id: 3): "LICENSE_VALIDATION_FAILURE" ```
premdasvm commented 1 year ago

I think i found what's wrong, i'm getting the package name for android from my env file, when i moved that and directly applied my package name it's working.

android: {
adaptiveIcon: {
    foregroundImage: "./assets/adaptive-icon.png",
    backgroundColor: "#ffffff",
},
package: "com.my.packagename",
},
christocracy commented 1 year ago

So this issue is closed then