I'm using PhoneGap Build. I'm using this plugin here: https://github.com/Wizcorp/phonegap-facebook-plugin only to add install tracking for a Facebook ad I have setup for mobile ads when people install the app after clicking the mobile Facebook ad.
In the Facebook SDK here under "4. Enable Install Tracking": https://developers.facebook.com/docs/app-ads/sdk
it says: "To enable install tracking call the App Events logger once your application becomes active."
In this plugin's README under Events, it says:
"Activation events are automatically tracked for you in the plugin."
Does this mean that there is no code to write, that once I only have to add the plugin to the config xml and it will automatically call FB.AppEvents.activateApp() ?
I have attempted to call FB.AppEvents.activateApp() manually using the Facebook SDK for Javascript but get an error AppEvents undefined.
If you look at the Facebook JS SDK documentation you'll find that it says...
Note: App Launches and App Installs are now logged automatically. It's no longer necessary to call activateApp to log those events.
https://developers.facebook.com/docs/reference/javascript/FB.AppEvents.LogEvent
So the readme for that plugin is correct to say it is automatic.
Related
I am trying to set up flutter_facebook_login plugin to work with my flutter app via firebase.
In the iOS section, the readme states
This assumes that you've done the "Register and Configure Your App with Facebook" step in the Facebook Login documentation for the iOS site.
When trying to set up my Development Environment I get the choice to either use CocoaPods or Facebook SDK.
Which one should I choose, and do I need to follow the install process stated there as well? (pod install in case of CocoaPods)
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.
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 question: How do I implement Facebook Mobile Install Ad tracking in Phonegap/Cordova project?
I have a working cordova/phonegap application. I would like to track the APP install using the plugin facebook. I installed the cordova facebook connect plugin with:
cordova plugin add https://github.com/phonegap/phonegap-facebook-plugin.git --variable APP_ID="myappid" --variable APP_NAME="myappname"
The plugin is installed and usable as this report 'true':
alert('fb plugin usable: ' + typeof facebookConnectPlugin != 'undefined')
However I am no seeing anything in the "Most recently logged events" in the facebook developer section for this app. I added the correct Package Name and Class Name in the settings but the events are not just showing up.
Is there anything that I am missing or more info that I can provide ? I cannot find a good tutorial on this that explains the full process.
Should the APP install event just be logged by adding the plugin without any JS call in the app?
I dug a bit in the plugin implementation and noted the activateApp was not implement at all. I cloned the repo and add the functionality for Android [following the FB guide for android ]:
The modifications required on the code are: code changes in plugin and : how to use in the JS code. In this way I can just call
facebookConnectPlugin.activateApp(fb_success, fb_fail);
where the callbacks are just dummy empty function.
and the FB is SDK tracks when there is an installation. I noticed however that the events are generated only when there is a FB app installed on the device [do not know if this is supposed to be like that].
UPDATE
Probably my solution is old, I guess that now the official plugin for Facebook has already the feature implemented directly without the need of any additional customization in the JS files or touching the Java files.
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