view

The View module of the TWS SDK provides a set of tools to seamlessly embed web content into your Android applications using Jetpack Compose. It focuses on simplifying the integration of web-based features and enhancing the user interface with dynamic and customizable web views.

With the View module, you can create, display, and interact with web snippets directly in your Compose-based layouts. It is designed to handle dynamic content, error states, loading indicators, and more, ensuring a smooth and polished user experience.

Installation

Add view module dependencies to the app-level Gradle file of your project:

dependencies {
implementation("com.thewebsnippet:view:1.6.1") // Contains UI Composable components for displaying web pages
}

Permissions

Web permission are handled natively within TWSView. All you need to do is include the required permissions in AndroidManifest, if your web pages requires any of the following permission.

  • for camera permissions, include: <uses-permission android:name="android.permission.CAMERA"/> and <uses-feature android:name="android.hardware.camera" android:required="false" />,

  • and for accessing the users location, include: <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

When any of the permissions is triggered, a native "permissions required" modal will be shown to the user, and the permission settings will be remembered by the application. This includes the support for opening gallery as well as downloading and uploading files.

See the "permissions" Snippets Dashboard for the JavaScript implementation download/upload, camera and location access.

How to handle Google Login

Define base url while generating apk

When generating App Bundles using CLI, include the optional parameter --google-login-base-url. The URL should follow the format https://domain.name/path and should define the page to where user is redirected after a successful login. (subject of change, will be defined when web implements bundle creating)

Declare website associations

  1. Create an assetlinks.json file from bottom template (note that you can find pregenerated file with your app bundles):

     [{
    "relation": ["delegate_permission/common.handle_all_urls"],
    "target": {
    "namespace": "android_app",
    "package_name": "com.example",
    "sha256_cert_fingerprints": ["hash_of_app_certificate"]
    }
    }]
  2. Replace "com.example" for the "package_name" with the actual package name

  3. Replace "hash_of_app_certificate" with the actual hash, that was generated by the CLI while creating your Android apk

  4. Publish generated Asset Links JSON file to your website to the following location:

     https://domain.name/.well-known/assetlinks.json

Packages

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard