问题
I am looking for guidance on a mobile app project I am working on. Most of the app can be delivered using angular.js (and perhaps ionic) javascript technology. For one component though I need to integrate with an API, specifically google project tango API. This API is only available in java, C or unity (https://get.google.com/tango/developers/). Im aware I am a little out of my depth, but is it possible to use both technologies in the same mobile app, and if so can you provide some guidance on how to setup the dev environment?
Thanks in advance for any help.
回答1:
There is nothing special about Ionic that prevents Android's excellent support of JavaScript ↔ Java binding:
https://developer.android.com/guide/webapps/webview.html#UsingJavaScript
How to call javascript from Android?
In the case of Ionic and Tango, you can interact with the Java Tango API from within Ionic controllers.
回答2:
Should your application be crossplatform? If it is mobile only and you want to write it in JS, you may try NativeScript. As far as I know NativeScript have access to C libraries https://github.com/NativeScript/sample-native-module and at the same time it has version for AngularJS (only second version). It also uses native widgets so it should be faster than Ionic. But such application won't work in browser - at least view layer will be different for mobile and web version.
来源:https://stackoverflow.com/questions/38754258/mobile-app-using-both-project-tango-and-ionic-and-or-angular