I'm trying to use the Poho MQTT library's JavaScript implementation (http://eclipse.org/paho/clients/js) in a NativeScript application.
I referenced the file with require("./lib/mqttws31"); and replaced all the window.timer's with require("timer") statements. I also added require("nativescript-websockets");to the top of the mqttws31.js file after installing the module from github.com/NathanaelA/nativescript-websockets. I also commented out the bit of code referring to localstorage.
I'm getting the application to run, but it doesn't seem to do anything.
you are better off using the webview with nativescript webview interface
for bidirectional control between webpage and nativescript it's more like an advanced ionic or should we say Cordova app
Related
I'm searching about how to expose some functionalities from my android app to a webpage using content provider.
My app stores digital certificates in AndroidKeyStore, i'd like to list this certificates on a webpage using js.
You can do a native app, in java and c++ or an html app with cordova or similar. Content provider belong to native app world. If you need to work with them, i suggest you to build an native app (in java) and do user interface natively.
The best way to do it is using Android WebView and exposing some functions to javascript.
https://stackoverflow.com/a/10389678/2004555
I'm developing an universal application using Cordova.
I want to add some features, for example authentication via Touch ID (fingerprint auth). In order to do this it's requested not to use a framework/library from Github/Internet so I want to do it in native code (Objective-C for iOS, Java for Android etc).
My problem is: since my app is a standard client application which uses HTML, Javascript (AngularJs) and CSS, how can I invoke some native code within the app life cycle? For example, if I'm inside a specific page (HTML) of my application, can I call an Objective-C method which implements the fingerprint authentication?
Any help is appreciated!
I am working on webRTC iOS integration. Our Web team integrated the webrtc using RTCMultiConnection library (https://cdn.webrtc-experiment.com:443/rmc3.min.js) and created the Web Application. They are setting the socket url (server url) and configuring the library objects and creating the session using the library.
Is there any equivalent library for making the connection directly from client? Or is it possible to access the .js file from swift?
Please check the RTCMultiConnection-API:
https://github.com/muaz-khan/RTCMultiConnection/blob/master/docs/ios-android.md
Above doc explains how to create a cordova-based iOS/Android application.
Everything from RTCMultiConnection-v3 is supported in cordova-apps except "Screen-Capturing". You can NOT capture your screen from any iOS/Android app.
The ONLY_Disadvantage of Cordova_based_apps is "It adds 20MB unwanted Size in the compiled iOS/Android app" .... i.e. your APK file may have 20MB minimum size.
Here is an example APK file (android-application using RTCMultiConnection v3):
https://play.google.com/store/apps/details?id=com.webrtc.experiment
I'm using IBM worklight 6.1 to build an hybrid app.
There's any api like following scenario;
- a certain function that need to run on native code and send the result to JavaScript code.
in Worklight 6.2, we can use "WL.getInstance().sendActionToJS("param", data);" at .java file and WL.App.addActionReceiver("param", actionReceiver); at .js file.
Can anyone advise me for workaround at Worklight 6.1?
Yes, you can create a Cordova plug-in that will "bridge" between the JS layer and the native layer. See these tutorials for Worklight 6.1, and in particular the "Android - Adding native functionality to hybrid application with Apache Cordova plugin" tutorial and its accompanying sample application.
The sample application sends data from the JS layer to the native layer, combines data from both and returns it to JS layer, so in your case you could just return data...
You can also see it better illustrated in the following for v7.1. You cannot use the sample app in 6.1 (as it is meant for 7.1), but the JavaScript is the same: https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-1/foundation/adding-native-functionality/android-adding-native-functionality-hybrid-application-apache-cordova-plugin/
The steps would be:
Execute a Cordova plug-in: cordova.exec(pluginSuccess, pluginFailure, "mypluginname", "myNativeClass name", []);
Have the class process what is needed
Return data to pluginSuccess as described in the tutorial code
This might be really a basic issue. I am kind of confused. I don't understand one thing. Phonegap app is pure html5 and javascript. But for this plugin (https://github.com/davejohnson/phonegap-plugin-facebook-connect/tree/master/example/HackBook) to work we need separate java code for android and xcode for ios.
I got the java version of the android tutorial working with the simulator but when I just copy the assets folder to build a pure phonegap app. it does not work.
Then it beats the purpose if i still have to maintain 2 code lines.
Does just the html and JavaScript code in this plugin is not supported by phonegap app without java or xcode.
Here is my phone gap app. you can download it. https://build.phonegap.com/apps/211586/share
My code in the git repositiry is here
https://bitbucket.org/sunmeet/phonegab2.0_fbapi
PhoneGap Build service only Supports ChildBrowser , Barcode Scanner, Google Analytics recently.
if you try to use any external plugin which needs assets other than HTML / CSS / JS, you can't use them with PhoneGap Build Service. But, PhoneGap Team are trying to push out different plugins like Facebook Connect in Future Releases.
So, here they gave two Options to Deveopers.
Use Child Browser and Do Process Facebook OAuth Authentication.
Build Locally.
Andriod developement environment is "Eclipse" IOS
developement environment is "XCode"(OS: MacOS)
I Suggest you to work with first option and once plugin is our from build service its really easy to integrate anytime.