Im trying to write own plugin to call native iOS functions. Can any one guide me in writing own plugin & consume it to my ionic application.
Thanks in advance
It can be done using Cordova's Plugin Development Guide.
from docs it says,
Plugins comprise a single JavaScript interface along with
corresponding native code libraries for each supported platform. In
essence this hides the various native code implementations behind a
common JavaScript interface.
you can check these articles for kick-start.
Plugin Development Guide
How to write Cordova Plugins
Tutorial
Related
I really want to make use of the pencil kit in my react-native application. I just want to know whether I can do it. If yes, then how?
TLDR: Doesn't exist as of 2/6/2021 and you will need to write bridge code between react native (js) and native (swift/ObjC). There are big performance limitations with this approach. I recommend you create a native Swift based app for your project.
I was also curious if this is available.
For those willing to use Swift, here's the sample shown during the demo.
For those that want to use PencilKit / CoreML native libraries from React native you need need to write bridge code between Javascript (please use typescript) and the native code.
Here's more information on bridging and a guide.
For me, I will be building a note taking app and it needs to be performant. Despite being a react / react native developer I will be choosing Swift to build this project due to performance concerns.
Last point to make is that you can use react native and native together. But this is more of a headache than an enabler. AirBnB used this for some time but moved away from this approach.
For anyone new to React Native, it's a great platform. I personally like to use it for simple applications (not graphically intensive). You can also use it with the Expo tooling which speeds up prototyping but be warned some functionalities are not available bluetooth is one example.
Yes I Did it.
I created a native view for iOS Pencil Kit in React Native with Swift.
You can check basic examples for native module in my Repo
i have cordova application in IOS.I am using x code to modifying in application. actually i am new to mac and IOS i want to know how to add custom or third party cordova plugin in my IOS application.Any tutorial or guidance any one recommend?
You use cordova, to add plugins you use:
cordova plugin add *pluginname*
in the installation process it will be added to all platforms that the plugin supports. For further information about that you have to read the readme files of the plugin. They explain that for every part of their plugins better than we can here in our short texts.
If you have any further question, just ask :) Have a nice day.
You can use the command cordova plugin add PLUGIN_NAME
Please check the documentation from Cordova for other options to update, remove, build the plugin https://cordova.apache.org/docs/en/3.1.0/guide/cli/index.html
I am developing a webapp using phonegap + sencha touch, and I want to lock orientation on certain pages during runtime. I found this phonegap plugin , but it's not working for phonegap 3.X.
I also found something about a js function which named 'shouldRotateToOrientation', is it provided by phonegap? And it seems just works in multi-page(html files) app, my sencha touch app only have one html file.
So, how can I do that? Any help from you will be greatly appreciated.
i know this is not really a valid "answer" but SO doesn't let me comment with <50 rep. anyway, i noticed it's not that difficult to set up an old plugin to be used with cordova 3+. adhere to the folder structure (which you can see in existing cordova plugins like "device"), create a plugin.xml and install the plugin with plugman. read the documentation about plugin development and you should be good.
you will especially have to replace the function header in the ios files. replace
-(void)setAllowed:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
with
- (void)setAllowed:(CDVInvokedUrlCommand*)command
This is a phonegap plugin for android/ios.
https://github.com/yoik/cordova-yoik-screenorientation
I'm using Wikitude and PhoneGap for my augmented reality mobile app project in xcode5. I don't what mistake I had done during installation. I have already read all the documentation related to this setup.
http://www.wikitude.com/external/doc/documentation/3.0/phonegap/setupguidephonegapios.html
Besides that, I have already downloaded Wikitude Phonegap plugin sample from Github but I still don't have any idea to integrate the samples into my project.
https://github.com/Wikitude/wikitude-phonegap-samples
I have already inserted this code into config.xml.
<feature name="WikitudePlugin">
<param name="ios-package" value="WTWikitudePlugin"/>
</feature>
But I am not understanding this part.
JAVASCRIPT INTERFACE
It is straightforward to use the Wikitude Plugin within your PhoneGap application.
We wrapped all cordova.exec calls into a separate JavaScript wrapper which handles location updates and some more functionality behind the scenes.
You will mainly work with the WikitudePlugin where all you have to do is to call Wikitude.isDeviceReady(successCallback, errorCallback) and in your successCallback, you can call WikitudePlugin.loadARchitectWorld(successCallback, errorCallback, "path/to/your/world").
What are the other kinds of files I need to add for running Wikitude sdk in my mobile app project?
Why does it happen?
you are referencing an outdated documentation from Wikitude. Have a look at the current documentation which describes the setup process using PhoneGap 3.0 + Plugman.
After you have done this, all you need to do is to add your 'Architect World' which is the 'assets' folder in the sample application. You can structure this folder as you want but it has to include a html file which is the starting point for the Architect World.
To interact with the Wikitude SDK, there is the WikitudePlugin.js file, which wraps all the calls from JS to the native ObjC application. Have a look at the sample application how to use the WikitudePlugin.js, but in general you need to check if the device is able to run an Architect World (WikitudePlugin.isDeviceSupported) and after this, use the success callback to load the Architect World with WikitudePlugin.loadARchitectWorld.
I have used the c++ google protobuf classes in iOS using the native app approach, i.e. using Xcode, objective c, cocoa etc.
Now, I want to migrate to hybrid apps and I have explored the options on web, and according to my requirements i'm down to PhoneGap and Titanium. That will require me to use JavaScirpt, HTML5 (JavaScript only in Titanium as per my understanding) jQuery etc.
My question is, HOW am i supposed to access the my c++ protobuf classes from javascript. (i have no expertise in JavaScript).
I am also open to opinions on which hybrid-app framework to use.
Lords of web-dev....guide me.
With PhoneGap, if there is a phone feature that the PhoneGap APIs do not currently expose, or if you have some specialised native algorithm / function that you wish to access, then you need to write a plugin.
PhoneGap plugins provide a standardised mechanism for packing native code and accessing its functionality via JavaScript. See the PhoneGap Plugin Development Guide.
Personally I think PhoneGap is the best hybrid framework, it had been around for a while, is well documented, and has a healthy community.
This is an old question, but you can always use the 100% JavaScript implementation of ProtoBuf in your JavaScript code. It works well, and you can even precompile the .proto file if you want.
In Cordova it would be better to create a plug-in, but if you don't have time or skill to do that, the linked code works well.