Skip to content

Android App

The Android app is a fast, modern Kotlin web-view app for your Sngine website. It runs on Android 8.1 and newer, and you only need to edit a few files to make it yours.

If you don't have enough experience with Mobile App Development, we offer native Android and iOS builds and store submission. For more info, see our Apps Building service.
⚠️ You must have Sngine PHP Social Network Platform installed on your server with an SSL certificate (https://) to build the app
You will only edit these files, all inside the android folder:
  • app/src/main/java/sngine/app/webview/SngineConfig.kt → website URL, OneSignal and features
  • app/src/main/res/values/sngine_config.xml → app name and colors
  • app/src/main/res/drawable-nodpi/splash_logo_image.png → splash screen logo
  • app/build.gradle.kts → application ID, namespace and version
You will also rename the package sngine.app.webview to your own, see Rename the app package.

Open the app in Android Studio

  1. Download and install the latest version of Android Studio

  2. From the menu select File > Open and choose the android folder (the one that contains settings.gradle.kts)

  3. Wait until Android Studio finishes the Gradle sync. The first sync downloads the required tools and can take a few minutes

Connect your website

  1. Open app/src/main/java/sngine/app/webview/SngineConfig.kt and change SITE_URL to your website URL (keep the / at the end)

    const val SITE_URL = "https://your-website.com/"
  2. To enable push notifications, add your OneSignal App ID. Use the same App ID you saved in Sngine Admin Panel → Settings → Notifications Settings in the Timeline Apps section, see Push Notifications for Timeline Apps

    const val ONESIGNAL_APP_ID = "your-onesignal-app-id"
  3. The same file has all the other options with a comment above each one, like file uploads, location, pull-to-refresh, zoom and the rating prompt. Change true to false to turn a feature off

Change the app name and colors

  1. Open app/src/main/res/values/sngine_config.xml and change the app name and colors

    <string name="app_name">Your App Name</string>
    <color name="brand_primary">#5E72E4</color>
    • app_name → the name under the app icon
    • brand_primary → the loading bar, pull-to-refresh spinner and buttons
    • system_bar_background → the color behind the status bar and navigation bar
    • light_system_bars → true for dark status bar icons on a light color, false for a dark color
    • page_background → the color behind your website while it loads
  2. Dark mode colors are in app/src/main/res/values-night/sngine_config.xml. Sngine follows the phone's dark mode, so match these to your website's dark theme

Change the splash screen

The app uses the modern Android splash screen. It stays on screen until your website is ready, then fades out.

  1. Replace app/src/main/res/drawable-nodpi/splash_logo_image.png with your logo. Use a square PNG of 512×512 pixels or larger and keep the same file name

  2. Change the background color with splash_background in sngine_config.xml, and in values-night/sngine_config.xml for dark mode

  3. Android shows the logo inside a circle. If your logo looks too big or too small, change android:inset in app/src/main/res/drawable/splash_logo.xml (a lower value makes the logo bigger)

    android:inset="24%"

Change the app icon

  1. In Android Studio, right-click the app folder and select New > Image Asset

  2. Keep Launcher Icons (Adaptive and Legacy) and the name ic_launcher, choose your icon image, then click Next > Finish to replace the old icon

  3. For the push notifications icon, open Image Asset again, select Notification Icons and use the name ic_stat_onesignal_default

Change the application ID

  1. Every app on Google Play needs its own unique application ID. Open app/build.gradle.kts and change applicationId to your own, for example com.yourwebsite.app

    applicationId = "com.yourwebsite.app"
  2. In the same file, versionCode and versionName are your app version. Increase versionCode by 1 every time you upload a new version to Google Play

    versionCode = 1
    versionName = "1.0"

Rename the app package

⚠️ Don't publish with the default Kotlin package sngine.app.webview. Rename it to match your own applicationId, otherwise Google Play can flag your app
  1. In the Android Studio Project panel, click the ⋮ menu, select Appearance and uncheck Compact Middle Packages. Now sngine, app and webview show as separate folders inside app/src/main/java

  2. Right-click the sngine folder and select Refactor > Rename. If Android Studio asks, choose Rename package, type the first part of your application ID (for example com), click Refactor, then Do Refactor

  3. Do the same for app and webview with the other parts of your application ID. For com.yourwebsite.app, rename app to yourwebsite and webview to app

  4. Open app/build.gradle.kts and change namespace to the same value as your applicationId

    namespace = "com.yourwebsite.app"
  5. From the menu select Edit > Find > Replace in Files, search for sngine.app.webview and replace what is left with your application ID (like the baselineprofile module)

  6. Select File > Sync Project with Gradle Files, then Build > Rebuild Project and make sure there are no errors

After the rename, your config file moves with the package, for example to app/src/main/java/com/yourwebsite/app/SngineConfig.kt

Build the app

  1. To test the app, connect your phone or start an emulator and click the Run button

  2. To publish on Google Play, select from the menu Build > Generate Signed Bundle / APK..., choose Android App Bundle and create a new keystore (or choose your existing one)

  3. Select the release build variant. You will find the .aab file in app/release, ready to upload to the Google Play Console

⚠️ Keep your keystore file and its passwords in a safe place. You need the same keystore to publish every future update of your app

You can use these links as the href of any link on your website to control the app:

  • refresh:android → reload the current page
  • refresh:URL → go back to the home page
  • share:https://your-website.com/posts/1 → open the Android share sheet
  • rate:android → open your app on Google Play
  • exit:android → leave the app
  • tel:, mailto:, sms: and whatsapp: → open the matching app

Links like sngine://your-website.com/posts/1 open that page in the app. To use your own name instead of sngine, change DEEP_LINK_SCHEME in SngineConfig.kt and android:scheme in app/src/main/AndroidManifest.xml

Upgrade from an older version

If you already published the older Java version of the app on Google Play:

  1. Copy your settings from the old SngineConfig.java to the new SngineConfig.kt, and your app name and colors to sngine_config.xml

  2. Keep the same applicationId you used before, and set a versionCode higher than your last published version

  3. Rename the package to match your applicationId, see Rename the app package

  4. Sign the new version with the same keystore you used before, otherwise Google Play will not accept the update