Cordova Facebook plugin: set APP_ID, APP_NAME in config.xml - facebook

1. What we want to achieve
Install a pre-configured cordova app using fb cordova plugin ( cordova-plugin-facebook4 - https://github.com/jeduan/cordova-plugin-facebook4 )
2. Problem
The problem derives from the "pre-configured" part.
As a default, the plugin required to being install passing it some configurations like APP_NAME / APP_ID values, as documentation at < https://ionicframework.com/docs/native/facebook > specified.
This is a problem for us because our application creation flow process is based mainly onto the Cordova's configuration config.xml where clearly all plugins are listed.
3. Question
Our need is to be able to pass some configuration directly inside the config.xml file, like for other plugins here below shown:
<plugin name="cordova-plugin-camera" spec="2.4.1">
<variable name="CAMERA_USAGE_DESCRIPTION" value="Allow the app to use your camera" />
<variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="Allow the app to access your photos" />
</plugin>
In the previous lines, variables for cordova-plugin-camera is the way to configure the plugin.
4. Alternative solutions not adopted
Reading around, some solution required to change plugin.xml file of facebook-plugin.
The problem of this solution is the cost for the forked plugin maintenance.
5. Question-based on 4.
Avoiding to fork plugin for configuration setting purpose, can be HOOKS approach usefull? I mean, can we replace "preference" tag inside plugin.xml at some build / prepare / plugin install time as wrote in the second answer at the following link < Cordova Facebook plugin : missing variables APP_ID, APP_NAME > ?
thanks for reading!!

You can specify the APP_ID and APP_NAME in the config XML as following:-
Under Android Platforms:-
<config-file parent="/resources" target="./res/values/strings.xml">
<string name="fb_app_id">574355309670137</string>
<string name="fb_app_name">HUB App</string>
</config-file>
And outside the platform and at the bottom(when installed fb plugin) it would be defined as below:-
<plugin name="cordova-plugin-facebook4" spec="^3.1.0">
<variable name="APP_ID" value="574355309670137" />
<variable name="APP_NAME" value="HUB App" />
</plugin>
Please let me know if you have any questions.

Related

What is the Plugin Syntax for Facebook SDK For PhoneGap Build

ALL
I have searched long and hard all over the internet for the syntax for Facebook SDK to be used for PhoneGap Build via build.phonegap.com
Just like there is for SplashScreen what us the plugin syntax for Facebook SDK that I can add to my config.xml
I sincerely appreciate the correct answer to this.
Thank you very much
I have found the syntax I was looking for:
Below it is:
<plugin spec="https://github.com/jeduan/cordova-plugin-facebook4.git" source="git" >
<param name="APP_ID" value="---YOUR APP ID----" />
<param name="APP_NAME" value="---YOUR APP NAME---" />
</plugin>

How to Use Plugins with PhoneGap Build 3.x?

I am writing a PhoneGap Build 3.x program, and cannot figure out how to properly configure my config.xml and index.html files to access any of the plugins. Here is my config.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "org.kirsches.PGB"
version = "1.0.0">
<name>PhoneGap Build Test</name>
<description>PhoneGap Build Test</description>
<author href="http://www.kirsches.org" email="mitch#kirsches.org">
Mitch Kirsch
</author>
<preference name="phonegap-version" value="3.1.0" />
<preference name="orientation" value="default" />
<preference name="target-device" value="universal" />
<preference name="fullscreen" value="false" />
<preference name="android-minSdkVersion" value="7" />
<gap:platform name="android" />
<gap:plugin name="org.apache.cordova.device" />
<icon src="icon.png" />
</widget>
and here is my index.html file:
<!DOCTYPE html>
<html>
<head>
<title>PhoneGap Build Test</title>
<script src="cordova.js"></script>
<script src="phonegap.js"></script>
<script >
document.addEventListener('deviceready',
onDeviceReady,
false);
function onDeviceReady() {
alert("using PhoneGap 3.1.0");
alert("model = " + device.model);
}
</script>
</head>
<body>
<h2>PhoneGap Build Test</h2>
</body>
</html>
The "using PhoneGap 3.1.0" alert fires, then the application hangs on my Android device. Am I incorrect in assuming that I don't need to set up an AndroidManifest.xml file, since I am using PhoneGap Build (it is my understanding that PhoneGap Build generates the AndroidManifest.xml file from my config.xml file)? Or, am I missing something in my config.xml file (it is my understanding that the feature tag is no longer used by PhoneGap 3.x)?
Thank you to anyone who can show me my error in the above two files.
The only odd thing is the fact you include phonegap.js AND cordova.js. Pick one, it doesn't matter, as PhoneGap Build simply injects the correct file for you (as long as you have one of those tags). So in case you have: don't include the actual files.
Hope this makes a difference..
Eddy
Two things had to be changed in my code:
As Eddy correctly pointed out, I just needed phonegap.js or cordova.js (but, this was not causing my hanging problem).
I had to delete (uninstall) my app on my Android device and then re-install it via my bar code reader app (I use QR Droid). I have enabled debugging and hydration on my app (since I am in the early stages of development), and I am guessing that a prior hydration operation must have corrupted something in my app. The hanging problem occurred on two different Android devices, with the interesting scenario of the app simultaneously working correctly on Android device # 1 (since I had already done the delete and re-install on it) and not working on Android device # 2 (since I had not yet done the delete on re-install on it).
Two lessons I learned from this are:
You can't count on the hydration process to work all of the time!
Unless you are in the habit of changing the name of your application each time that you upload it to PhoneGap Build, clicking on the "Install" or the "APK" buttons or the bar code on the PhoneGap Build web page will bring down the most recent version that has been stored in Amazon S3, which might not be the most recent version that you uploaded to PhoneGap Build!
Mitch

How to Declare Plugin in config.xml using Phonegap 2.9

I want to use WaitingDialog plugin for my iOS application to show activity indicator. And i'm using PhoneGap 2.9 which is compatible with Xcode 5. I don't know how to declare plugin in PhoneGap 2.9 . Could anybody tell me how the bindings of Plugin take place in PhoneGap 2.9.
link for plugin:
https://github.com/phonegap/phonegap-plugins/tree/master/iOS/WaitingDialog
regards,
Varun Mehta
After Searching a lot i find out a solution for my problem and will like to share with others who are still facing it. To show Activity Indicator in your iOS application Using PhoneGap 2.9.0. Follow the below steps:
Go to " https://github.com/phonegap/phonegap-plugins/tree/master/iOS/WaitingDialog " and use this plugin.
Go to <ProjectDirectory>/config.xml and declare your Plugin
<feature name="WaitingDialog">
<param name="ios-package" value="WaitingDialog" />
</feature>
Use it in Your JS file as
window.plugins.waitingDialog.show("please wait..");
PLEASE NOTE: In PhoneGap 2.9.0 cordova.plist has been deprecated to config.xml and <plugins> tag deprecated to <feature>
<feature name="PushPlugin">
<param name="ios-package" value="PushPlugin"/>
</feature>

repeated error Cannot read property 'PayPalMobile' of undefined

Hi I am trying to use phonegap paypal android plugin
I am aware of the same issue raised on git hub but for previous version https://github.com/paypal/PayPal-Android-SDK-PhoneGap/issues/1
I did make the changes mentioned in readme that is
<feature name="PayPalMobile">
<param name="android-package" value="com.paypal.android.sdk.phonegap.PayPalMobilePGPlugin" />
</feature>
in file
but i am getting the same error
make sure you edit the correct config.xml res/xml/config.xml

How to deploy an app with a debug token on blackberry playbook?

I cant deploy an unsigned bar to my playbook device , because the of : failure 881 application author does not match debug token author. How can I fix this ?
Ive installed a debug token with bb10 sdk, so on my device, in my Security >> Development Mode tab I have:
Debug Token ....... Installed
Valid ............ Yes
Author............ -
Expiration Thu Jan 17 2013 04:19:43 PM
I`ve tryed to deploy like 2 times with/without tags
config.xml
<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
xmlns:rim="http://www.blackberry.com/ns/widgets"
version="1.0.0.0"
>
<name>AppDev2.0</name>
<author>-</author> <!-- and without <></> and still pops me the failure 881 author problem -->
<icon src="assets/icon.png"/>
<content src="index.html"/>
<rim:permissions>
<rim:permit>access_location_services</rim:permit>
</rim:permissions>
<!-- for flickr search data (json) -->
<access uri="http://api.flickr.com" />
<!-- for flickr images from farm1. to farm9. -->
<access uri="http://staticflickr.com/" subdomains="true" />
<!-- for google image search data (json) -->
<access uri="https://ajax.googleapis.com" />
<!-- for google images from t0. to t3. -->
<access uri="http://gstatic.com" subdomains="true"/>
<!-- for weather data (xml) from free. and icons from www. -->
<access uri="http://worldweatheronline.com/" subdomains="true"/>
<!-- used to create dialogs (location-details.js, splash.js, saved-locations.js-->
<feature id="blackberry.ui.dialog"/>
<!-- to enable the application to invoke the browser -->
<feature id="blackberry.invoke"/>
<!-- to trap the onswipedown event -->
<feature id="blackberry.app"/>
</widget>
"I had similar issue. Check that in blackbery-tablet.xml and fields are correct.
To get the right values for those fields just rename your packed .bar file to .zip, then unarchieve it. There will be manifest.mf file in META-INF folder. Open it with notepad. Grab and values from there and rebuild your app. If that does not help, then rebuild debug token and make sure you install it on the device. Debug token needs to have correct device pin.
Please click the Thumbs Up icon if this comment has helped you! If your issue is resolved, please click the solution button on the resolution!" -source http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Failure-881-Application-Author-does-not-match-debug-token-author/m-p/2055935#M32567
I had similar issue. and it was not an "author" problem : I was trying to deploy in debug mode and the debugToken was just not installed on the device.
The debugToken must be on the device so that the deploy can work. You can upload the debugToken with :
blackberry-deploy -installDebugToken debugtoken.bar -device 169.254.0.1 -password
hope this helps :)
The value of the author tag must match your company name you have provided during creation of BlackBerry Signing keys.
Open with a text editor the file blackberry-tablet.xml, the file is inside your <BlackBerry WebWorks SDK Tablet install folder>\bbwp\AirAppTemplates\src\.
You should see a section with something like:
<publisher>Sample Inc.</publisher>
<category>core.internet</category>
after this section you have to add
<author>*replace with your author name info*</author>
<authorId>*replace with your author id info*</authorId>
You'll have to get your author and your author id info from the debug token that you uploaded on your PlayBook. You should have your debug token on your computer, rename .bar to .zip and extract. With a text editor look in the META-INF folder at the MANIFEST.MF file for values for Package-Author: and Package-Author-Id: folowed by the actual string values.
Hope this helps.