Skip to content

Application crashing in production in particular devices #24

@surajQuitsure

Description

@surajQuitsure

As per the google crashlytics, while registering the ScreenGuard module application is crashing in some devices.

Devices: Motorola edge 40 - Android 13, Nothing Phone(1) - Android 13, etc.

My implementation of ScreenGuard in react native:

  import { useColorScheme } from 'react-native';

  const isDarkMode = useColorScheme();

  useEffect(() => {
    const screenCaptureColor = isDarkMode === "dark" ? Colors.darker : Colors.lighter
    ScreenGuardModule.register(screenCaptureColor, (_) => {
      console.log("ScreenGuradModule registered")
    });

    //handling android backpress
    const onbackPress = async () => {
      navigation.pop();
    };

    const backHandler = BackHandler.addEventListener(
      'hardwareBackPress',
      onbackPress,
    );

    return async () => {
      backHandler.remove();
      ScreenGuardModule.unregister()
    };
  }, []);

As per the crashlytics reports are:

  ScreenGuardModule.lambda$deactivateShield$2
  java.lang.NullPointerException
  java.util.Objects.requireNonNull (Objects.java:220)
 com.screenguard.ScreenGuardModule.lambda$deactivateShield$2 (ScreenGuardModule.java:6)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdone

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions