Use Phonegap for SDK developement - android

I am developing a native SDK which is integrated into a native app ("host app"). The app is calling my SDK method and this method will open a Webview (both for iOS and Android).
I looked into Phonegap as a solution, and saw that it gives me a platform for opening a Webview and communicating with the device. While this is ok, I cannot find a way to build this as the "SDK app" that I wanted, triggered by host native app, without writing the native code for that myself (duplicating my code for iOS and Android and dealing with native code).
Does Phonegap (or other platforms) have the ability to add a native logic (and not only webview) without the need to duplicate my code?
tnx!
Yaniv

PhoneGap is for developing apps. It is not really for third parties to create a library for others to use. While you can try to twist PhoneGap (and similar solutions) to serve that role, that will add extra baggage for anyone who would want to integrate with your library.
Hence, I suggest that you just create a library, sans PhoneGap.

Related

Is there a reason to use Cordova instead of a basic Webview inside an existnig app?

Pretty much as the title says.
I developed a cordova app as a proof of concept, and the person I developed it for liked it and wants the look and feel of some parts of it in their existing app while I continue to work on the cordova app.
Is there any reason to use cordova in an existing native app vs just using a webview? Does Cordova give you anything inside an existing native app that a webview does not?
Cordova provides plugins, which are a bridge to execute native code using javascript.
Also, now you can use plugable webviews, which allow you to switch the default webview with another one (like crosswalk) but keeping the plugin compatibility.
But those webviews are also available without Cordova.
So, if you need the plugins, use Cordova, if you don't need them, use a regular webview.
But as you want to put it inside an existing app, the documentation to do it is out of date, so it's going to be a bit hard to do it.

Can Cordova be a wrapper for a Xamarin app?

I am supporting a legacy Android app that was written in Xamarin. That Xamarin app will be replaced by a Cordova app. During a transition period I will need a solution that will support both. My high level thoughts are that after the user logs in to the app, I will send them to to what is applicable for them (legacy Xamarin or new Cordova). The app would effectively contain the code-base for both apps.
Is this sort of thing possible with Cordova - i.e. can I 'wrap' an exising Xamarin application inside of a Cordova one?
Thanks.
The short answer is "no." Xamarin generates an executable binary, not a collection of HTML or JS files thus Cordova/PhoneGap cannot "wrap" it. With that said, you can probably do a couple of things:
1) Have your Cordova app open the original Xamarin.Android app via app url:
Android Custom URL to open App like in iOS
2) In your legacy Xamarin.Android app create a WebView that loads the HTML/JS that your Cordova/PhoneGap would've. Basically, in a way, you'd be recreating the functionality of Cordova with Xamarin.
http://developer.xamarin.com/recipes/android/controls/webview/call_csharp_from_javascript/
http://developer.xamarin.com/recipes/android/controls/webview/load_a_web_page/
http://developer.xamarin.com/recipes/android/controls/webview/load_local_content/
I've found this link about using phonegap on monotouch apps:
http://scott.blomqui.st/2012/08/embedding-cordova-phonegap-in-monotouch-apps/

Android app with HTML5

I want to create a Android Application.
Altough I want to use HTML5 for creating that application.
Later on I even want to get the application to multiple platforms like for Apple.
I have tried Eclipse but couldn't get it to work.
When I create a new "Project > Web > Dynamic Web Project" I can't export this into a Android Application.
PhoneGap looks interesting.
Although I'm not sure how you can create a .apk (for android) there.
Or should this work together with Eclipse?
Could anybody give me a headstart?
What Application should I use to make a HTML application?
How do I create a .apk file?
Thanks in advance.
If you really want to dive right into developing with Phonegap, you can try out Telerik's AppBuilder (http://www.telerik.com/appbuilder). The demo project uses KendoUI Mobile (which I can also recommend) is comprehensive enough for anyone. As far as I recall you can use it for free for up to 2 projects.
There is also Intel's XDK (http://xdk-software.intel.com/), which is completely free - but the simulator and deployment features aren't as far developed as Telerik AppBuilder's are.
I strongly recommend AGAINST doing it the "real way" with eclipse/xcode if you have no prior experience with developing native android/iOS apps.
Start with the following project:
http://code.google.com/p/html5webview/
This will give you a good start. You can download it and import it into eclipse.
Phonegap does create an APK.
Essentially what Phonegap does is present a WebView and a simple API for calling native methods on the respective platforms. This allows you to write the same app and deploy it on multiple platforms with minimal or no changes. The majority of what you would do in Phonegap is set up the projects to pull in the cross-platform libraries.
The major limitations come from lack of access to native UI components. As you progress in app development you may find that it's a significant limitation. I rarely build HTML5-based UIs anymore, and instead go with native apps.
There are other cross-platform frameworks out there as well. Here's an article describing some pros and cons of each:
http://www.developereconomics.com/pros-cons-top-5-cross-platform-tools/

