Call phonegap plugin function within web app - redirect

i am building my first phonegap app and when i open the app i instantly redirecting (window.location) the user to my server where my web app is hosted. Is it possible to load the phonegap plugins from there? Because the "deviceready" event is not firing and i cannot call any plugin functions.

I can confirm that loading remotely does appear to allow access to native components (when scripts are properly loaded) and that cordova.jsdoes not appear to need to be loaded by the local index.html bootstrap.

Short answer: Yes
Some 'gotcha's'
You will have to supply correct cordova.js version for the platform browsing to your site.
you can look here for more info https://github.com/apache/cordova-js. This project hosts the core js elements, and builds the platform specific cordova.js lib
Any plugin api's your app wants to interact with must be pre-installed into the Native App
any plugin with native code will have to be added to the project and deployed to device bundled inside the app. There is no way to lazyload native code. The js portions of the plugin could be hosted on your server, however.
More information, some apps that do this
The PhoneGap Developer App uses a similar technique to what is describe above and what you want. The only difference is that it is meant as a dev tool, and the server is a local dev machine.
The Cordova App Harness also uses this technique of pre-bundling an app package with plugins, to be consumed by remotely hosted resources

You cannot, deviceready only functioning if the app run on mobile phone environment only. If web based or dekstop application, it won't trigger.

No , dont do that . loading remote website will not able to intract with your plugins . and the app will get rejected on istore too

Related

Ionic workflow questions and facebook authentication issue

I'm trying to implement mobile application using Ionic. I'm following this, but unfortunately logging in doesn't work on real device. It works fine in the browser and the emulator. I did every step from the tutorial, I did the tutorial 2-3 times and still get the same error.
I am logged in successfully on my device but then I see the following screen:
I already have both urls as redirect urls in my application settings in FB.
http://localhost:5000/oauthcallback.html
https://www.facebook.com/connect/login_success.html
I tried to debug OpenFB with alerts. I can see "cordova events" alert but then I have alerts on the first lines of loginWindow_loadStartHandler and loginWindow_exitHandler but they are not executed. I guess that the problem is there but I have no idea how to fix it.
if (runningInCordova) {
alert("cordova events");
loginWindow.addEventListener('loadstart', loginWindow_loadStartHandler);
loginWindow.addEventListener('exit', loginWindow_exitHandler);
}
Also I have some questions about Ionic and Phonegap.
I use Ubuntu and I am trying to build iOS and Android applications.
My application's structure is:
app/
hooks/
platforms/
plugins/
scss/
www/
Also I have InAppBrowser plugin:
cordova plugin add org.apache.cordova.inappbrowser
but this plugin is not part of app/www folder.
I am trying to build a phonegap application in their site. I made a .rar file of the app/www folder content and upload it. Everything seems to be fine. But in Phonegap site when I click PLUGINS, I see This application has no plugins. How should I add inappbrowser to the application, maybe that is the reason why my FB authentication doesn't work. If I build the whole app folder, again I see the same message - This application has no plugins.
So when create an archive file of the content for Phonegap, which folder I should archive - the whole app folder with all subfolders or only app/www? What is the correct flow? Also how crossplatform app should now about added plugins?
I ran into this issue today, if someone is still looking for the solution for this:
loginWindow.addEventListener('loadstart',
loginWindow_loadStartHandler);
is implemented in the js file, but the loadstart event never fires on my Android (but works on WindowsPhone cordova javascript app), instead i added:
loginWindow.addEventListener('loadstop',
loginWindow_loadStartHandler);
,which works on both Android and WP (with InAppBrowser 1.2.0), IOS test is still ahead.

Worklight Facebook platform selection?

For Facbook integration in Worklight which platform should we select Android or Website
,
right now i am developing for android environment but later i will be doing for iphone and windows as well
Also were do i place the Facebook integration code in index.html(main) or in android project which is separately created ?
i am confused do reply
It looks like you are developing a Worklight-based Hybrid application, so in this case you should actually opt for the Facebook JavaScript SDK.
You can add it to your common\js folder and reference it in the common\index.html (just follow the instructions Facebook probably provides). This way you could easily 'extend' it to whichever additional environments you will add in Worklight Studio in your project setup.
Of course, you can also choose to use Facebook's native SDKs for each environment in your Hybrid application. In this case, you'll need to add the SDK in the iphone-ipad-or-android\native folder and follow Facebook's integration instructions (note that for iPhone the actual integration will be done in Xcode, not Eclipse).
If you choose to create a native application and bundle it with the Worklight SDK, then you should opt for the Facebook SDK dedicated to the specific OS. Here, you will add the SDK, again, by following Facebook's instructions.

Phonegap's Facebook Connect plugin - making it work with web app as well as native apps?

I've got the FB Connect plugin working with my Phonegap project native apps, but now I'm wondering what the workflow is for making it work with the web-app version.
When I run the web-app version, I get the standard Phonegap FB Connect errors, the last one being 'FB variable does not exist. Check that you have included the Facebook JS SDK file.' - this makes sense, as my web app doesn't have those js files, as they get injected during the PG Build process.
So what is the typical way of moving forward at that point? Can I use that last error as a way of determining 'ok, this is the web-app version, not native', and then what do I do next? Should have the Facebook SDK installed on my web-app?
Cheers
The git repo has steps for including the plugin in web app
Web App
www/js/facebookConnectPlugin.js contains the JavaScript SDK and API file. The API matches as close as possible to the native APIs.
Setup Web App Example
Host the www folder on a server and configure your Facebook dashboard correctly to test the Web APIs. Most people use Parse for easy testing.
NOTE : Developers should call facebookConnectPlugin.browserInit() before login - Web App ONLY
https://github.com/phonegap/phonegap-facebook-plugin

Can we bundle Chrome installer with Packaged App?

We have built Packaged App for our Web Application.
Is it possible to provide Chrome installer in a Packaged App bundle or somehow trigger Chrome installation in the background from Packaged App.
Currently Chrome Browser is separate Dependancy for using Packaged Apps so it is difficult to convince Users to first install Chrome browser.
Also, people can install the App for any location as a complete package.
It's not possible yet, but you can star http://crbug.com/173762 to get notified when it does work.

Development of a Suite Application with modules download for iPhone

I'm starting developing applications for iPhone. My idea is to develop a application like a suite or multiple modules. The main application function is a application manager. This application can download each of the availables applications for the suite, like a office suite that starts with no applications/extensions, so, there are the possibility to download a spread-sheet editor, a text editor, or a image editor and so on.
I don't know if each application need to be a standalone application in appstore and the manager to have only shortcuts for they. Or if each application can be a library or plugin that will be installed in the main application through download.
Suggestions?
Thanks!
App store review guidelines says:
2.7 Apps that download code in any way or form will be rejected
You can't download libraries or code in your application. What you can do is, ship the application with all functionalities and enable them by in-app purchases.