I am writing an app in which i am fetching list of friends those birthdays in next 30 days, and i am able to get that as well, but i am facing a small problem in my list.
Like: I have 4 friends birthdays in next 30 days, so i am getting list of coming facebook friends birthdays but not getting name of friend whom birthday is Today
I guess i am missing something in query.
Code:
Calendar cal = Calendar.getInstance();
Date today = cal.getTime();
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
String today_formatted = formatter.format(today);
cal.add(Calendar.DATE, 30); //set number of days
String today_plus30_formatted = formatter.format(cal.getTime());
String query = "select name, birthday, uid, pic_square FROM user WHERE uid in (SELECT uid2 FROM friend WHERE uid1 = me()) AND birthday_date != 'null' AND birthday_date > '" + today_formatted + "'AND birthday_date < '" + today_plus30_formatted + "'ORDER BY birthday_date ASC";
and if i will use below query, so i am not getting list of my friends:
String query = "select name, birthday, uid, pic_square FROM user WHERE uid in (SELECT uid2 FROM friend WHERE uid1 = me()) AND birthday_date != 'null' AND birthday_date > = '" + today_formatted + "'AND birthday_date < = '" + today_plus30_formatted + "'ORDER BY birthday_date ASC";
Rakesh you did everything and that is correct also:
you just need to delete : "/yyyy"
replace below line, and you done:
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd");
Are you sure gave permission for accessing friends Birthday date
private static final String[] PERMISSIONS =
new String[] {"friends_birthday","read_stream", "offline_access"};
http://www.androidhive.info/2012/03/android-facebook-connect-tutorial/
here is simple example
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.