The OSPrivacyScreenLib-Android
is a library built using Kotlin
that provides privacy screen features for Android applications. It prevents sensitive information from being visible in app switchers and when leaving an app.
The OSPrivacyScreenController
class provides the main features of the Library, which are:
- Enabling/disabling privacy screen protection
- Managing screenshot prevention
- Handling app switcher privacy
- Configuring background dimming options
This library is used by the Privacy Screen Plugin for OutSystems' Capacitor Plugin. It provides a robust solution for protecting sensitive information when an app goes into the background or appears in the app switcher.
In your app-level gradle file, import the OSPrivacyScreenLib
library:
dependencies { implementation("com.capacitorjs:osprivacyscreen-android:1.0.0") }
The library offers the OSPrivacyScreenController
class that provides the following methods:
fun enable(
activity: Activity,
config: OSPrivacyScreenConfig? = null
): Boolean
Input parameters:
- activity: the
Activity
from the app using the library - config: Optional configuration options for customizing privacy screen behavior
Returns a Boolean indicating if privacy screen was successfully enabled.
fun disable(
activity: Activity
): Boolean
Input parameters:
- activity: the
Activity
from the app using the library
Returns a Boolean indicating if privacy screen was successfully disabled.
fun isEnabled(): Boolean
Returns a Boolean indicating if privacy screen protection is currently active.
The library supports configuration through the OSPrivacyScreenConfig
class:
data class OSPrivacyScreenConfig(
val dimBackground: Boolean = false // Use dim effect instead of splash screen
)
Common issues and solutions:
-
Privacy screen not showing
- Verify the activity reference is valid
- Ensure proper configuration in
AndroidManifest.xml
- Check if any other overlay permissions are conflicting
-
Splash screen not appearing
- Verify splash screen resource exists
- Check theme configuration
- Consider using dimBackground option instead
-
Performance issues
- Minimize heavy operations during screen transitions
- Use appropriate configuration for device capabilities
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
OSPrivacyScreenLib
is available under the MIT license. See the LICENSE file for more info.
- Report issues on our Issue Tracker