I am trying to add the Facebook plugin (https://github.com/Wizcorp/phonegap-facebook-plugin) to my existing Ionic app, but I cannot get it to work.
I am currently getting the following when I include the plugin script:
Can't find variable: require
Here's the script in my markup:
<script src="cordova.js"></script>
<script src="https://cdn.rawgit.com/Wizcorp/phonegap-facebook-plugin/master/facebookConnectPlugin.js"></script>
If I throw in a reference to requirejs (which I'm using later in the markup for bootstrapping the Angular + RequireJS part of my app), I end up with the following error:
Module name "cordova/exec" has not been loaded yet for context: _. Use require([])
What am I doing wrong?
See the ngCordova facebook plugin document
ngCordova Facebook Plugin
enjoy the program
sample code===
first plugin install and then inject $cordovaFacebook in controller and write some code below
$scope.facebook_login = function() {
$cordovaFacebook.login(["public_profile", "email", "user_friends"])
.then(function(success) {
console.log('Arguments', arguments);
$http.get("https://graph.facebook.com/v2.2/me", {
params: {
access_token: success.authResponse.accessToken,
fields: "id,name,gender,email,birthday",
format: "json"
}
}).then(function(result) {
console.log(result);
}, function(error) {
console.log(error);
});
}, function(error) {
console.log(error);
});
}
as far as i understand you need to install this plugin on your app. I don't see in install guid ability to include it from web. It should build some things and add some settings to cordova. Have you read this instruction?
instruction on git
Related
I clone the demo project for ui5-tooling and run it successfully.
however if I do a little change to the project, some errors occur.
Reproduce
I did a little change to the manifest.json as below:
"sap.ui5": { "dependencies": { "libs": { "sap.ui.core": { "lazy": false }, "sap.m": { "lazy": false }, "sap.ui.layout": { "lazy": false }, "sap.ui.unified": { "lazy": false }, "sap.ushell": { "lazy": false } } },
add another lib 'sap.ushell'.
then run the opa again with: 'ui5 serve -o'
Symptom
The opa cannot run, in the developers tool of chrome, i found the error:
Error: failed to load 'sap/ushell/library.js' from resources/sap/ushell/library.js: 404 - Not Found...
Explaination
I did this change because when I trying to enable ui5 tooling to my existing projects, I can not run OPA successfully.
If i mannually add the lib by 'ui5 add ', then more errors occurs, like 'File not found: /resources/sap/ui/core/themes/sap_belize/base.less'
I was facing the same issue here, following the instructions from Boghyon and the last step is to change your data source in the index.html file as well since your are using SAPUI5 now instead of OpenUI5 (i.e, use src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js" in your bootstrap script).
The lib sap.ushell is available only in SAPUI5 since it's not open-sourced.
As of UI5 tooling specVersion 2, you can define whether the application project should use SAPUI5 or OpenUI5 in the ui5.yaml file.
Follow the "Getting Started" page https://sap.github.io/ui5-tooling/pages/GettingStarted/ to prepare consuming UI5 Tooling in the project.
Ensure that SAPUI5 resources are used instead of OpenUI5:
ui5 use sapui5#latest
In index.html: *
<script id="sap-ui-bootstrap"
src="resources/sap-ui-core.js"
data-sap-ui-async="true"
data-sap-ui-...="..."
></script>
* In case you'd like to bootstrap SAPUI5 via the CDN URL, see:
The "Resolution" section at https://stackoverflow.com/a/60377984/5846045
SAP Note 2943781: "Is the usage of SAP's Content Delivery Network for onPremise systems permitted?"
Add sap.ushell to the list of libraries.
ui5 add sap.ushell
You can doublecheck the used framework and the list of added UI5 libraries in ui5.yaml located in the project's root directory.
I am using this plugin: cordova-plugin-googleplus
After the user selects his Gmail correctly I get an object with a lot of different user informations
and on the backend side I use Java and followed this tutorial: backend-auth
Now I got the problem that I only get an Access Token via the googleplus plugin, but I need an IDToken. This is the code I used:
this.googlePlus.login({webclientId:'778525824123-83qa65tspdfd5c6i6roquf3dd41m3nk8.apps.googleusercontent.com'})
.then(res => {
console.log(res);
}
)
.catch(err => console.error(err));
Maybe there is something wrong with my webclientId? I don't know.
I solved it by not using the npm version, I used:
ionic cordova plugin add https://github.com/EddyVerbruggen/cordova-plugin-googleplus ......
I want to integrate Google Analytics on mine Ionic / WooCommerce App, so I added a Google Analytics plugin:
cordova plugin add https://github.com/danwilson/google-analytics-plugin.git
ionic cordova plugin add cordova-plugin-google-analytics
npm install --save #ionic-native/google-analytics
I saw this codes on ionic framework so I added them on the app.component.ts:
import { GoogleAnalytics } from '#ionic-native/google-analytics';
constructor(private ga: GoogleAnalytics) { }
...
this.ga.startTrackerWithId('YOUR_TRACKER_ID')
.then(() => {
alert('Google analytics is ready now');
this.ga.trackView('test');
// Tracker is ready
// You can now track pages or set additional information such as AppVersion or UserId
})
.catch(e => console.log('Error starting GoogleAnalytics', e));
I added tracker Id…
After running this on the browser the console logs what I got was GoogleAnalytics.startTrackerWithId, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator:
cordovaWarn # util.js:66
app.component.ts:155 Error starting GoogleAnalytics cordova_not_available).
So I produced an Apk tested on a device then the console log was (Google analytics is ready now). I checked the analytics dashboard still showing 0 users, 0 device.
Any help on this is appreciated.
That is because in the browser you are not in a cordova context.
You need to wrap that code inside a platfom ready event like so:
constructor(platform: Platform, private ga: GoogleAnalytics) {
///
platform.ready().then(() => {
this.ga.startTrackerWithId('YOUR_TRACKER_ID')
.then(() => {
alert('Google analytics is ready now');
this.ga.trackView('test');
// Tracker is ready
// You can now track pages or set additional information such as AppVersion or UserId
})
.catch(e => console.log('Error starting GoogleAnalytics', e));
});
///
}
This means this will only execute when you are in a device context.
However, you can choose to implement GA in Web way by putting the GA scripts in your index.html, import typings for GA and it should work in all platforms and environments
I'm trying to develop an apache cordova application using Visual studio tools for apache cordova and the facebook connect plugin. With this plugin i'm trying to implement login with facebook.
I installed the plugin from the option custom / plugins, introducing the git repository https://github.com/Wizcorp/phonegap-facebook-plugin
The plugin was successfully installed, the solution compiles correctly.
In the index.html I included the script after platform overrides script:
...
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="scripts/platformOverrides.js"></script>
<script type="text/javascript" src="facebookConnectPlugin.js"></script>
<script type="text/javascript" src="scripts/index.js"></script>
</body>
..
The first question is that the facebookConnectPlugin.js was not automatically included within the www root folder in the plugin installation, in this case I don't know how to the application find this script, installing camera.js plugin happened the same but i had not problems in the inclusion, it seem the browser found the js. Where must be located facebookConnectPlugin.js? Do we have to include using the plugins folder? ej:
When I debug the project and tried to launch login with the following instructions it doesn't work:
var fbLoginSuccess = function (userData) {
alert("UserInfo: " + JSON.stringify(userData));
}
function initLogin() {
facebookConnectPlugin.login(["public_profile"],
fbLoginSuccess,
function (error) { alert("" + error) }
);
}
The message I found with Ripple -Nexus (galaxy) emulator is:
"I Haz cheeseburger!
FacebookConnectPlugin.login
We seem to be missing some stuff :(
What is kinda cool though you can fill in the textarea to pass a json object to the callback you want to execute"
Summary:
Which is the src to include the facebookConnectPlugin.js?
Why I found an error with the emulator?
Best regards.
On the Firebug Lite website there is information on how to write an extension for Firebug Lite, but it doesn't say how to deploy that extension.
I read that deploying an extension for Firebug is like installing a plugin in Firefox. Is it gonna be the same for an extension of Firebug Lite?
You should be able to extend Firebug Lite by simply including your script on the page as shown on the Firebug Lite website:
Firebug.extend(function(FBL) { with (FBL) {
// ***********************************************************************
function PluginPanel(){};
PluginPanel.prototype = extend(Firebug.Panel,
{
name: "Plugin",
title: "Plugin",
initialize: function(){
Firebug.Panel.initialize.apply(this, arguments);
this.panelNode.innerHTML = "Hello World!";
}
});
Firebug.registerPanel(PluginPanel);
// ***********************************************************************
}});
To include your extension the code needs to be executed after Firebug Lite is loaded. E.g. this can be done by saving the code above into a file and include it via a <script> tag after including Firebug Lite:
<script type="text/javascript" src="https://getfirebug.com/firebug-lite.js"></script>
<script type="text/javascript" src="my-firebug-lite-extension.js"></script>