Sharing Realm instance between React Native and Android - realm

I'm working on a React Native project that uses Realm for React Native.
It works without problems but now, I am faced with a problem of writing Android Service that would use the same Realm instance. Is it possible and how would I do that?

I think you can communicate from Java to React Native through Native Modules and do your Realm-related code in Javascript as you normally would.
Otherwise, Realm for Android's multi-process support for non-encrypted Realms will arrive in Realm-Java 2.0.0 (and that part is actually in with the snapshot), which will most definitely support this use-case; when the core version of Realm-React-Native (currently 1.5.0) and Realm-Java (previously 1.5.1, now 2.0.0-rc4) will be the same (2.0.0).
So not yet, but actually quite soon. I'd estimate a month or two at most from the time of writing.
EDIT: According to https://github.com/realm/realm-js/issues/984#issuecomment-297716769 the only way to get the same core and sync and object-store versions reliably for your app is if you build Realm-JS and Realm-Java from scratch and use them in your application like that.

Related

Is there any limitation using Hermes engine in React Native?

I notice that there are many advantages of using Hermes engine in React Native.
I think the biggest difference from the existing JavaScript engine(JavascriptCore) is the compilation method(AOT compile).
but I leave a question because only the advantages are explained, and there is no mention of the disadvantages. Is there any disadvantages or limits in Hermes engine used in React Native?
I heard that the disadvantage of the AOT compilation is control AOT version is hard. Is hermes engine overcome this advantage by limiting the supported version??
If there is no limits or disadvantages except for version dependency, Why React Native does not use AOT compile at first?
Hermes on iOS is community supported, and has lagged behind in first class support to this point. You may encounter issues if you have 'use_frameworks' in your Podfile. Intl support has to be polyfilled and can be a little tricky to set up correctly. There are probably other newer APIs which are missing. You still should choose Hermes for a new project, and if able I would definitely switch to it for any project that can support it easily. if you have an existing and complicated project with many dependencies you will be adding more complexity to your builds so just be aware of that.
we want to highlight some of the most exciting progress we've made over the past two years to push Hermes towards being the best JavaScript engine for React Native. Looking forward, we are confident that with these improvements and more to come, we can make Hermes the default JavaScript engine for React Native across all platforms. Read More

Possible to cross-platform develop Watch/Wearable applications?

since I am new in the world of developing apps for watches, and the fact that it exists for smartphones the following frameworks:
Xamarin
PhoneGap
appcelerator
kony
Cordova
...
I wonder if there exists for watches apps similar frameworks? So that you code once but run overall.
Thanks
Edit 1:
At this day (12.05.2015) regarding to the answer of a nativescript maintainer here. I will go with nativescript to start writing app for wearables.
Cordova/PhoneGap apps don't work directly on the wearable devices/watches. Cordova/PhoneGap is basically a javascript API which can run on WebKit/WebView on all the mobile OS's. But the Android Watch and Apple Watch doesn't support WebKit and so the apps developed with Cordova don't work directly on Watch devices. But if want to extend some of the features from the existing Cordova app to the wearable app, you need to create the extension app in native language and the extension should be able to communicate with the paired app on the mobile device. The extension on the Watch will have only UI and the bussiness logic etc runs on the Cordova app on the mobile. It is possible to establish communication between these apps which will drive the display on the watch devices.
I am not sure about the other frameworks you listed above on how much they support wearable devices.
As #kiran and #NRimer have mentioned, these cross platform frameworks are relying on the WebKit/WebView which is the almost universal layer supported on every mobile device. They dont run directly on the device, but device runs WebKit platform that runs these cross platform apps. So comparing the capabilities of the native app with cross platform app, native app is bigger, because it can have a hands on device hardware related features. The thing particular to the smart watches is that they mostly rely on other smart phone device, and it uses it's communication protocols, that are hardware specific, and WebKit doesnt have its hands on it.
It depends on what you're looking to do with the framework. Watch apps build off data provided by their containing app. For example if you want to provide custom notifications on the watch, the app (or server for remote notifications) constructs them. When your watch app needs information, it makes a request to the containing app. Lets say you have a group of apps that you want to provide the same notifications or functions on each of their watch apps, you could make a framework that handles these functions for the containing app. As for the watch portion, think of it as more of a display of information provided. Unfortunately i dont think there's a way to generate frameworks for watch apps yet. If you're looking to have a lot of code within the watch app this might be more difficult but for simple display of information you should be alright.

Linking external libraries in PPAPI plugin

First of all am new to PPAPI plugin development. Earlier i have been using NPAPI plugin to perform certain functionality which in turn uses windows APIs.Now since NPAPI is obsolete, i am trying PPAPI. My question is can i link windows APIs to PPAPI? Is it possible ?
As Bennet mentioned, it is not possible to make calls to the Windows API. If this is necessary for your application, try making a Chrome Extension and using Native Messaging instead.
From the link:
Extensions can exchange messages with native applications. Native
applications that support this feature must register a native
messaging host that knows how to communicate with the extension.
Chrome starts the host in a separate process and communicates with it
using standard input and standard output streams.
It is not possible to call Windows functions. If it were, then it would be trivial to escape the NaCl security sandbox.

Replacing Apache Flex with HTML5

I am writing an application which requires access to the microphone of a device to determine instantaneous volume levels. The app will have a web version, iOS version, and Android version, and must be compatible with as many devices as possible, since the particular user base our application targets may not be able to switch browsers easily.
At first, I looked into using HTML5 for my application. However, it does not seem to be viable for my purposes, because I can't find any cross-platform way to get instantaneous microphone input and many users may be using an out-of-date version of their browser, which would not support HTML5. Is there any tool which alleviates these challenges and would allow me to use HTML5?
As a replacement, I began looking into Apache Flex. It seems to have all of the features I seek: It is cross-platform, allows me to access microphone volume levels, and will work even on very old devices, as long as they have Flash installed. However, many people predict the imminent death of Flex and strongly argue against using it, opting rather for HTML5. For my purposes, is Flex an appropriate tool, or would it still not be recommended?
You can achieve it by using PhoneGap or similar backend app which can host a webview and allow you to access native api through JavaScript or JSObject.
For front end, you can use HTML and keep your UI standard across all devices/platforms.
PhoneGap is little bulky but on Android and iOS, you can create a minimal app by hosting WebView and customize it to create JavaScript bridge and write your own native api.

Integrating platform-specific API's in multiplatform mobile app (Flex / Titanium)

My team is in the planning phase of a multiplatform mobile app. We're considering Adobe Air/Flex or Appcelerator Titanium instead of native development, but will eventually be needing to use an external API that is ported to iOS and Android. **(one that harnesses the device's camera)
The idea would be to use platform detection and overloaded classes to determine which platform version of the API to import. Is something like this possible in either Adobe or Appcelerator? If so, would the native Objective-C or Java need to somehow be wrapped in Actionscript (if Adobe) or JavaScript (if Titanium)?
Any advice would be fantastic.
A near-term (no dates yet) release of Mobile Air will include native extensions. The native code will be written in the platforms' native languages. ActionScript interfaces will exist to interact with these extensions, the specifications for which have not yet been released.
http://active.tutsplus.com/articles/news/industry-news-week-22-2011/
Titanium is 100% native code.
How Does Appcelerator Titanium Mobile Work?

Resources