More and more people are asking for a way to test {N} within an existing native application. Such an integration will allow for better adoption since starting an entire application from scratch is less appealing than just integrating a library and testing how a single screen works.
Generally there are two steps needed to accomplish this:
This relates to https://github.com/NativeScript/ios-runtime/issues/459. I guess to some extent it is related to https://github.com/NativeScript/android-runtime/issues/283 as well.
I prepared a little PoC project which demonstrates that NativeScript CAN be used within an existing Android application.
Features:
assets/ folder can be executedThe PoC has been updated for the latest version. These are our latest conclusions about the current state of NS in an Android app:
Hi @Pip3r4o this looks nice.
Would you mind pointing me to the right direction to understand what metadata is used for in ns ?
@vekexasia, the metadata is one of the main building blocks in an android application that enables access to all native (Android, Java) APIs through JavaScript. You can read more on the Android Bridge and its components here - Execution Flow
I would like to be able to embed NativeScript in Unity3D applications, on both Android and iOS platforms (and of course OS/X and Windows once you support them).
Could this issue please be applied to iOS as well as Android? Or maybe open another one since they are separate tasks applying to different plumbing.
Unity builds its own self contained iOS and Android projects with their own top level application objects and main loops, so there would have to be some way to integrate the Android and iOS project that NativeScript builds with the app project that Unity builds, like a build hook script. Therein lies the rub...
@ivanbuhov can you apply the same issue for iOS?
The same issue for iOS: https://github.com/NativeScript/ios-runtime/issues/459
The iOS embedded sample: https://github.com/NativeScript/sample-ios-embedded. Currently, the sample is working with iOS runtime older than v2.1.0.
Runtime can be consumed as a library, the remaining work needs to be done in modules.
How?
The PoC @Pip3r4o made uses only the runtime without modules in an existing application. See more here
@vekexasia it has been verified that the runtime can be integrated into an existing application. Check out the article describing the process -> https://medium.com/@enchev/extend-your-existing-android-app-with-angular-2-and-nativescript-56a4e1c72d6#.qjil0n58k
Thank you :)
On Fri, Jan 13, 2017 at 2:44 PM, Peter Kanev notifications@github.com
wrote:
@vekexasia https://github.com/vekexasia it has been verified that the
runtime can be integrated into an existing application. Check out the
article describing the process -> https://medium.com/@enchev/
extend-your-existing-android-app-with-angular-2-and-
nativescript-56a4e1c72d6#.qjil0n58k—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/NativeScript/android-runtime/issues/321#issuecomment-272445841,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAMPS8s1RMw87z34PytnIQ0-5yaJH99bks5rR3_KgaJpZM4G99IJ
.
--
Andrea Baccega
[image: Email][email protected]
[image: Hangouts][email protected]
[image: Personal site] http://www.andreabaccega.com/ [image: Linkedin
Profile] http://it.linkedin.com/in/andreabaccega [image: Facebook]
https://www.facebook.com/andrea.baccega [image: Google+]
https://plus.google.com/109217393200753135791 [image: Twitter]
http://twitter.com/veke87 [image: StackOverflow]
http://stackoverflow.com/users/314407/andrea-baccega [image: GitHub]
https://github.com/vekexasia
This would be an awesome feature to enable sharing JavaScript code in native apps.
@bootstraponline that is possible now, if a bit clunky. Check out the docs article - https://docs.nativescript.org/integration-with-existing-ios-and-android-apps/extend-existing-android-app
Yeah, unfortunately it's not an officially supported use case and is considered experimental. I was able to get it working on Android and not iOS.
I agree. Making {N} pluggable into an existing android/IOS app makes a lot more sense than running {N} as a standalone framework.
Typically one should be allowed to create random pages/activities using {N} in an existing native app (and then have some dev-env bootup mechanism to start any platform).
We have a single huge android+IOS app with two different codebases and are aching to not develop remaining modules using two different frameworks.
The only thing stopping us from doing so with {N}+Vue is the fact that the mechanism isnt officially supported.
@basantmudalgi @bootstraponline - Please check out the repo: https://github.com/NativeScript/sample-ios-embedded it has working instructions for how to embed the ios side into your application as an additional framework and call into it when you need it.
Is https://github.com/NativeScript/sample-ios-embedded/issues/3 fixed? I looked at that sample before and embedding on iOS is not officially supported.
I can tell you it builds great on the latest version of XCode and NativeScript. ;-) This update was just finally pushed a couple weeks ago...
Nice! https://github.com/instructure/instructure-ios is the app I was trying it on.
We moved on to using gRPC. It sounds like future users will have an easier time. Hopefully next year this becomes an officially supported use case.
Thanks @NathanaelA , @bootstraponline
Hello,
I need some help. I am trying to integrate a NativeScript application into my native Android test application.
I followed the tutorial for integrating a native script application into a native android application and it works fine.
But the scenario in this tutorial handles only launching the native script created Activity from the native application.
Is there a way to initialize a native script created fragment or other container into the native application ?
If so is there an example showing how to do it ?
Thanks & Regards
Kobi
i want it
If Nativescript app's can be imported in android studio and than signt by it it would be fantasic!
We Have separate Android, iOS, and Web Apps. We want to build many cross-platform (Android/iPhone/Web) PLUGINS like mini-apps in WeChat, that users can pick and enable within our app. These plugins, I feel can be built using something like Nativescript. These Plugins' code should be loaded on-demand and updating using hot push.
I am not sure if this can be done today using Nativesript or there is a plan for this?
@Ferryvb & @dishantghai -
On android it is much easier to do this; iOS requires more setup but also can be done. And their is nothing stopping you from running code on demand. However, their is no real documentation to show how to do this as this is such a corner case. The docs on embedding might get some work on a bit later this year as we do want that to become a easier to do...