Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Added android app. First version which only opens the eindhoven.nl website

Michael Rademaker7c3fc0e03c9e
diff --git a/console/android/src/main/java/org/openremote/android/MainActivity.java b/console/android/src/main/java/org/openremote/android/MainActivity.java
index 76ef10145..87570ecea 100644
--- a/console/android/src/main/java/org/openremote/android/MainActivity.java
+++ b/console/android/src/main/java/org/openremote/android/MainActivity.java
@@ -8,7 +8,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
-import android.database.Cursor;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
@@ -24,7 +23,6 @@ import android.view.View;
import android.webkit.CookieManager;
import android.webkit.DownloadListener;
import android.webkit.JavascriptInterface;
-import android.webkit.MimeTypeMap;
import android.webkit.SslErrorHandler;
import android.webkit.URLUtil;
import android.webkit.WebChromeClient;
@@ -216,6 +214,10 @@ public class MainActivity extends Activity {
webView.setWebViewClient(new WebViewClient() {
@Override
public void onReceivedHttpError(WebView view, WebResourceRequest request, WebResourceResponse errorResponse) {
+ //TODO should we ignore images?
+ if (request.getUrl().getLastPathSegment().endsWith("png") || request.getUrl().getLastPathSegment().endsWith("jpg"))
+ return;
+
if (request.getUrl().getLastPathSegment().equals("token") && request.getMethod().equals("POST")) {
webAppInterface.tokenService.clearToken();
reloadWebView(getCurrentFocus());
@@ -239,6 +241,10 @@ public class MainActivity extends Activity {
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
+ //TODO should we ignore images?
+ if (request.getUrl().getLastPathSegment().endsWith("png") || request.getUrl().getLastPathSegment().endsWith("jpg"))
+ return;
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// Remote debugging sessions from Chrome trigger "ERR_CACHE_MISS" that don't hurt, but we should not redirect the view
if (isRemoteDebuggingEnabled() && error.getErrorCode() == ERROR_UNKNOWN) {
diff --git a/console/android/src/main/res/values/strings.xml b/console/android/src/main/res/values/strings.xml
index 1b9f166c5..f9dc9d40e 100644
--- a/console/android/src/main/res/values/strings.xml
+++ b/console/android/src/main/res/values/strings.xml
@@ -1,5 +1,6 @@
<resources>
<string name="app_name">OpenRemote</string>
+ <string name="WEBSITE_URL">http://www.openremote.com/</string>
<string name="OR_BASE_SERVER">http://192.168.0.143:8080</string>
<string name="OR_CONSOLE_URL">/console/REALM/index.html</string>
<string name="ENABLE_REMOTE_DEBUGGING">false</string>