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.
https://) to build the app
android folder:
app/src/main/java/sngine/app/webview/SngineConfig.kt→ website URL, OneSignal and featuresapp/src/main/res/values/sngine_config.xml→ app name and colorsapp/src/main/res/drawable-nodpi/splash_logo_image.png→ splash screen logoapp/build.gradle.kts→ application ID, namespace and version
sngine.app.webview to your own, see Rename the app package.
Open the app in Android Studio
-
Download and install the latest version of Android Studio
-
From the menu select File > Open and choose the
androidfolder (the one that containssettings.gradle.kts) -
Wait until Android Studio finishes the Gradle sync. The first sync downloads the required tools and can take a few minutes
Connect your website
-
Open
app/src/main/java/sngine/app/webview/SngineConfig.ktand changeSITE_URLto your website URL (keep the/at the end)const val SITE_URL = "https://your-website.com/"
-
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"
-
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
truetofalseto turn a feature off
Change the app name and colors
-
Open
app/src/main/res/values/sngine_config.xmland 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 iconbrand_primary→ the loading bar, pull-to-refresh spinner and buttonssystem_bar_background→ the color behind the status bar and navigation barlight_system_bars→truefor dark status bar icons on a light color,falsefor a dark colorpage_background→ the color behind your website while it loads
-
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.
-
Replace
app/src/main/res/drawable-nodpi/splash_logo_image.pngwith your logo. Use a square PNG of 512×512 pixels or larger and keep the same file name -
Change the background color with
splash_backgroundinsngine_config.xml, and invalues-night/sngine_config.xmlfor dark mode -
Android shows the logo inside a circle. If your logo looks too big or too small, change
android:insetinapp/src/main/res/drawable/splash_logo.xml(a lower value makes the logo bigger)android:inset="24%"
Change the app icon
-
In Android Studio, right-click the
appfolder and select New > Image Asset -
Keep Launcher Icons (Adaptive and Legacy) and the name
ic_launcher, choose your icon image, then click Next > Finish to replace the old icon -
For the push notifications icon, open Image Asset again, select Notification Icons and use the name
ic_stat_onesignal_default
Change the application ID
-
Every app on Google Play needs its own unique application ID. Open
app/build.gradle.ktsand changeapplicationIdto your own, for examplecom.yourwebsite.appapplicationId = "com.yourwebsite.app"
-
In the same file,
versionCodeandversionNameare your app version. IncreaseversionCodeby 1 every time you upload a new version to Google PlayversionCode = 1 versionName = "1.0"
Rename the app package
sngine.app.webview. Rename it to match your own applicationId, otherwise Google Play can flag your app
-
In the Android Studio Project panel, click the ⋮ menu, select Appearance and uncheck Compact Middle Packages. Now
sngine,appandwebviewshow as separate folders insideapp/src/main/java -
Right-click the
snginefolder and select Refactor > Rename. If Android Studio asks, choose Rename package, type the first part of your application ID (for examplecom), click Refactor, then Do Refactor -
Do the same for
appandwebviewwith the other parts of your application ID. Forcom.yourwebsite.app, renameapptoyourwebsiteandwebviewtoapp -
Open
app/build.gradle.ktsand changenamespaceto the same value as yourapplicationIdnamespace = "com.yourwebsite.app"
-
From the menu select Edit > Find > Replace in Files, search for
sngine.app.webviewand replace what is left with your application ID (like thebaselineprofilemodule) -
Select File > Sync Project with Gradle Files, then Build > Rebuild Project and make sure there are no errors
app/src/main/java/com/yourwebsite/app/SngineConfig.kt
Build the app
-
To test the app, connect your phone or start an emulator and click the Run button
-
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)
-
Select the
releasebuild variant. You will find the.aabfile inapp/release, ready to upload to the Google Play Console
Special links for your website
You can use these links as the href of any link on your website to control the app:
refresh:android→ reload the current pagerefresh:URL→ go back to the home pageshare:https://your-website.com/posts/1→ open the Android share sheetrate:android→ open your app on Google Playexit:android→ leave the apptel:,mailto:,sms:andwhatsapp:→ 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:
-
Copy your settings from the old
SngineConfig.javato the newSngineConfig.kt, and your app name and colors tosngine_config.xml -
Keep the same
applicationIdyou used before, and set aversionCodehigher than your last published version -
Rename the package to match your
applicationId, see Rename the app package -
Sign the new version with the same keystore you used before, otherwise Google Play will not accept the update