i started working on android using phonegap. In iphone we use phoneGap.exec(classname.methodname, arguments) to connect to the native application from html. But how can you do it in Android? Can anyone help me in this please?
Thanks in advance,
Bharath gangupalli
Sounds like you're trying to connect to a native plugin. The technique is generally the same on Android, include the native code and then call out using the Phonegap.Exec() wrapper. If you're looking for a sample to start from try out the BarcodeScanner plugin, which includes native code and the JS wrapper to call out to it:
https://github.com/purplecabbage/phonegap-plugins/tree/master/Android/BarcodeScanner
Related
I'm trying to start a js component from android (not the main index file). I implemented a native module to reach Android from js but I couldn't do it for android to js. I've been searching for weeks but I couldn't find a solution. Is there anyone who knows if it's possible? I'm not so good at Android or react native, maybe that's why I couldn't understand if there is a solution in the docs.
Is there any (easy) way to link to native libraries, specifically OpenCV, using Telerik NativeScript? I suppose since it outputs source I could go into the Android and ios projects after compiling and implement all of the openCV code seperately, but that sort of defeats the purpose of using NativeScript, imo.
Is there any cross-platform way to interface with native code?
Thanks!
If OpenCV supports Android and iOS then you would need to create the communication to the native code to use it. That's how all of NativeScript works, it allows you to use Javascript (TypeScript) and communicate directly to native code without any wrappers.
So essentially everything in NativeScript has a wrapper to the underlying native code/components, that's the difference and the power behind products like NativeScript and React Native as opposed to Cordova based apps (PhoneGap, Ionic, etc.).
Since your question isn't a code specific question, it's kind of hard to answer and there might be a slight misinterpretation on my part of what you are really trying to understand. Hope this helps in some way. :)
here is iOS pack for openCV:
https://sourceforge.net/projects/opencvlibrary/files/opencv-ios/3.4.3/opencv-3.4.3-ios-framework.zip/download
and for android you can download it from here:
https://sourceforge.net/projects/opencvlibrary/files/opencv-android/3.4.3/opencv-3.4.3-android-sdk.zip/download
EDITED:
a solution is to write a plugin and reference the OpenCV framework using cocoapods
here is the link of how to write a plugin in native script by cocoapods
NativeScriptUsingCocoapods
I have a question about Android Studio: Does AS supports AngularJS code while designing XML files, e.g. for small animations or effects?
SUMMARY : NO
There is no way you can write Angular JS code while developing Android Native app. You can use Angular in a WebView (using js/html so), that's all.
AngularJS is a completely different technology than what is used in native Android apps. Native Android apps use Java and/or C for their code, which is compiled when you build the app. AngularJS is a framework for web development, running specifically on Javascript (a completely different technology than Java).
You can build apps without using native Java or C code, but there are tradeoffs. As noted in other answers, you can display webpage views as apps (using technologies like Cordova]), or use frameworks like React Native to write code in Javascript that then gets compiled to a native app. You could use AngluarJS in the webview instance, since it just displays a webpage, however not in something like React Native. I highly encourage you to check both of these (and other options) out, but keep in mind that they have their own limitations and tradeoffs – no one way is the "right" way to build an app.
In summary: No, AngularJS is a web technology, not a native app technology.
new answer = Yes... Sort of, you can do it with:
https://www.nativescript.org/
It translates javascript, angular and typescript code into native components!
Apparantly it's possible to use nativescript in Android Studio with:
https://docs.nativescript.org/runtimes/android/getting-started/hello-world
Android Does not support AngularJs. but still if you want to use you can use it in webview.
iOS ActionSheet plugin for phonegap:
https://github.com/phonegap/phonegap-plugins/tree/master/iOS/ActionSheet
Is there a Android equivalent? (preferrably that uses the same js interface)
This seems to be a plain Javascript interface that will run on Android too. Maybe check out this?
https://github.com/mgcrea/cordova-actionsheet#javascript-interface-iosandroid
This is very good and for Android, iOS and WP
https://github.com/EddyVerbruggen/cordova-plugin-actionsheet
I am writing application using PhoneGap on Android. I need to call some PhoneGap methods from native Java code. Anyone knows how to do that??
If you write your native code as an Android plugin (see an example here: https://github.com/phonegap/phonegap-plugins/tree/master/Android/BarcodeScanner) then you have access to all of the PhoneGap Java classes and can call them as you like.