Opentok module for Titanium SDK that supports both Android and IOS?

I am developing a mobile application using Titanium SDK. This is my first mobile app. Most of the app is done successfully. The only module that remains is Video conference support. The company I am working in has chosen to use Opentok SDK. I finished the web application and it works fine. Now I've hit a wall in mobile app and can't move further. The problem is Opentok provides a module to use for Titanium, But it only supports build to IOS not Android. The reason we chose Titanium is for cross platform support.
Is there any module available to use or any other way to implement Opentok with Titanium that builds into both Android and IOS.
I have already tried using a WebView to open the conference module of web application. But bad luck, Opentok only works with chrome browser in mobile. But WebView utilizes native stock browser which does not support WEBRTC. So, opentok doesn't work with webview too.
Please help me. This is my first app and I am stuck at this point.
To Create a Module for OpenTok Android:
These are the steps I would follow.
Create a new Android module: titanium.py create --type=module --id=com.tokbox.ti.opentok --platform=android --name=opentok-titanium
Follow the installation instructions from OpenTok for Android. (Hint: I added a separate section down below to help you get through their instructions.)
Make sure the module runs: ant run.emulator or ant install.
Try running their sample, fully in JAVA, completely separate from Titanium. Make sure it works, and you know what it should look like. Then, figure out what exactly you need from their API. Or, if you're feeling ambitious, decide you want everything. Work to strip down the example to just the surface area that you need. Simplify it down to the least number of files you feel makes sense.
Write an example/app.js that demonstrates how you want the module to be used. For example, maybe you'd start off by requiring the module, then setting some API + Session keys, then calling some API, etc.
Based on the documentation, port what you need in to your module. Reference the Appcelerator Android module dev guide and open source Android modules for inspiration.
Write documentation for the module to specify what the various properties, methods, etc are, so that other developers can figure out how to use the module.
When you're done, submit a PR to OpenTok and revel in your creation and contribution.
Some Hints for Step 2:
.jar files go in lib/.
.so files go in platform/android/libs/armeabi/
Permissions go in timodule.xml, and you can see an example in the open source PayPal module for Android
OpenTok does not work with WebView. OpenTok support for Titanium Android does not currently exist because it is currently in beta and we don't currently have engineering bandwidth to build a Titanium Android integration. However, if you are familiar with Titanium, you are more than welcome to add the integration yourself and send a pull request. You can get the Android beta here and you can get titanium source code here
If you are in a hurry and open to trying other frameworks, our PhoneGap Plugin currently supports both android and ios.

How to debug GUI part in Phonegap application?

I am writing a very simple Phonegap application on android. The problem is how to automatically test the GUI part of it. QUnit looks like a good choice to test only Javascript but it needs jquery library to support testing user actions, according to the Cookbook. Is it appropriate to include JQuery library in Phonegap application for testing purpose?
Here is an simple scenario. I have an input field in the application. And I want to test it to see if it could accept value. How should I do with it in Phonegap? Or is there other choice to test the GUI part of Phonegap application?
I also found this question about Selenium but I am trying to find other possible ways to do it.
Cordova (formerly Phonegap), by itself (basically), nothing have to do with javascript, it just a tool to wrap your html/js/css code in android WebView element. Cordova has methods to access device internals via cordova provided JS calls.
Well, you can unit-test your application even in chrome desktop browser. Also, if you want, you can include any JS libraries to be used in App. If you have any questions- just write comment

Categories

Resources