Does NativeScript work with any real-time .js frameworks? - nativescript

I'm looking to develop a real-time NativeScript app. However, I haven't been able to identify a real-time framework that will work with NativeScript.
SignalR's javascript client has a dependency on jQuery, so that's out.
socket.io doesn't seem to be an option based on the answer to this post:
NativeScript and socket.io
Is there any known solution to this short of rolling my own?

There's a WebSocket module for NativeScript which uses the native WebSocket implementation on both platforms. It can be found here https://www.npmjs.com/package/nativescript-websockets

Have you checked out NativeScript's Firebase plugin? It works quite well: https://www.nativescript.org/blog/ignite-your-app-development-with-nativescript-and-firebase

Related

Embedded NativeScript on a native iOS/Android app

I have to develop an app for iOS and Android and it has to be able to run embedded in existing apps. I would usually do this with Cordova since it takes care of the multiple platforms and it is easy to embed in an existing app by creating a Cordova WebView.
Since this app is making heavy use of animations I have been playing around with NativeScript in order to avoid the bad performance of this kind of UI running on a WebView.
The problem is that it seems that embedding a NativeScript app in a native app is not straightforward at all. I have found this https://groups.google.com/forum/m/#!msg/nativescript/4kDFcX6gtxA/vdjruLLVBQAJ Is this still true? Any suggestions or ideas on how to accomplish this?
You can check this sample for iOS:
https://github.com/NativeScript/sample-ios-embedded
We will provide soon similar for Android
[UPDATE] Here is how to use {N} in existing Android app:
https://github.com/NativeScript/sample-android-runtime-embedded-POC

Xamarin Forms with Touch ID Fingerprint Authentication

I am developing a multi-platform app with Xamarin Forms. I need to support Touch ID/fingerprint authentication for both the iOS and Android platforms. How can I do this? I am new to Xamarin.
I've developed a Plugin for this. It's available on NuGet, too. Feel free, to drop an issue, if you miss something, or found an error.
https://github.com/smstuebe/xamarin-fingerprint
In general: There are alot of Plugins that abstract platform specific behavior. Before you write something on your own, just google for "<feature> xamarin plugin". It will safe much time.
You will need to use a Dependency Service for platform-specific behavior. Look to the linked guide as a starting point.

Xamarin Forms: How do I implement WebSockets?

We want to transfer data from a client to a server in realtime, so we have decided to go with WebSockets.
Using Xamarin.Forms it was surprisingly difficult to find a suitable WebSocket library.
The best match was "WebSocket4Net" because it is directly suggested on Xamarin's Homepage. However I was not able to install this library, because it only supports versions of .NET up to v4.0. (We are using v4.5)
Whenever I try to change the target framework of my PCLs from v4.5 to v4.0 I get loads of weird errors stating "Windows.Input library could not be found", "ObservableCollection could not be found" etc.
So we are currently using the library "WebSocket.Portable.Core", which although lacking some functionality worked out. However for some reason we can only receive one message. The event "MessageReceived" always is just called once.
Has anyone heard about such a problem with WebSockets? Maybe it is just time to use another library, but I just can't find one?
I also can't find any solution how to implement WebSockets natively for each platform.
WebSockets.PCL has a native implementation for each platform and it's well documented
https://github.com/NVentimiglia/WebSockets.Pcl

Difference between Xamarin and Telerik's native script

Xamarin
Write the model in C#
Write the views for each OS in their own native way
Xamarin promises that the new functionality in libraries is added the same day
Telerik Native script
Write in javascript and call native script's api that then calls the separate OS javascript apis?
Write the view in html5 and css which is re-usable for all OSs as they now all support html5 and css front ends?
Telerik simply states... and I paraphrase 'it does not have this problem'
If the above is so, how is Telerik any better than Xamarin as it states on its website:
"When using NativeScript the new additions to the native platform are
available immediately. This is not the case in neither Xamarin or
Appcelerator, where there are technical limitations and wrappers needs
to be created when new native platform features are added."
I am confused at how Telerik is being penned as being better than Xamarin when Xamarin comes with strong type language without using TypeScript's slightly loose thing going on. And also that Xamarin does in fact sit in exactly the same boat as Xamarin apart form the view part... which is actually supposed to be a benefit?
Question:
- What's the difference between them apart from the two I have denoted?
- Why would Telerik claim such a thing?
[Disclaimer: I work for Telerik.]
Telerik NativeScript and Xamarin are solving similar problems in different ways. Both frameworks are focused on enabling developers to create cross-platform mobile applications with native UI and shared, common code across all platforms.
For NativeScript, we're focused heavily on the web developer skill set. We want anyone that is comfortable today writing HTML/CSS/JavaScript to feel instantly at home creating native apps using NativeScript.
The only thing that is a little different is that views are defined in an XML-based markup. This markup is parsed by NativeScript and rendered as native UI on all target platforms. (NativeScript modules encapsulate the platform-specific renderings.)
The capability you highlight is also something unique to NativeScript's approach for exposing underlying native platform APIs. NativeScript effectively uses (build-time) reflection to make ANY native API available to the JavaScript proxy. That includes 3rd party native libraries. You do not depend on Telerik (or the open source community) to update NativeScript to take advantage of these new APIs. You simply execute a command and auto-discover the new APIs.
Of course, we don't expect a lot of people to write against the raw native APIs using JavaScript, so that's where modules again help encapsulate the different native APIs and expose a single, clean, cross-platform JavaScript API. Anyone can create NativeScript modules.
There's a great post that explains how all of this works in much more detail on the Telerik Developer Network (TDN):
http://developer.telerik.com/featured/nativescript-works/
NativeScript's public beta will be available this week, and v1 will ship in May.
UPDATE [Feb 2016]
Since this was originally posted, NativeScript has shipped and is now in v1.6. It is also now integrating heavily with Angular 2. You can track the project progress on GitHub: https://github.com/NativeScript/NativeScript
UPDATE [June 2016]
There are now performance metrics comparing NativeScript and Xamarin. Please find them here:
https://github.com/NativeScript/sample-iOS-Profiling/tree/performance-tests
Telerik is a UI component and it has some beautiful control for designing in xamarin forms,MVC. Net and etc, but xamarin forms is a technology that helps deveopers to make mobile application using c#

What's Kik's level of WebSocket support on android devices that don't natively support them?

I've got a project using WebSockets that I want to possibly integrate with Kik. Is it going to be work on the Android platforms that don't natively support WebSockets? I know there are many posts here on SO with native android code to inject WebSockets into the webview. Have any of these been implemented? What is the suggested workaround if not?
Thanks!
WebSockets are natively supported on Android 4.4+. On older operating systems it is normally recommended to use XHR polling or other mechanisms.
I would suggest using Socket.io as it is a very mature library for this kind of technology with backward compatibility modes going back to pretty old browsers.
http://socket.io

Resources