GithubHelp home page GithubHelp logo

evothings / evothings-viewer Goto Github PK

View Code? Open in Web Editor NEW
14.0 3.0 15.0 718 KB

Evothings Viewer

License: Apache License 2.0

Shell 0.70% Java 14.48% Objective-C 13.47% JavaScript 56.67% HTML 2.40% CSS 12.27%

evothings-viewer's Introduction

Evothings Viewer

Introduction

Evothings Viewer is the companion app for Evothings Studio 2.x. It is used to connect to Evothings Workbench and run apps.

The app consists of a Cordova WebView, a number of useful plugins, and a UI to connect to Evothings Studio Workbench. You can edit the list of plugins in file package.json and build your custom version of the Viewer.

Notice when building from source

Currently, Cordova version 8.0.0 is used to build the Viewer, older may or may not work.

Branch master may contain updates not yet compatible with current production servers. If building from master branch does not work, of if you want to play safe, use the latest release. Building from master branch should work fine in most cases and gives you the latest updates.

Building the App

To build the app, you need Apache Cordova installed. Here are the build steps:

Download and unpack the source for the latest release:

https://github.com/evothings/evothings-viewer/releases

Alternatively, clone the repository using git (gives you current master branch):

git clone [email protected]:evothings/evothings-viewer.git

Go to the source directory:

cd evothings-viewer

Add your platforms:

cordova platform add android
cordova platform add ios

Then build using Cordova:

cordova build android
cordova build ios

Or for release:

cordova build --release android

Plugins will be added automatically first time you add a platform.

You can edit package.json to configure which plugins you wish to be included. New plugins are added on next build.

To clean up the project run (removes folders 'platforms' and 'plugins', you can also delete these folders manually):

node scripts/clean.js

Build system overview

The build uses plain Cordova features (hooks and plugins) and is designed to be easy to use for people who know Cordova.

There are build hooks in the 'scripts' directory, these are invoked to copy/modify files during the build process.

To make native application settings on Android and iOS a plugin in folder config/config-plugin is used. This plugin has no source files, it is there only to make project settings (a plugin can modify AndroidManifest.xml entries and info.plist entries, which cannot be done using config.xml).

Icons and launch screens are specified in config.xml.

Source code files in the 'config' folder are copied to the target platform directory during build, for both Android and iOS. These source files contains special modifications for the Evothings app.

To clean the project use the command:

node scripts/clean.js

This removes projects and plugins. Add platforms using 'cordova platform add ...'. Plugins are added when adding the first platform.

Setting a custom package name

Change the package name in config.xml on this line:

<widget id="com.evothings.evothingsviewer"

You can also change the app name, modify this line in config.xml:

<name>Viewer</name>

Known build issues on iOS

Settings for iPhone/iPad interface orientations

Due to some glitch in the Cordova build process and/or Xcode, you should set interface orientations manually in Xcode, go to the tab 'General' and make desired settings under 'iPhone' and 'Device Orientation'.

evothings-viewer's People

Contributors

fredrikeldh avatar gokr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

evothings-viewer's Issues

Improve Viewer roubustness

Problem:

If the Viewer fails loading HTML/JS for some reason (server error/timeout or malformed HTML/JS) the Viewer stops working. Current workaround is to restart the app and connect again.

Task:

Implement error handling (needs to be done natively) on iOS/Android that traps page load errors and displays an error page with available error info and options to reconnect.

ble doesn't work on recompile.

I tried the redbearlab serial example with the application available via the google play store and it works great. I thien tried to make my own cordova app of it but cannot seem to get ble working. After trying many things I tried to just build the viewer app locally and then see if that works. It does not. This is on an android nexus 6. I am not sure what other details I could provide but some guidance would be helpful.

iBeacon plugin crashes app on reload

Problem:

When reloading/rerunning the iBeacon Scan example app on an Android device, the app stops.

The following exception is shown in logcat:

