Facebook App Invite with Cordova-plugin-facebook4 - android

I am trying to implement Facebook app invite with this plugin in my ionic application. The implemented codes are following as below:
$scope.appInviteToFriend = function(user){
var url = "";
if (ionic.Platform.isAndroid())
{
url = "https://play.google.com/store/apps/details?id=com.example.application";
}
else if (ionic.Platform.isIOS())
{
url = "https://itunes.apple.com/nl/app/example-by-ionicapplication/id1983838444?l=en&mt=8";
}
var option = {
url: url,
picture : ""
};
facebookConnectPlugin.appInvite(
option,
function(obj){
if(obj) {
if(obj.completionGesture == "cancel") {
// user canceled, bad guy
} else {
// user really invited someone :)
}
} else {
// user just pressed done, bad guy
}
},
function(obj){
// error
console.log(obj);
}
);
}
When I executed these codes, the Facebook Invite Dialog opens and displayed app information correctly. But after click next button, select friend and also click send button, The error occurs. It says "Missing App Link URL. The app link used with this invite does not contain an Android or iOS URL.Developers are required to enter URl for at least one platform.". I've attached the error details with part of screenshot. Are these wrong the URLs which are store URL? How can I set the URLs?

You need to provide an App Link instead of a web URL. This link can be statically generated using Facebook's own tools, or you can generate them dynamically server-side. You can read more about these in the documentation.
Here's a tutorial that walks through setting up an Android app.

Related

not able to pass ofl parameter in request body in REST api of firebase dynamic link?

I am using firebase dynamic links where i used their REST api to create dynamic link. I am able to create the short link by using REST api and created link is working fine on android and ios app as well as on mobile browser. But i used same link on desktop browser it is not redirecting to play store page. Firebase provided "ofl" as a parameter to provide my intended functionality but there is no documentation to how i can pass that parameter in request body. Can anyone help me out ?
{
"dynamicLinkInfo": {
"domainUriPrefix": "my_custome_domain_name",
"link": "my_dynamic_link",
"androidInfo": {
"androidPackageName": "my_package_name",
"androidFallbackLink": "https://play.google.com/store/apps/details?id=my_package_name",
"androidMinPackageVersionCode": "2"
}
"navigationInfo": {
"enableForcedRedirect": true,
}
},
"suffix": {
"option":"UNGUESSABLE"
}
}
As far as I know, ofl is used to specify a different behavior on desktop, Like to display your webpage which gives brief info about your app or to display a link which can redirect to play store.... In your case you directly want to redirect to play store, so for that you can use desktopFallbackLink and provide your play store link of app
eg:
{
"dynamicLinkInfo":{
"domainUriPrefix":"my_custome_domain_name",
"link":"my_dynamic_link",
"androidInfo":{
"androidPackageName":"my_package_name",
"androidFallbackLink":"https://play.google.com/store/apps/details?id=my_package_name",
"androidMinPackageVersionCode":"2"
},
"navigationInfo":{
"enableForcedRedirect":true,
}
},
"suffix":{
"option":"UNGUESSABLE"
},
"desktopInfo":{
"desktopFallbackLink":"https://www.other-example.com/"
}
}

How to redirect to the app store from a deep link if the app is not installed?

I'd like for users to be able to share a link (e.g. app.com/SKFLA - this is primarily because deep links on their own aren't clickable) via Facebook etc. When clicked, this redirects to a deep link app://SKFLA. If the app is installed, this opens the app - this is all working fine so far. But if the app isn't installed, I'd like to open the app store on the relevant page. Is this achievable? Thanks!
You need UNIVERSAL LINKS
Please check
IOS https://developer.apple.com/library/archive/documentation/General/Conceptual/AppSearch/UniversalLinks.html
Android
https://developer.android.com/training/app-links/
It might also require some extra server-side setup.
Not sure about native behavior.
We used third-party service like https://branch.io/deepviews/.
There is a bunch of similar services.
If someone is still stuck in this issue and needs easiest solution, you will love node-deeplink
1.) If app is installed: Calling an app through deep linking will always call componentDidMount of root component. So you can attach a listener there. Like:
Linking.getInitialURL()
.then(url => {
if (url) {
this.handleOpenURL({ url });
}
})
.catch(console.error);
Linking.addEventListener('url', this.handleOpenURL);
handleOpenURL(event) {
if (event) {
console.log('event = ', event);
const url = event.url;
const route = url.replace(/.*?:\/\//g, '');
console.log('route = ', route);
if(route.match(/\/([^\/]+)\/?$/)) {
const id = route.match(/\/([^\/]+)\/?$/)[1];
const routeName = route.split('/')[0];
if (routeName === 'privatealbum') {
Actions.privateAlbum({ albumId: id });
}
}
}
}
2.) If app is not installed: Just set up a route in your server and node-deeplink package will handle the bridging between web browser to app store when a app is not installed in your mobile.
By this, both the cases will be handled without any struggle

