Twitter widget in Ionic app, in Cordova

Hey there,

I was wondering if anybody has ever been successful in implementing a Twitter embedded timeline in their Ionic app?

I have been able to get it to work in the desktop browser, but when I run the app on simulator or device, the widget won’t work. I’ve done some searching and basically everywhere (Stackoverflow / Twitter forums / other sources) there are people saying it isn’t possible to get the standard Twitter embedded timeline widget to work within a Cordova / Phonegap context, for very vague reasons.

Has anybody here had any success getting this to work?

Odd, I remember a post sometime ago about doing this…not sure where it was.

Anyways, what kind of device are you testing it on? It could be a whitelist domain issue for ios.

Update:

Not sure if your using this plugin, but give this a try.

http://plugins.cordova.io/#/package/com.phonegap.plugins.cdvplugintwitter

Though it is for ios only…

1 Like

It’s iOS simulator and device specifically.

I’m using <access origin="*" /> in my config.xml. When I inspect the app with Safari I see that data is being retrieved from Twitter’s cdn, but the widget itself just won’t render.

I’ve done some digging and basically everyone seems to be stuck on this at the moment… Extremely frustrating.

Some resources:
https://dev.twitter.com/discussions/11360 (the big one)
https://dev.twitter.com/discussions/23060
http://community.phonegap.com/nitobi/topics/twitter_feed_not_working_with_phonegab_build_jquery_mobile_app
http://stackoverflow.com/questions/19927714/embedded-twitter-timeline-in-phonegap-3-1-0-application

All seem to be dead ends… :frowning:

Thanks for this, didn’t see this one yet. I’ll have a look. It’d be amazing if something like this could just work on Android and iOS…

1 Like

Agreed, I’m not too sure what the differences in implementing them are ( I’m not and Obj-C/Java guy).

Let me know how that plugin works. Seems like you’ll need to add some more native SDKs.

Indeed… And so the struggle continues…

Another approach would be to build a custom Twitter timeline on Angular, that would most certainly work on both platforms.

I’m trying to find a good starting point for that; there must be someone who has built a Twitter feed in Angular before…

Best of luck, I’ve never touch twitter’s api.

3 Likes

@coen_warmer, have you had any luck with this? I came across this video form egghead.io and thought it might be of some help.

Thanks @mhartington! I’m gonna check this out. I suspect this might not work anymore since Twitter changed their API’s a while back to 1.1. But I might be wrong. Will report back once I know more.

Yeah, unfortunately this example doesn’t work anymore due to Twitter’s API changes. :frowning:

i built this sample application integration to handle the oauth login to twitter, it is in javascript so can work on both platforms

2 Likes

Thanks @aaronksaunders.

If I understand correctly this is only for oAuth authentication, right? Will this work in embedding a Twitter timeline/search widget?

My 2 cents here. I’m planning on implementing this on my ionic app shortly just by going via my server. It’s pretty simple to get twitter hooked up to a PHP backend which I’ve done already then just make it available on an API, which I’ll do shortly. I’ll publish the code when I’m done.

1 Like

However, aaron’s solution above looks neat and prevents the need of a backend server. Looks like the full code is there in the services.js file for the twitter integration

@mattm I’m not 100% sure, but I dont think @coen_warmer wants to make a twitter login, more a general timeline for look at trending things ( like #ionicframework ), but I could be wrong :slight_smile:

@coen_warmer, did some more research on this and found this article.

https://dev.twitter.com/docs/embedded-timelines#creating

I’m going to give this a try my self and see what kind of damage I can do.

That’s right; I don’t need any authentication functionality in the app, I would just like to display tweets that have a certain hashtag. Similar (or even exactly like) the standard Twitter search timeline: https://dev.twitter.com/docs/embedded-timelines

Twitter provide a couple of 1-liner integrations which is what your link gives you access to. So if they do what you want, then that’s perfect. They provide limited customisation but if those examples do what you need, then perfect.

The old API allowed you to integrate without authentication which made client-side integration super simple. However in the newer version, now you have to create an API key. So it’s not like you’ve got to authenticate by logging in with twitter on the App, but you do need to create a key, secret & access token. Which you could then hard-code into the app settings.

This will then allow you to connect with the API and get what you need. So if you want to customise the look, do a search etc, then you may need to go down this route. But if you get it working using their examples, drop us a link. Would be great to see the results.

Hi All,

Do we have any updates to this? I am critically needing this. Hoping for some help.

Thank you