E/AndroidRuntime(14044): FATAL EXCEPTION: main
E/AndroidRuntime(14044): Process: com.evothings.evothingsviewer, PID: 14044
E/AndroidRuntime(14044): java.lang.NullPointerException
E/AndroidRuntime(14044):    at com.radiusnetworks.ibeacon.Region.equals(Region.java:151)
E/AndroidRuntime(14044):    at java.util.HashMap.containsKey(HashMap.java:340)
E/AndroidRuntime(14044):    at com.radiusnetworks.ibeacon.service.IBeaconService.startRangingBeaconsInRegion(IBeaconService.java:252)
E/AndroidRuntime(14044):    at com.radiusnetworks.ibeacon.service.IBeaconService$IncomingHandler.handleMessage(IBeaconService.java:145)
E/AndroidRuntime(14044):    at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(14044):    at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime(14044):    at android.app.ActivityThread.main(ActivityThread.java:5118)
E/AndroidRuntime(14044):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(14044):    at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime(14044):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
E/AndroidRuntime(14044):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
E/AndroidRuntime(14044):    at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager(  959):   Force finishing activity com.evothings.evothingsviewer/.MainActivity
V/ActivityManager(  959): Moving to PAUSING: ActivityRecord{423fd170 u0 com.evothings.evothingsviewer/.MainActivity t1154 f}

Fix build process for iOS

Build of Viewer for iOS has issues with Info.plist properties not being included properly. Building with cordova build ios deletes these properties. They are added with the config plugin currently. Look into how to fix this, possibly resorting to copying/overwriting Info.plist.

Also check if the pathes for Cordova 6 in the config/native/ios folder are needed.

When doing this also have a look at specifying plugins in config.xml, that is the new Cordova way.

Viewer version 1.5.0

Planned for this release:

  • Updated BLE plugins on Android and iOS

Moved to version 2.0:

  • Improved UI using Material Design Lite
  • Bookmarks for recently loaded URLs

Cannot build when using Cordova v7 and up

Cannot do a Viewer custom build when using Cordova v7 and up. The directory structures are different. Additionally, the Android SDK, gradle toolkit is missing. Probably ok if using older versions.

Error: ENOENT, no such file or directory '<path>/plugins/ios.json' when trying to add a platform

I'm trying to build my own version of the viewer app with custom plugins. I downloaded the latest release and tried to add android/ios as platforms, but I receive the error mentioned on the title. This is the full error log:

qbook:EvothingsViewer qpwr [master]$ cordova platform add ios
Creating ios project...
Error: ENOENT, no such file or directory '/Users/qpwr/CordovaApps/EvothingsViewer/plugins/ios.json'
    at Object.fs.openSync (fs.js:438:18)
    at Object.fs.writeFileSync (fs.js:977:15)
    at Object.save_platform_json (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/config-changes.js:476:8)
    at PlatformMunger_process [as process] (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/config-changes.js:401:13)
    at Object.exports.process (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/config-changes.js:80:12)
    at Object.handlePrepare (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/prepare.js:72:20)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/prepare.js:102:25
    at Array.map (native)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/prepare.js:66:40
    at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:798:54)

evothings-viewer build fails

I follow the instruction and the following build error occurs. Please help
The following build commands failed:
CompileC build/Viewer.build/Debug-iphonesimulator/Viewer.build/Objects-normal/i386/MainViewController.o Viewer/Classes/MainViewController.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
ERROR building one of the platforms: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/feizheng/Desktop/evothings-viewer-master/platforms/ios/cordova/build-debug.xcconfig,-project,Viewer.xcodeproj,ARCHS=i386,-target,Viewer,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/feizheng/Desktop/evothings-viewer-master/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/feizheng/Desktop/evothings-viewer-master/platforms/ios/build/sharedpch
You may not have the required environment or OS to build this project
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/feizheng/Desktop/evothings-viewer-master/platforms/ios/cordova/build-debug.xcconfig,-project,Viewer.xcodeproj,ARCHS=i386,-target,Viewer,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/feizheng/Desktop/evothings-viewer-master/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/feizheng/Desktop/evothings-viewer-master/platforms/ios/build/sharedpch

If network fails when loading projects, all clients gets 'Gateway timeout 504'

That means that nginx is up but fails to connect to the proxy-server, which is VERY STRANGE.
The logs did not show that the proxy restarted (with forever) or indeed had any problems at all.

Would it be possible to add something to the platform-specific native part of the client(s) to detect and reload borked page loads, perhaps?

Add plugin for web server to allow running App offline

Hi, we could develop an EVOThings app for an electric car very quickly - EVOThings is a great work and we really love the EVOThings eco-system :-)

On mobile apps, there is not alwas an internet connection. So maybe it would make sense to add a Cordova web server plugin to the viewer? This would allow apps to upload files to the local web server, and the user can then use localhost URLs to run EVOThings apps :-) What do you think?

