Skip to content

React Native Android privacy toolkit for FLAG_SECURE and content sensitivity, with Samsung Privacy Display support detection and Settings guidance until a public Samsung API exists.

Notifications You must be signed in to change notification settings

lech-kalinowski/react-native-private-screen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-private-screen

React Native privacy toolkit for Android with a fast-track API focused on:

  • Screen capture blocking (FLAG_SECURE)
  • Best-effort content sensitivity (View.setContentSensitivity(...) where available)
  • Samsung Privacy Display support detection and Settings guidance (no third-party Samsung toggle API assumed)

Why This Project Exists

Samsung Privacy Display on Galaxy S26 Ultra is a hardware privacy feature, but there is no documented public third-party API (yet) for apps to toggle it programmatically.

This project exists to provide immediate value now:

  • expose Android privacy protections apps can use today (FLAG_SECURE, best-effort content sensitivity)
  • give apps a clean Samsung-specific integration path (support detection + Settings guidance)
  • preserve a stable API surface that can later grow into official Samsung Privacy Display controls if Samsung publishes supported APIs

Scope

This library intentionally separates different privacy controls:

  • FLAG_SECURE: blocks screenshots and non-secure displays/casting at the window level
  • setContentSensitivity: best-effort selective screen-sharing privacy on newer Android versions
  • Samsung Privacy Display: hardware shoulder-surfing/privacy-angle feature on supported Samsung devices, exposed here only as support detection + Settings navigation until Samsung documents a public app API

Install

npm install react-native-private-screen

Rebuild your Android app after installation.

Usage

import React, { useEffect } from 'react';
import { Button, Text, View } from 'react-native';
import { PrivateScreen } from 'react-native-private-screen';

export function SensitiveScreen() {
  useEffect(() => {
    void PrivateScreen.setScreenCaptureProtection('flagSecureOnDemand');
    void PrivateScreen.setContentSensitivity('sensitive');

    return () => {
      void PrivateScreen.setScreenCaptureProtection('off');
      void PrivateScreen.setContentSensitivity('notSensitive');
    };
  }, []);

  return (
    <View>
      <Text>Sensitive content</Text>
      <Button
        title="Open Samsung display privacy settings"
        onPress={() => {
          void PrivateScreen.openSamsungPrivacyDisplaySettings();
        }}
      />
    </View>
  );
}

API

PrivateScreen.setScreenCaptureProtection(mode)

Modes:

  • 'off'
  • 'flagSecure'
  • 'flagSecureOnDemand'

PrivateScreen.setContentSensitivity(mode)

Modes:

  • 'notSensitive'
  • 'sensitive'
  • 'auto'

On Android versions/builds without setContentSensitivity, this call is a no-op.

PrivateScreen.getSamsungPrivacyDisplaySupport()

Returns:

  • { availability: { status: 'unavailable', reason: '...' } } on non-Samsung/non-Android
  • { availability: { status: 'unknown', reason: 'No public app API...' } } on Samsung devices

PrivateScreen.openSamsungPrivacyDisplaySettings()

Best-effort navigation to Android settings screens (Display, app details, or general Settings) so users can enable Samsung Privacy Display manually when supported by their device/firmware.

Notes

  • This library does not claim to programmatically toggle Samsung Privacy Display.
  • Samsung-specific programmatic controls should be added only after an official public API/intent contract is documented and verified on hardware.

About

React Native Android privacy toolkit for FLAG_SECURE and content sensitivity, with Samsung Privacy Display support detection and Settings guidance until a public Samsung API exists.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors