Porting native apps to Phonegap? - ios

I have a native app for iOS and am being tasked to create a new app that includes portions/sections of that original native app within this new project. The caveat being that the app I am now tasked to develop must be done with Phonegap/Cordova.
My question is, what options do I have for utilizing the native code within the Phonegap project, or does the same functionality all need to be rewritten in HTML5/JS? I'm new to Phonegap so I don't fully know it's capabilities.

Generally phonegap apps are coded in javascript, css, html and where ever they need access to the native layer, they use phonegap plugins to access the native functionality. If you want use your existing code for integration into a phonegap app, you can do it by wrapping your code using phonegap plugin architecture and create plugins for the functionality from the code that you wish to reuse. Then you call those plugins where ever required in your application.
The below link is good starting point for creating plugins.
http://docs.phonegap.com/en/3.4.0/guide_hybrid_plugins_index.md.html#Plugin%20Development%20Guide

Related

dart/flutter: How to ship iOS apps using flutter frontend vs. C/C++ backend to App Store?

Goal
I'm building an iOS app using flutter for frontend, and C/C++ as backend. They must interoperate through FFI, which is a language binding scheme through C dynamic libraries. I intend to submit it to iOS App Store.
Problems
The Dart FFI sample on accessing C-struct works on macOS through dynamic liking and binding. Now dynamic linking is technically possible on iOS according to Xcode 9 - No option to create dylib project iOS, however, it's unclear to me how to ship the app to AppStore, because dynamic linking is not allowed according to Apple Guidelines Section 2.5.2.
2.5.2 Apps should be self-contained in their bundles, and may not read or write data outside the designated container area, nor may they
download, install, or execute code which introduces or changes
features or functionality of the app, including other apps.
Educational apps designed to teach, develop, or allow students to test
executable code may, in limited circumstances, download code provided
that such code is not used for other purposes. Such apps must make the
source code provided by the Application completely viewable and
editable by the user.
Quite a few SO questions confirm this problem, such as:
can I use dynamic library(shared object) in my iphone app?
Will Appstore reviewers allow us to use dynamic library in iOS8?
Then official flutter documentation says
Dynamically linked libraries are automatically loaded by the dynamic
linker when the app starts. Their constituent symbols can be resolved
using DynamicLibrary.process. You can also get a handle to the library
with DynamicLibrary.open to restrict the scope of symbol resolution,
but it’s unclear how Apple’s review process handles this.
Questions
As of the date when I post this (2020), does this say that I could never ship an app using this architecture to App Store?
Is it possible that I static link my C/C++ code into a single binary of a flutter app? Take Unity as an example, their iOS plugin system recompiles the plugin into native app. If flutter has a similar mechanism, how?
The answers saying you can't use dynamic libraries on iOS date to before iOS 8, when support for user-provided dynamic libraries was added.
Nothing in 2.5.2 days you can't use dynamic libraires as long as they are shipped as part of your app. So:
As of the date when I post this (2020), does this say that I could never ship an app using this architecture to App Store?
No it doesn't, as long as "this architecture" refers to using a dynamic library that you link to at build time and bundle into your application.
Adding inputs from Reddit's FlutterDev channel
#escamoteur
As I understand it you are not allowed to load any library from
outside your installation folder. Especially not downloading something
at a later point of time. Could you make this a Stackoverflow question
and tag it with Flutter?
#airflow_matt
Since iOS 8 there can be shared libraries in the bundle, when properly
codesigned I don't see why dlopen wouldn't work. Or you can link the
library with main executable itself (just like flutter does) and
dlopen self (DynamicLibrary.process()). I think it's worth a shot.

How can I call with native Swift methods from Electron app using javascript?

I am looking to add in-app subscriptions to the mac desktop app so I can submit to app store.
I have the code written for iOS using the cordova plugin: https://github.com/AlexDisler/cordova-plugin-inapppurchase
But for electron there exists no such plugin.
So I can use the native swift code from the plugin, but need a way to write a custom plugin so I can call swift methods from javascript running the Electron app.
Please let me know how to approach this, or point me to the correct resources.
Thanks You

PhoneGap application requires native iOS code for background service?

I have a PhoneGap app and it checks your location every 5 minutes and reports it back etc.. to do this When the app needs to run in put at the background .
For Android I have written native code but for iOS will this work?
I'm not even sure how you would implement native objective c into PhoneGap as they are very different compilers etcthe it pause.
Any advice would be appreciatedWhen it come back to front, it will resume all remaining operation.
You need to write a Plugin to do this. A plugin will allow you to write Objective-C code and link it back to a JS function. Here are a few tutorials:
From Apache
From Adobe
Another
Here is also a big list of Plugins people have already created: iOS Plugins

Integrating FastPdfKit with a PhoneGap application

I'd like to integrate a FastPdfKit Reader into my PhoneGap application. That is, the PDF reader should be opened within the PhoneGap app, so that the application-related navigation is still visible.
Where do I best start?
Do you know about any publicly available code that gives an example on how to achieve this?
It sounds like what you are looking for is creating a PhoneGap plugin.
http://wiki.phonegap.com/w/page/36752779/PhoneGap%20Plugins
Here are some tutorials on making plugins for PhoneGap:
http://hiediutley.com/2011/04/15/phonegap-tutorial-series-6-writing-your-own-plugin/

Embed Adobe Air/Flex application inside a standard iOS application

I have a native (Obj-C, standard Xcode project) application and I'd like to integrate a partners iOS application (or specifically, it's functionality) into it as just another view in my application. The problem is that their application is a Flex/Air app. I really don't understand the Adobe compilation process on how it gets from a bunch of flex code down to an IPA. I don't see intermediate projects, shared objects, etc on the disk to produce that IPA. It looks like it doesn't rely on the Apple tool chain... as I understand it, you can produce the IPA on Windows as well.
Is there any way to build that Flex app in such a way that I can import it into Xcode so I can link against it and use it as a library from within my application?
While I specifically used iOS as an example since that is the most important platform, we'll want to apply this solution to our respective Android and Blackberry 6 apps as well.
No, you cannot embed an application within another application. This is true for all applications. Only thing you could do is get the swf of your partner's code and embed that into an Air application, but since you're not using Actionscript/Flex, it won't be possible.
Only other way would be to have an app link to the other application.

Resources