Add .jar SDK to Cordova Hybrid app Visual Studio - android

I'm trying to implement an SDK for my Handheld API to an Cordova Hybrid App in Visual Studio. It's a .jar File.
I'm new in Cordova/PhoneGap developing, so I just want to know if its possible to generate the Bindings API/Wrapper automatically like in Xamarin with "Bindings Library(Android)".

so I just want to know if its possible to generate the Bindings API/Wrapper automatically like in Xamarin with "Bindings Library(Android)".
As far as I know, there is no way to generate the Bindings API/Wrapper automatically. If you want to call the APIs in your .jar file, you can use the Ace Plugin to invoke the native codes.
Or you can write a plugin that reference this framework(using <lib-file /> tag in Plugin.xml), and wrap the API manually with JS code.
For details about creating an Android Plugin, please refer to Android Plugin Development Guide.

Related

How can i add my custom cordova plugin in my android App?

I have a native android sdk which uses phone camera. I want to add a custom cordova plugin so that i can use that android code for web as well using plugins(google suggested it can be done). can someone please suggest me how it can be done?
I am able to create plugin but not able to add it to android code.
And from googling it is suggested that for that i need to create a cordova project first. I made a cordova project for testing purpose added platforms as-android, ios.
But I'm unable to get even the layout of that project so that i can even edit.
I have my native android code, please suggest me how can i add a cordova in native android project.

How to create a cordova plugin for my android library?

I have developed an android library using which one can send messages to other android devices. I have developed many demo apps for mobile and watch to demonstrate this using native android projects. Now I want to explore hybrid android development. I want to know how a native android code can access my android library and use the functionalities.
I have come across custom Cordova plugins. Is it possible for me to build a Cordova plugin for my android library? If yes, can I then use it in a hybrid project and access the functionalities? If not, what is the best way to do it? Thanks in advance.
To answer your 2 important questions:
1. Is it possible for me to build a Cordova plugin for my android library?
Yes, it's possible to create a custom Cordova plugin for your library. That's how all the Cordova plugins are dependent on the base Android library.
2. can I then use it in a hybrid project and access the functionalities?
Yes, you can.
Some are the links that might be helpful to create a new custom Cordova plugin.
https://cordova.apache.org/docs/en/latest/guide/hybrid/plugins/
https://cordova.apache.org/docs/en/2.5.0/guide/plugin-development/android/
https://taco.visualstudio.com/en-us/docs/createplugintutorial/

Does Android have something like iOS method swizzling (for PhoneGap plugin initialization)?

I am writing some PhoneGap plugins for both iOS and Android that wrap third-party native SDKs. In the case of iOS, I was able to use swizzling to add behavior to the AppDelegate for the purpose of initializing these libraries.
Now I need to do the same for Android and I'm now sure how to go about it. As an example, I am working with the AppsFlyer SDK now and this is how the docs say to initialize:
Is there a technique for doing something like this in a PhoneGap plugin? I need to be able to build the project from scratch without the Android Studio project itself being under source control.
Thanks!

Migrate existing Native Android project to Cordova-based project

I've developed Native Android project. I want to add Cordova's plugin interface between native and WebView components so i need to mix my project with Cordova-based project. Is it possible to migrate my existing native project with cordova-based project?
You can embed the cordova webview in your native project
http://docs.phonegap.com/en/3.5.0/guide_platforms_android_webview.md.html#Android%20WebViews
It is possible to do this, Cordova just runs as a webview and you could use Cordova on a specific page or part of a page in your native app.
However, you will get zero support to do this. With the new libraries of Cordova (since 3.*), Cordova uses the command line to build a web project and has a specific workflow to do so. The Cordova libraries are not optimized to do this.
If you do not have any UI in your existing project, or you want to replace the existing UI with webpages, you can create a plugin from your existing native code. Otherwise, I would not recommend to try to combine native and web that way with Cordova. You will have to do a lot of custom work to get it work the way you want to.
Another option is to create seperate apps and let them communicate with intents.

phonegap for each platform should be created?

phonegap is cross-platform solution for mobile development. my question is for each platform i should create new project with phonegap and import my html/js/css? or there is a tool to generate other platforms code?
As I know there is no tool for that.
You have to use the project templates for all devices you want to support and share the "www" folder for all the projects.
The main problem with this approach is that you have to implement all changes in the native code for each device... for example we had to change the start page in our project.
edit
Thank you for the hint #PeterMmm, did not know this =)
As #PeterMmm has mentioned, the PhoneGap build service allows you to build for all the supported platforms "in the cloud". Currently it does not support custom plugins although I understand that is a planned feature.
So as long as you are using only stock PhoneGap API calls you should be OK to use the build service.

Categories

Resources