Cordova / phonegap tracking APPs install with Facebook SDK - facebook

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.

Related

Themeable browser use UIWebView forcefully with ionic capacitor

I am doing ionic application with capacitor.
I have to use https://ionicframework.com/docs/native/themeable-browser plugin for one funcationality but when I make build and upload to apple store app is rejected because of UiWebView issue.
Commands for installing themeable plugin
npm install cordova-plugin-themeablebrowser
npm install #ionic-native/themeable-browser
ionic cap sync
If I remove that plugin and upload it to apple build process pass successfully.
Apple no longer accepts new submissions using UIWebView:
https://forums.developer.apple.com/thread/122114
There is also an Ionic blog article: https://ionicframework.com/blog/understanding-itms-90809-uiwebview-api-deprecation/
You can use Capacitor's Browser API, but it is quite limited compared to some existing Cordova plugins. However it is built around WKWebView and is therefore compliant.
There is AFAIK no alternative but to move to WKWebView if you want your app to be on the Apple App Store.
I assume you are using Themeable Browser instead of InAppBrowser because you need to customize the toolbar and other components. Unfortunately Themeable Browser is no longer a supported project. In InAppBrowser version 5.0.0 https://cordova.apache.org/announcements/2021/02/16/inappbrowser-release-5.0.0.html only uses WKWebView and you can now set InAppBrowserStatusBarStyle to "darkcontent". Unfortunately, other changes have to be applied manually. I succeeded for Android and I fight for Ios :-)

Phonegap Build using Phonegap Facebook Plugin

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.

Incorporating ngcordova plugin results in errors

In order to incorporate the Toastr ngCordova plugin.. I followed the following steps
bower install ngCordova
include ngCordova in my app
angular.module('app', ['ionic', 'ngCordova'])
Install plugin
cordova plugin add https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git
Use the plugin
app.controller('myController', function($cordovaToast) {
});
This seems pretty straight forward. However I encounter the following errors:
ionic.bundle.js:21157 TypeError: Cannot read property 'toast' of undefined
at Object.show (http://localhost:8100/lib/ngCordova/dist/ng-cordova.min.js:9:20474)
I am running the app in chrome browser.
What am I missing here ?
ngCordova plugins won't work in the browser.
From documentation:
Only develop on your phone
Cordova plugins do not work while developing in your browser, because each plugin accesses a specific API (such as camera, microphone, accelerometer) which is not available in your browser. Additionally, some plugins don't work in the emulator, such as the Camera plugin, so development on your physical device is required.
In this case be sure that your application works on your device.

how to add facebook login in phonegap using android studio

i am just begginer in phonegap
i have to integrate facebook login in my phonegap app which fetches all the information of user and and his friends
after a hours of search on google i am unable to find a proper documented example
i meet with lots of plugin and example but unable to understand or getting error when executing so, can any one provide me the link or explain me for this
i am using android studio
i have installed ant, node.js , phonegap, android studio java.
for creating new phonegap project
i have done following steps
open node.js and type following commands
1. phonegap create example
2. cd example
3. phonegap build android
this creates a project folder example in my c drive with some folders named "hooks","paltform","plugins","www" and config.xml with package name"com.phonegap.example"
then i try to install facebook plugin by typing this cordova plugin add https //github.com/phonegap/phonegap-facebook-plugin --variable APP_ID="12344" --variable APP_NAME="xyz"
after this my system goes for a long batch process and comes with some error after 30-40 minutes i have attached a image of error
in facebook developer i have done following steps to make a new app registered app
1. add new app
2. then select platform android
3. skip and craete app id
4. enter captcha
5. add a display name
![error on command line][2]i didn't understand where i am doing wrong
i have found my mistake
it was in command line --
"cordova plugin add https //github.com/phonegap/phonegap-facebook-plugin --variable APP_ID="12344" --variable APP_NAME="xyz" "
**so i rectified it and change it to
cd myprojectfolder
and then
cordova plugin add https://github.com/phonegap/phonegap/phonegap-facebook-plugin --variable APP_ID="123456789" --variable APP_NAME="myFacebookApplication"**
it solves my problem
this tutorial help me a lot http://www.phonegaptutorial.com/integrate-facebook-into-your-phonegap-app/

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.