Regards,
Alexander
image

Android build fail

Hi everyone

I already build my apps multiple time. It's the first time i have this issue.
Debug uncheck

Starting a new Gradle Daemon for this build (subsequent builds will be faster).
stderr: 
FAILURE: Build failed with an exception.

* What went wrong:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/2.13/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
OpenJDK Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (safepoint.cpp:310), pid=1977, tid=1715682112
#  guarantee(PageArmed == 0) failed: invariant
#
# JRE version: OpenJDK Runtime Environment (8.0_91-b14) (build 1.8.0_91-8u91-b14-3ubuntu1~16.04.1-b14)
# Java VM: OpenJDK Server VM (25.91-b14 mixed mode linux-x86 )
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/vagrant/.gradle/daemon/2.13/hs_err_pid1977.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
stderr: Error: /vagrant/result/323rpi/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/2.13/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
OpenJDK Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (safepoint.cpp:310), pid=1977, tid=1715682112
#  guarantee(PageArmed == 0) failed: invariant
#
# JRE version: OpenJDK Runtime Environment (8.0_91-b14) (build 1.8.0_91-8u91-b14-3ubuntu1~16.04.1-b14)
# Java VM: OpenJDK Server VM (25.91-b14 mixed mode linux-x86 )
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/vagrant/.gradle/daemon/2.13/hs_err_pid1977.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
stderr: build.rb:237:in `sh': Command failed (RuntimeError)
	from build.rb:160:in `runCordova'
	from build.rb:258:in `
'

Add hook to let an app 'burrow in' the viewer

The idea is to let developers use the viewer as a good-enough custom app to distribute to others. So that if an app calls 'burrow()' for example, it will be saved/stored somewhere and will be opened directly when the viewer is opened, so it looks a bit like it is a stand-alone cordova app built in the usual way.

Perhaps adding some kind of triple-tap menu or swipe motion that let the user bypass the app and get back to the regular viewer mode.

This could use/reuse the work done on the android client cache branch.

Plugin config/config-plugin needs a valid package.json

Thank you for sharing your code. I'm trying to setting it up but on installing cordova iOS platform for viewer 1.5, I have two issues related to these sections of "package.json" file of the project:

{
 "id": "com.synconset.cordovaHTTP",
 "location": "https://github.com/evothings/cordova-HTTP#v0.2.2"
 },
{
 "id": "com.evothings.evothingsviewer.config-plugin",
"location": "config/config-plugin" 
}

In both cases Cordova says that related "package.json" file is missing.

In details, running the command "cordova platform add iOS" I receive at first this notification :

_Error: Command failed: cordova plugin add https://github.com/evothings/cordova-HTTP#v0.2.2
Error: Failed to fetch plugin https://github.com/evothings/cordova-HTTP#v0.2.2 via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! code ENOPACKAGEJSON
npm ERR! package.json Non-registry package missing package.json: git+https://github.com/evothings/cordova-HTTP.git#v0.2.2.
npm ERR! package.json npm can't find a package.json file in your current director_

This issue seems to be fixed by replacing the reference to 'com.synconset.cordovaHTTP' package with this one. Is it ok?

    {
      "id": "cordova-plugin-http",
      "location": "https://github.com/wymsee/cordova-HTTP.git"
    },

After this change, if I remove the "platform" directory and apply again the command "cordova platform add iOS" I received this second message:

Error: Invalid Plugin! config/config-plugin needs a valid package.json
Error: Command failed: cordova plugin add config/config-plugin
Error: Invalid Plugin! config/config-plugin needs a valid package.json

Could you please help me to fix them?

I'm using cordova 7.1.0, node.js 8.1.0, npm 5.5.1 and XCode 9.0.1 on macOS 10.12.6.

Thanks a lot,
Luigi

build issue for android app

123
hi.
i m using evothing for building hexiwear android app.
the status of building android app is.....
running build script....
and nothing is happining...
i m upload the snap...
any solution for this plzzz

Android: Evothings Viewer craches

Reported on Evothings Gitter channel: https://gitter.im/evothings/evothings

https://gitter.im/evothings/evothings?at=582901e0e462097a30458f60

I am having a problem with my Evothings Viewer on an Android device. It 'crashes' periodically (can find no pattern to this yet) and I have tried uninstalling and reinstalling, forced stop, clearing caches and data, but nothing except resetting my device to factory settings seems to work. The viewer shows a blank screen and then shuts down. This has been happening with the app downloaded from Google Play, rebuilding from source or building a custom one.

https://gitter.im/evothings/evothings?at=582a4a2d65485ebc6796f34f

My app calls the ble plugin, camera, dialogs and cordova-http of the standard ones. My own viewer also includes file, file-transfer, cordova-httpd, social sharing and secure storage. The android version is 5.0.1. The app crashes at start up - it does not even present the "connect" page. I will work on getting the logcat and post.

the device is a Lenovo Tab3 7

From logcat:

E/StrictMode(21320): A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
E/StrictMode(21320): java.lang.Throwable: Explicit termination method 'close' not called
E/StrictMode(21320):     at dalvik.system.CloseGuard.open(CloseGuard.java:184)
E/StrictMode(21320):     at java.io.RandomAccessFile.<init>(RandomAccessFile.java:127)
E/StrictMode(21320):     at com.android.webview.chromium.WebViewChromiumFactoryProvider.startChromiumLocked(WebViewChromiumFactoryProvider.java:16107)
E/StrictMode(21320):     at com.android.webview.chromium.WebViewChromiumFactoryProvider.ensureChromiumStartedLocked(WebViewChromiumFactoryProvider.java:333)
E/StrictMode(21320):     at com.android.webview.chromium.WebViewChromiumFactoryProvider.startYourEngines(WebViewChromiumFactoryProvider.java:427)
E/StrictMode(21320):     at com.android.webview.chromium.WebViewChromium.init(WebViewChromium.java:162)
E/StrictMode(21320):     at android.webkit.WebView.<init>(WebView.java:580)
E/StrictMode(21320):     at android.webkit.WebView.<init>(WebView.java:515)
E/StrictMode(21320):     at android.webkit.WebView.<init>(WebView.java:498)
E/StrictMode(21320):     at android.webkit.WebView.<init>(WebView.java:485)
E/StrictMode(21320):     at org.apache.cordova.engine.SystemWebView.<init>(SystemWebView.java:47)
E/StrictMode(21320):     at org.apache.cordova.engine.SystemWebView.<init>(SystemWebView.java:43)
E/StrictMode(21320):     at org.apache.cordova.engine.SystemWebViewEngine.<init>(SystemWebViewEngine.java:75)
E/StrictMode(21320):     at com.evothings.evothingsviewer.MainActivity$EvothingsWebViewEngine.<init>(MainActivity.java:165)
E/StrictMode(21320):     at com.evothings.evothingsviewer.MainActivity.makeWebViewEngine(MainActivity.java:154)
E/StrictMode(21320):     at org.apache.cordova.CordovaActivity.makeWebView(CordovaActivity.java:192)
E/StrictMode(21320):     at org.apache.cordova.CordovaActivity.init(CordovaActivity.java:141)
E/StrictMode(21320):     at com.evothings.evothingsviewer.MainActivity.onCreate(MainActivity.java:71)
E/StrictMode(21320):     at android.app.Activity.performCreate(Activity.java:6041)
E/StrictMode(21320):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1111)
E/StrictMode(21320):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2437)
E/StrictMode(21320):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2564)
E/StrictMode(21320):     at android.app.ActivityThread.access$800(ActivityThread.java:170)
E/StrictMode(21320):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1441)
E/StrictMode(21320):     at android.os.Handler.dispatchMessage(Handler.java:111)
E/StrictMode(21320):     at android.os.Looper.loop(Looper.java:194)
E/StrictMode(21320):     at android.app.ActivityThread.main(ActivityThread.java:5576)
E/StrictMode(21320):     at java.lang.reflect.Method.invoke(Native Method)
E/StrictMode(21320):     at java.lang.reflect.Method.invoke(Method.java:372)
E/StrictMode(21320):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:955)
E/StrictMode(21320):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:750)
W/System.err(21320): StrictMode VmPolicy violation with POLICY_DEATH; shutting down.

Add protocol evo: and evos:

There have been request for shorter protocol names for the Viewer.

Currently "evothings:" is used, and HTTPS is not supported.

We can add "evo:" and "evos:" and map to HTTP and HTTPS. And keep "evothings:" as is (HTTP) for backwards compatibility.

Mac OS 10.7.5

hello guys,

i have 10.7.5 lion mac os and i would appreciate if the software run on it. It says 10.9 is the minimum.

thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.