I have ngOauth access_token now what?

So I am trying to add a login with facebook / twitter option to my mobile app. I have installed ngcordova oauth plugin and everything is working. User clicks login, it takes them to FB, they accept the permissions, takes them back to the app, and I have the access_token object. Perfect. Except what do I do with it now? Now that I have the token I should be able to request the specific info I need (email / name) How is this done? Do I have to install the ios & android facebook sdk and the ios & twitter sdk? Is this built into ionic? can I simply use web calls? I am very confused on how I actually get user email / whatever other info I requested in the access_token after I retrieve permission. Here is my code currently
$scope.facebookLogin = function() {
$cordovaOauth.facebook("xxxxxxxxxxxxx", ["email"]).then(function(result) {
// results
console.log("Success");
console.log(result);
}, function(error) {
// error
console.log("Failure");
console.log(error);
});
}
I am getting in the success block, but now I need to know what to do with the access_token to actually get values.
This is the solution that I found that actually works for future persons
$accessToken = result.access_token;
$http.get("https://graph.facebook.com/v2.4/me", { params: { access_token: $accessToken, format: "json" }}).then(function(result) {
//this is where the user data is stored
var user_data = result.data;
console.log(user_data);
}, function(error) {
console.log(error);
});

Facebook Notification redirect to external URL

We are trying to implement a simple solution to our website developed via Flex and mobile apps developed using Adobe Air.
1) Our users would like to import their facebook friends onto website via www.ourwebsite.com and also via the Ourwebsite android, ios & blackberry apps.
2) We want to use the Facebook Requests dialog which allows users to select their friends and send multiple invitations at a time
3) When the recepient clicks on the notification he receives
in case of web, it should direct the notification recipient to www.ourwebsite.com
in case of mobile app, it should re-direct to respective appstore to download our app.
We tried several configurations but it's not working for us.
As previously said we have developed our website using Adobe Flex and our Mobiles apps run using Adobe Air. Do we need to install the Facebook native SDK's into our code?
Strangely the exact same requirement is working for www.naaptol.com and 9lessons.info.
But we're unable to achieve the same technique.
Can anyone guide us or advise if we're missing any important aspect of Facebook App & its policies.
Thank you.
Sai Krishna
So if I think I am understanding this right, you want to be able to open a link differently based upon the platform they are on. Here is some js that will do it for ios and android. If they have your app installed it will launch the app, otherwise it will send them to the app store
// if iPod / iPhone, display install app prompt
if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i) || navigator.userAgent.match(/android/i)) {
var store_loc = "itms://itunes.com/apps/youriOSApp";
var href = "yourPrefix://";
var is_android = false;
if (navigator.userAgent.match(/android/i)) {
store_loc = "https://play.google.com/store/apps/details?id=air.com.your.app";
is_android = true;
}
var app_loc = href;
if (is_android) {
var w = null;
try {
w = window.open(app_loc, '_blank');
} catch (e) {
// no exception
}
if (w) {
window.close();
} else {
window.location = store_loc;
}
} else {
var timeout = null;
window.location.replace(app_loc);
timeout = setTimeout(function () {
"use strict";
window.location = store_loc;
}, 300);
onblur = function () {
"use strict";
clearTimeout(timeout);
};
}
}

Single Sign On facebook titanium android

I am working with titanium platform, when i implement SSO in iOS, it works great whether i do it for one time or many times, it works smoothly and perfect. but when i come to Android, it work for the first time but not after that.
For example, i installed the test app on android and click on facebook login, it works for first time, but when i logged out and try to login with facebook again then it just shows the redirection to facebook app but app login doesn't happen, i tried many times and try many ways but its not working.
I have placed facebook login event listener in app.js and in somewindow.js i have facebook login button. i am doing some work after logging in facebook, means redirecting to some other window.
thanks in advance.
Actually the problem persist due to cache . we need to clear cache when you log out use below code it works fine
Titanium.Facebook.appid = "XXXXXXXXXXXXXXXXXX";
Titanium.Facebook.permissions = ['publish_stream', 'read_stream'];
var fbButton = Ti.UI.createButton({
top: 68,
width:290,
height:52,
backgroundImage:"images/login/facebook.png"
});
fbButton.addEventListener('click', function() {
if(Titanium.Facebook.loggedIn){
Titanium.Facebook.logout()
return
}
Titanium.Facebook.authorize();
});
Ti.Facebook.addEventListener('login', function(e) {
if (e.success) {
win.close()
} else if (e.error) {
alert(e.error);
} else if (e.cancelled) {
alert("Canceled");
}
});
Titanium.Facebook.addEventListener('logout', function(e) {
var url = 'https://login.facebook.com';
var client = Titanium.Network.createHTTPClient();
client.clearCookies(url);
});
Use this flag Ti.Facebook.forceDialogAuth=false;

Categories

Resources