Struggling with Facebook Connect and Phonegap Build - facebook

I guess the problem is, I'm not sure what I should be putting in the settings, so any help would be greatly appreciated, as when I run the app with all the setting below I get the Facebook screen opening with an error saying :
"Invalid Scope: public_info"
Here's my app code:
Config.xml:
<gap:plugin name="com.phonegap.plugins.facebookconnect" version="0.8.0">
<param name="APP_ID" value="**IS THIS MY FACEBOOK APP ID?**" />
<param name="APP_NAME" value="**HAVE NO IDEA WHAT I PUT HERE?**" />
</gap:plugin>
index.html
I read somewhere that I need these includes, but I have no idea if this is the case in PhoneGap Build?
<script src="cdv-plugin-fb-connect.js"></script>
<script src="facebook-js-sdk.js"></script>
index.js
I'm simply trying to log the user in, nothing more:
onDeviceReady: function()
{
var fbLoginSuccess = function (userData)
{
alert("UserInfo: ");// + JSON.stringify(userData));
}
facebookConnectPlugin.login(["public_info"], fbLoginSuccess, function (error) { alert("" + error) });
}
Facebook Developer
This is where I get even more confused, so any help, as I have no idea if these are correct?
Package Name : ped-test-app-1
Default Activity Class Name : ped-test-app-1.MainActivity
Key Hashes : I created this using the keytool and openSSL, and it looks to be in the same format, but do I need to compile my app with the signing key each time?
Sorry there's so much, but like I said, any help would be really appreciated.
Thanks

