100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Consoles: Fixed issue with app not opening on Android from push notification (#855)
Michael Rademaker2fc177308c7e
diff --git a/console/android/ORLib/src/main/java/io/openremote/orlib/service/ORMessagingActionService.kt b/console/android/ORLib/src/main/java/io/openremote/orlib/service/ORMessagingActionService.ktindex 8b03ab94a..e5d778e56 100644--- a/console/android/ORLib/src/main/java/io/openremote/orlib/service/ORMessagingActionService.kt+++ b/console/android/ORLib/src/main/java/io/openremote/orlib/service/ORMessagingActionService.kt@@ -1,12 +1,13 @@package io.openremote.orlib.serviceimport android.app.IntentService-import android.content.Intentimport android.app.NotificationManager+import android.content.Intent+import android.content.pm.PackageManagerimport android.net.Uri-import io.openremote.orlib.Rimport android.text.TextUtilsimport io.openremote.orlib.ORConstants+import io.openremote.orlib.Rimport io.openremote.orlib.ui.OrMainActivityclass ORMessagingActionService : IntentService("org.openremote.android.ORMessagingActionService") {@@ -55,13 +56,14 @@ class ORMessagingActionService : IntentService("org.openremote.android.ORMessaginotificationResource!!.executeRequest(httpMethod!!, appUrl, data)}else -> {- val activityIntent = Intent(applicationContext, OrMainActivity::class.java)- activityIntent.addFlags(+ val pm: PackageManager = packageManager+ val launchIntent: Intent = pm.getLaunchIntentForPackage(applicationContext.packageName) ?: Intent(applicationContext, OrMainActivity::class.java)+ launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK orIntent.FLAG_ACTIVITY_SINGLE_TOP)- activityIntent.putExtra("appUrl", appUrl)- startActivity(activityIntent)+ launchIntent.putExtra("appUrl", appUrl)+ startActivity(launchIntent)}}}diff --git a/console/android/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt b/console/android/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.ktindex de8c52c3e..07dfbb5dd 100644--- a/console/android/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt+++ b/console/android/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt@@ -430,6 +430,13 @@ open class OrMainActivity : Activity() {return true}+ override fun onGeolocationPermissionsShowPrompt(+ origin: String?,+ callback: GeolocationPermissions.Callback?+ ) {+ callback?.invoke(origin, true, false)+ }+override fun onProgressChanged(view: WebView, progress: Int) {progressBar!!.progress = progress}@@ -446,9 +453,9 @@ open class OrMainActivity : Activity() {transport.webView = newWebViewresultMsg.sendToTarget()newWebView.webViewClient = object : WebViewClient() {- override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {+ override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean {val browserIntent = Intent(Intent.ACTION_VIEW)- browserIntent.data = Uri.parse(url)+ browserIntent.data = request.urlstartActivity(browserIntent)return true}