LikeButton

49 views
Skip to first unread message

Gareth Murfin

unread,
May 25, 2016, 10:02:04 AM5/25/16
to CodenameOne Discussions
On Android when I hit a like button I see a circular thing spinning but it never does anything after that. On the simulator it seemed to work. Any ideas why it may not work on device?

Gareth Murfin

unread,
May 25, 2016, 10:21:02 AM5/25/16
to CodenameOne Discussions
I installed the fb app and it reacted (should work without though surely?)  but then it said "cant load url : the domain of this url isnt included in the apps domains. to be able to load this url add al l domands and subdomains of your app to the app domains field in your app settings" My App id appears to be correct, so just wondering how to get aorudn this.

Gareth Murfin

unread,
May 25, 2016, 10:34:05 AM5/25/16
to CodenameOne Discussions
Went through added website platform and a url and then app domains accepted the domain but what domain do I use?  I was just entering the website address for the app but that doesnt seem to do it. The error in simulator is now " The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and subdomains of your app to the App Domains field in your app settings." I realise this is mostly FB and not cn1 but I figured there is a chance its something cn1 related too.

Gareth Murfin

unread,
May 25, 2016, 11:16:32 AM5/25/16
to CodenameOne Discussions
So I think I added it all correctly unfortunately I just see the spinning icon thing, and it goes no where. Im thinking it might be best to embed a like button using a webview and this https://developers.facebook.com/docs/plugins/like-button

Gareth Murfin

unread,
May 25, 2016, 11:22:26 AM5/25/16
to CodenameOne Discussions
Also how do I specify a page? only seems to let me specify a post? Any tutorials on this.. or is it just out of date now and slightly broken? Is it actually proven to still work. On simulator it just says i need to login buttheres no way to, on device it just keeps spinning. There isnt much I hate more than the fb sdk apart from RIM obviously. 

Shai Almog

unread,
May 26, 2016, 12:30:02 AM5/26/16
to CodenameOne Discussions
A like button will only work if you are authenticated to Facebook. Did you go thru the FacebookConnect authentication?

Gareth Murfin

unread,
May 26, 2016, 7:55:28 AM5/26/16
to CodenameOne Discussions
Ah ok will try, also can you like a page with this? or just a post?

Gareth Murfin

unread,
May 26, 2016, 8:15:01 AM5/26/16
to CodenameOne Discussions
All that facebook connect stuff is beyond a nightmare if i recall, after lots of trying I took it out. I have the code somewhere in here still but I have also commented it out saying it made my IPA huge. How much does the .ipa grows by including facebook connect etc? It is suprisingly hard to simple make a like happen on fb ;-/

Gareth Murfin

unread,
May 26, 2016, 10:03:13 AM5/26/16
to CodenameOne Discussions
ok its not as bad as i thought, not checked ipa size that might be what im remembering that held me back. But yeh, is there a way to like a fb PAGE and not just a post?

Gareth Murfin

unread,
May 26, 2016, 11:11:14 AM5/26/16
to CodenameOne Discussions
Got it all done with no errors and I log into fb fine, but then when I hit the like button I just see a spinner going. Also tried the webview approach which works but users had to log in every time. So I am thinking this is not possible at this time (I am assuming the cn1 fb wrappers are out of date, hence there is no way to like a page only a post- I believe things have maybe changed in the real fb sdk recently), I will tell client I will have to write native lib to do this. A good tutorial on adding a fb like button in cn1 that allows you to like a page would be great.

Gareth Murfin

unread,
May 26, 2016, 11:42:59 AM5/26/16
to CodenameOne Discussions
Also please let me know if im wrong, ie, if it does actually work, and it can like a page. On android its spinning out on iOS it says "the redirect_url must be absolute" this is a fb error but i cannot get rid of it. None of that matters anyway if you can only like posts. 

Native question : if I do this natively will it work? it looks like the iOS code has to actually add the fb like "view" itself to another view, see here:- will this code actually add the button to my view? and if so where? and how do I change where it goes?

@implementation ViewController
- (void)viewDidLoad {
	[super viewDidLoad];
	FBSDKLikeControl *likeButton = [[FBSDKLikeControl alloc] init];
	likeButton.objectID = @"https://www.facebook.com/FacebookDevelopers";
  likeButton.center = self.view.center;
	[self.view addSubview:likeButton];
}
@end

Chen Fishbein

unread,
May 26, 2016, 12:22:27 PM5/26/16
to CodenameOne Discussions
You cannot Like a page using the graph API, they blocked this functionality the user must click their button which means you need to display a webview which requires login.

Gareth Murfin

unread,
May 26, 2016, 1:23:49 PM5/26/16
to CodenameOne Discussions
Are you sure? looks like you can do it this way? https://developers.facebook.com/docs/sharing/ios/like-button

Chen Fishbein

unread,
May 27, 2016, 3:37:44 AM5/27/16
to CodenameOne Discussions
It seems like you can do this with a native button, you can try to use the PeerComponent to display this button in a Form.

Gareth Murfin

unread,
May 28, 2016, 12:36:09 AM5/28/16
to CodenameOne Discussions
I love cn1, but I hate wasting a week or 2 before u guys admit the functionality is broken and out of date, it has cost me literally thousands of pounds. This is a constant occurrence
 and my clients all literally say how much they hate cn1 almost every day. If you can be honest about what works and what doesnt, its gonna help. My clients pretty much hate cn1, I have to spend 2 days a week convincing them why we are not wasting our time, and sometimes even I cannot explain.........

Gareth Murfin

unread,
May 28, 2016, 12:39:48 AM5/28/16
to CodenameOne Discussions
And I say this cause I just spent 5 DAYS working on your LikeButton, which doesnt work!. I asked right at the bstart is it broken/ and I only see that it is becausei m on the gubhub list. Dudes, if you wanna make us love you more than say Xamarin, please be moremopen and honest, everyone who has left cn1 is because of the bugs and poor functionality (Ive chatted to many of them).. You got some good guys here please keep us up to date just tell me right away the like button is broken. As I say literally a thousand or more pound has been wasted on this because you maintained it was OK.

Gareth Murfin

unread,
May 28, 2016, 12:41:32 AM5/28/16
to CodenameOne Discussions
PS very angry clients, every single day they telll me im out and its being done natively.

Gareth Murfin

unread,
May 28, 2016, 12:45:18 AM5/28/16
to CodenameOne Discussions
I could do Android side but not iOS, then we got 2 coders and Im not in control. Of course that is how I calm my clients, I say hey do yoy really think you could maintain 2 code bases perfectly? And release on time? NO WAY..

Chen Fishbein

unread,
May 28, 2016, 4:28:23 AM5/28/16
to CodenameOne Discussions
Hi,
Honesty and openness has nothing to do with this, we had no idea this functionality was broken until you raised this issue.
We are a small team and we need the community help, big part of the help is identifying the issues and open the bugs in the repository.
Please be patient we are doing our best.

Gareth Murfin

unread,
May 28, 2016, 9:13:54 PM5/28/16
to CodenameOne Discussions
Apologies for this. I was very drunk, I know its no excuse but somehow that likebutton was still on my mind after 2 bottles of wine, and I couldnt shake the days I lost. Anyway Im sorry for being stupid there, I know you guys are doing your best, and I love cn1. So feeling rather ashamed of my drunken posts now :)
Reply all
Reply to author
Forward
0 new messages