When DZ.getLoginStatus() returns response.status: 'unknown' I know the user will get the 30s preview because the user is then not logged-in to Deezer at all. However, when the user is logged-in but has a Discovery Premium account, how do I detect that the user will get the 30s preview? response.status = 'not_authorized' tells the user did not add the app to Deezer, but it does not explain the 30s preview right?
Found a solution. The player_position event also passes the length of the current track. In this case it says 30. So when the first player_position fires and the length in this event is 30 seconds AND different from the duration of the track metadata I have to apply the offset as explained here: What is the offset of the 30s Deezer previews?
Related
somebody could point me some information as to implement the activation of the reminder, for example in the image I establish the hour and frequentia in which I want to repeat the reminder (daily, weekly, monthly, without repetition) There I must make the query to know when the period expires which was scheduled the reminder and thereinididicar with a push notification that said reminder was culminated.
The detail I present is to query the mongo when the app is closed the query can not be performed to verify the status of the reminder. Think about doing background mode with hybrid: background, but maybe it can affect the battery consumption of the phone because of the amount of reminders the user can create, they will constantly be consulted on the state of the app.
If someone has a method I thank you for pointing me some data.
You can setup a cron to initiate an action after x units of time.
In meteor you can use this cron package.
As higlighted in the docs, you can schedule a task to launch after certain time, or after every x mins or so.
SyncedCron.add({
name: 'Crunch some important numbers for the marketing department',
schedule: function(parser) {
// parser is a later.parse object
return parser.text('every 2 hours');
},
job: function() {
var numbersCrunched = CrushSomeNumbers();
return numbersCrunched;
}
});
Once the task is triggered, you can send a push notification from the server to the client app. This will work even when the app is off, as the jobs are done on the server.
I would like to keep track of the amount of times that a user has logged into the application to either:
Remind them on their first visit to complete their profile
If profile is not complete, every X amount of visits remind user to complete
I'm not sure if the proper way to do this would be adding a key value to the users collection, or tie login to a new collection which counts up one each time a login occurs.
Is there a built in method to keep track of login successes?
Yup. You can even keep track of login failures.
From http://docs.meteor.com/#/full/accounts_onlogin:
Accounts.onLogin(function() {
// track successful login here. You can just use Meteor.user() to find out which user.
});
Accounts.onLoginFailure(function() {
// track failed login here.
});
There is even a "validate login attempt" method where you could potentially screen your users:
Accounts.validateLoginAttempt(func):
Accounts.validateLoginAttempt(function(loginInfo) {
// loginInfo.user returns a valid user object, if logged in successfully. Maybe tie this one to a collection, and do some checks etc.
// you can even use loginInfo.connection to see where the user has connected from (e.g. IP address.. perhaps)
return true; // return false if you want to 'bounce' this user.
});
Note: These can be done server-side only.
My application(game) has been running on Facebook for some time. I start by requesting a friends list via the graph API call: my-uid/friends
asking for user name and profile pic.
Normally I get back a list of all my friends up to a few thousand, until it starts putting friends on to the next page. Which is nice as most of my users get friends in 1 call.
Suddenly however, and with no changes to the app. about 40 minutes ago (18:40 Tuesday (PDT) - 2nd May 2012) I started getting responses with only 25 friends per 'page'!
I can still get my whole friends list using multiple calls, but the game is not currently set up to do that properly. Can anyone tell me why the sudden change? Anyone else seen similar problems and how do I get the list to give me up to 5000 friends per page like it used to.
Reproducible using the Graph API Explorer
I don't know what else to tell you; perhaps the default number returned has changed, but when I try, a call to /me/friends?limit=5000 returns the full list for me (but my friends list is >500 and < 1000 , so maybe it cuts off somewhere along the way)
(Side note: the average number of friends has been found to be ~190 so presumably most users will have less than 500 anyway, and having to page above 500 would be an edge case
In SDK 4.7 you need to pass in a bundle with the number of friends you want to return, I have set it to 5000 as this is the maximum number of friends you can have on Facebook.
You also need to set up your app as a game in the facebook dev console and use invitable friends to get a full friends list
Create your bundle
Bundle bundle = new Bundle();
Add params to your bundle
bundle.putInt("limit", 5000);
Then pass it in to your GraphRequest
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/me/invitable_friends",
bundle,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
//Do something with the response
}
}
).executeAsync();
It seems that facebook changed its limit to 25 results in other api calls too (feed, posts, friends, etc), if you request friends without parameters the JSON response shows the following:
"paging": {
"next": "https://graph.facebook.com/USER_ID/friends?format=json&limit=25&offset=25&__after_id=LAST_ID"
}
Anyway you could/should always set limit & offset parameters to prevent this kind of things, limit = 0 will return all your friends list.
https://graph.facebook.com/USER_ID/friends?limit=0
If you are only requesting friends from a normal user the maximum number allowed is 5,000 so the limit should could be either 0 or 5,000 if you are requesting info from a facebook page or other kind of api calls like posts or feed this limit could increase or decrease.
(Update) Facebook fixed this bug so setting limit to 0 returns 0 friends, you should set a positive limit, thanks Dinuz
I think the best thing you can do is to add limit=5000 parameter as Igy says.
However I posted a bug report since this change wasn't noticed or described in the document.
The number of results returned from the /v2.2/me/friends endpoint now defaults to 25.
Friend list now only returns friends who also use your app: The list of friends returned via the /me/friends endpoint is now limited to the list of friends that have authorized your app.
See Facebook changes
Facebook API change log
If you are using GraphRequest() (e.g. in React Native), you can put it directly in the string field, like so :
new GraphRequest(
'/me',
{
accessToken,
parameters: {
fields: {
string: 'id,email,first_name,last_name,friends.limit(5000)'
}
}
...
Just a quick question to make sure i'm on track -
I've started supporting a ready FB app.
Yesterday the client reported an issue with a part of the app which uses the fb JS SDK notification plugin.
In the callback the code refers to (this is only the callback of the entire FB.io):
}, function(res) {
if(typeof(res)!='undefined' && res != null){ // if user invited friends
var ids = res.request_ids.toString();
but when I console.log the res object, there is no res.request_ids - onlt res.request and res.to (which contains the IDs).
Can it be that Facebook changed the response object? I could find the official docs which say that i'm correct about the object - there are 'request' and 'to' properties, no request_ids - but why would it work till now? was there a change in the response object? is there a place where these changes are published in advance in order to prevent downtime?
Thanks...
"Can it be that Facebook changed the response object?"
Yes, they announced the change February of last year. http://developers.facebook.com/blog/post/464/
"*I could fin"d the official docs which say that i'm correct about the object - there are 'request' and 'to' properties, no request_ids - but why would it work till now?*"
Official documents:
https://developers.facebook.com/docs/reference/dialogs/requests/
http://developers.facebook.com/docs/channels/#requests
"Was there a change in the response object?"
Yes, see: http://developers.facebook.com/blog/post/464/
"is there a place where these changes are published in advance in order to prevent downtime? Thanks..."
Yes, you will want to read their developers blog at: http://developers.facebook.com/blog
When a request is sent using the new fbjs requests 2.0 on Facebook:
1 - a notification is shown under the globe icon in the header
2 - a incremental number is shown next to the app name on the left menu
If the user clicks the notification, request_ids=123... is appended to the url. This can be used to clear out the request. If they navigate to the app another way such as the left menu, the requests are passed. So if the user skips over the notifications, they accumulate a lot of outstanding requests.
Is there a way to get all outstanding requests for a user without relying on them clicking the notifications?
To retrieve all the users outstanding requests you can make a call as follows :
$facebook->api('/me/apprequests/');
You can retrieve all the data for all the requests (for your application) into an array and remove them from facebook.
// Retrieve ALL request-2.0's for user
$res = $facebook->api('/me/apprequests/');
$requests = $res['data'];
foreach ($requests AS $request){
echo 'Deleting '.$request['id'] . '<br/>';
$facebook->api('/'.$request['id'].'/','DELETE');
}
Now you have all the users outstanding requests in $requests and you can act accordingly.