After all that; it's a simple documentation error:
facebookConnectPlugin.login(["public_info"] has been superseded with:
facebookConnectPlugin.login(["public_profile"],

Related

DOMException: Could not start audio source

I'm writing a React App and I'm using Web Speech API for both speaking and voice recognition. I've written some code that works on desktop Chrome.
The way I ask for permission from the user is the following:
navigator.mediaDevices
.getUserMedia({ audio: true })
.then(function (stream) {
console.log('Succeeded');
/*Handle success*/
})
.catch(function (err) {
console.log('Failed: ', err)
/*Handle failure*/
});
However, this same code always goes to the catch callback when used from my Android phone, with the following written to the console:
Failed: DOMException: Could not start audio source
The site asks me if I want to allow microphone usage and when I go into the site settings, it says microphone and sound are both allowed, which makes me believe I've done the user interaction part well.
The site is served over HTTPS (already solved that issue), so I believe this is not an issue as well.
I'm using Xiaomi Mi 9 with Chrome Chrome 86.0.4240.185 in this test.
My first instinct is that I'm doing something wrong here? If this is the case, what?
Otherwise, what can I do to fix this issue?
Check if your Android app has required permissions:
android.permission.RECORD_AUDIO
android.permission.MODIFY_AUDIO_SETTINGS (might be optional)
You can check html or ejs file ;
you have to use in the body tags
Such as:
body
</div>
<script src="script.js"></script>
/body

Where is the ejs download for browser support?

I followed the instructions and downloaded the build linked their. After expanding the download I used lib/ejs.js which leads to "ReferenceError: require is not defined" errors. So, that's a node.js build not a browser build (?). Can't locate any browser build nor Google helps. So probably I'm complete off, but anyway, could someone enlighten me? Thanks.
From the get started section on the docs under Browser support:
let people = ["geddy", "neil", "alex"];
let html = ejs.render('<%= people.join(", "); %>', { people: people });
document.getElementById("root").insertAdjacentHTML("afterend", html);
<script src="https://github.com/mde/ejs/releases/download/v3.0.2/ejs.min.js"></script>
<div id="root"></div>
codepen

cordova-plugin-appavailability is not detecting facebook app

I am using the AppAvailability cordova plugin to check if the facebook app is installed on a device from my own app.
In order to test its working, I have the facebook app installed on my iOS device. the appAvailability.check() should therefore execute the success function however it is executing the error callback function instead. Can you help? (I am unable to post the issue on the github page as issues are closed.)
I have this in the config.xml
<plugin name="cordova-plugin-appavailability" spec="0.4.2" source="npm" />
and in my javascript i have the following:
var scheme = "fb://";
appAvailability.check(
scheme, // URI Scheme or Package Name
function() { // Success callback
alert(scheme + ' is available :)');
},
function() { // Error callback
//this is being executed even when the fb app IS installed.
alert(scheme + ' is not available :(');
}
);
Sample I'm showing is for ios. Make sure you edit the plist (platforms/ios/appname/appname-Info.plist) file for your app and add facebook.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>facebook</string>
</array>
In your androidmanifest.xml file just add the below code on above or below tag.
<queries>
<package android:name="com.whatsapp" />
<package android:name="com.whatsapp.w4b" />
</queries>

Facebook Javascript SDK: Publish actions with custom Open Graph objects

I'm working on my Cordova application to get it more viral. Therefore I want to include Facebook and the Open Graph API to publish in the news stream of playing users, when they archive new things in the game. I'm completely new to the whole fb and open-graph thing, so please help getting started with it.
I login a new user by running the following code:
$(login).on("click", function() {
FB.login(function() {
console.log("Default Login succeded");
console.log("Asking for write permissions");
FB.login(function(rsp) {
console.log("GOT WRITE PERMISSIONS");
log(rsp);
}, {
scope : 'publish_stream'
});
}, {scope:"email"});
});
I registered a Open graph action called buy under the namespace einszwo. As object I use a default object.
It is not yet reviewed, but I'm using a developer facebook account to login on my device.
Now i want to call the action. To do that I use the following code:
var obj = {
title : "I visited Google",
url : "http://www.google.com"
};
function callback(response) {
console.log(JSON.stringify(response));
}
FB.api('me/einszwo:buy','POST',obj, callback);
Unfortunately the call fails with the following response from Facebook:
{"error":{"type":"Exception",
"message":"The action you're trying to publish is invalid because it does not
specify any reference objects. At least one of the following properties
must be specified: object.","code":1611072}}
It would be really great if someone can help me with that problem or provide my some information where I can look for further information.
Thank you!
Sebastian
EDIT
The solution to just paste a url as the objects works, but we want to use Facebook hosted Objects which you define in the Facebook Object Browser. The approach is to be able to publish a activity of the user and if someone clicks on that activity we want them to be redirected to our application information page.
We cannot provide a page for every different object. Isn't there a possibility to use the Facebook Javascript SDK to use the predefined objects which are hosted on facebook?
I would really like to have a possibility like this to either create new objects
var o = {
"og:title" : "Test " + new Date(),
"og:url" : "http://facebook.com/appcenter/**APPNAMESPACE**",
"og:type" : "Object"
}
FB.api('/me/**APPNAMESPACE**:buy', 'POST', {
object : o
}, function(response) { console.log(JSON.stringify(response));});
this returns
{"message":"(#3503) \"{\"og:title\":\"Test Thu May 23 2013 12:19:45 GMT+0300 (EEST)\",\"og:url\":\"http://facebook.com/appcenter/einszwo\",\"og:type\":\"Object\"}\" is an invalid value for property \"object\" with type \"Reference\"","type":"OAuthException","code":3503}
or a way to use the ID of the predefined facebook objects like:
FB.api('1234567890', 'POST', {
}, function(response) { console.log(JSON.stringify(response));});
Can anyone help me?
Thanks!
It sounds like you are talking about an app owned object.
An app-owned object. These objects are used across your entire app. They are public, just like self-hosted objects. Anyone who uses your app can see them and they can be attached to any story your app creates.
You cannot use your appcenter url as an object (This really doesn't make sense if you think about what open graph URLs are meant for, and is pretty much a misuse of Open Graph)
You create an object in cURL or using the Object Browser
In my case I created a Leopluradon object for my coffeeshop type. Then I obtained the id (149831668534005) from the result of creation and used that in my call
FB.api(
'/me/philippeharewood:code',
'post',
{ coffeeshop: '149831668534005' },
function(response) {
if (!response || response.error) {
alert('Error occured');
console.log(response.error);
} else {
alert('Publish was successful! Action ID: ' + response.id);
}
});
A demo can be found at http://philippeharewood.com/facebook/charlie.html, it wouldn't work for you but you get the gist.
Then you can see it in your activity.
This is all explained in https://developers.facebook.com/docs/opengraph/using-object-api/
You should provide a link for open graph object, for example:
FB.api('/me/einszwo:buy','POST',{object:'http://example.com/product1'}, callback);
The linked object (http://example.com/product1) should have open graph tags:
<meta property="fb:app_id" content="133696533402323" />
<meta property="og:type" content="object" />
<meta property="og:url" content="Put your own URL to the object here" />
<meta property="og:title" content="Sample Object" />
<meta property="og:image" content="https://s static.ak.fbcdn.net/images/devsite/attachment_blank.png" />

Redirecting index.html to an iOS setting (URL in Settings.bundle) for a phonegap project

I am new to phonegap and iPhone development, and am trying to get phonegap's index.html to redirect to a JQuery Mobile site that is located externally at a settings based URL which I have in my Settings.bundle, Root.plist, Server URL. I have my index.html page redirecting to a hard coded server in the index.html file, but how do I get it to go to the URL that I have in my application settings?
Thanks in advance for any help in steering me in the right direction
I've been trying to get the plugin applicationPreferences working to essentially do something similar. Currently to no avail. As soon as I come up with a solution I will post something here again.
UPDATE
This does work it seems. There is a small, nearly unnoticeable error in the readme example.
There needs to be a comma after the 'homer'.
¬
window.plugins.applicationPreferences.set('name_identifier','homer', function() {
alert("It is saved");
}, function(error) {
alert("Failed to retrieve a setting: " + error);
}
);