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 ......
Related
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 created an own cordova plugin for use in an Ionic 3 project.
The js-module requires other npm/node packages (in my case for XML processing).
e.g.
var builder = require('xmlbuilder');
I read X articles about hooks and other crazy stuff, but nothing really helpful.
Is there no easy way to add such a trivial thing to the build-chain just by some simple configuration of the dependencies?
Edit:
Let´s take that simple plugin as example: https://github.com/don/cordova-plugin-hello
The great function in https://github.com/don/cordova-plugin-hello/blob/master/www/hello.js should be able to use the xmlbuilder.
So I changed the file to:
/*global cordova, module*/
var builder = require('xmlbuilder');
module.exports = {
greet: function (name, successCallback, errorCallback) {
cordova.exec(successCallback, errorCallback, "Hello", "greet", [name]);
}
};
I added the module via npm install to the ionic project, but that doesn´t help. How can I make the modules somehow available for the plugins?
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
I would like to add com.phonegap.plugins.facebookconnect as a dependency to a meteor package.
Normally you add it with this code:
Cordova.depends({
'com.phonegap.plugins.facebookconnect':'0.10.1'
});
but this gives me this error, since the app needs APP_ID and APP_NAME set on install.
Failed to install 'com.phonegap.plugins.facebookconnect':Error: Variable(s) missing: APP_ID, APP_NAME at...
(adding the plugin w meteor add cordova:com.phonegap.plugins.facebookconnect#0.10.1 works w/o errors )
Use App.configurePlugin inside the mobile-config.js file to set an APP_ID and APP_NAME: http://docs.meteor.com/#/full/App-configurePlugin
App.configurePlugin('com.phonegap.plugins.facebookconnect', {
APP_ID: "asdfasdgsdg",
APP_NAME: "sadfasdfds"
});
I'm having a problem simply loading the Facebook PHP SDK (v3.1.1) as library in CodeIgniter 2.0.
1) I've put the latest Facebook SDK files ('facebook.php', 'base_facebook.php', and 'fb_ca_chain_bundle.crt' ) into my application/libraries folder.
2) I've changed the filename of 'facebook.php' to 'Facebook.php'.
3) In my controller, I have the following code:
$fb_config = array(
'appId' => 'XXXXXXX',
'secret' => 'XXXXXXX'
);
$this->load->library('facebook', $fb_config);
$this->load->view('home_view');
But I just get an error and the View does not get loaded.
If I comment out the line
$this->load->library('facebook', $fb_config);
then the View loads correctly, so I know the problem is here.
4) If I try to autoload the facebook library, I get similar results.
Can anyone help? Thanks.
I figured out the problem.
I was missing the PHP cURL extension, so the code aborted in the “base_facebook.php” file when it checked if I had cURL installed. Not sure why I did not see any sign of a PHP Fatal Error.
After I installed this package, all is well.