Java Google Alert API - java

Google does not provide any API for Google Alert create, update, list, delete operations. I need to build java application to manage the alerts with create, update, list, delete operations through program.
I have done some research in the internet and tried to put across the code in Java but does not seem to be working.
Approach Taken - Client Login into Google (works) and then Http Post to create alert (does not work), and then parse html to comprehend the list of alerts (this can be made to work - not coded yet)
I know there are few solution on the web for a fee. However I do not want to rely on other's closed source.
Any solution will be of great help

You can find a java library for creating, listing and deleting google alerts here: http://www.coders11.com/googlealertsapi/index.php
It works perfectly, the only problem is that it became commercial.

You can try this API, that is java library.
https://github.com/nnhiti/google-alert-api

Related

How to combine a standalone application with an Android application?

How do I combine a standalone Java application with an Android application?
I have a piece of code taken from the Google quick start examples that perform a task that I can't seem to be able to combine with my activity source code.
I'm of course talking about the following Google example: Sheet API, if I just add it as a standalone class and tell Android Studio to run this application, before my Android application, then it will produce what the code is suppose to do.
If I try to copy and paste the exact code into one of my activities it will give a couple of problems. One is that it can not find my keystore, another is a threading issue which I understand, another being that it can not find the credentials (even if the file is present), the newTrustedTransport-method call will be an issue, the setDataStoreFactory-method call will be an issue, file creation even with the correct uses-permissions and so on.
What is going on in the background that would make exactly the same source code work in one instance and not the other? What do I not know about Android Studio, and how an Android project works in the background for me having these issues?
I had an idea that I could just keep this standalone application as it is and store a file with the result that this Sheet example would provide me. But, since I do not have enough experience with Android Studio I have no idea if the result will be available for the actual Android application once it was made into a release. Will it? I can't save the output file generated by the Sheet example, under the res-folder, under the app module for some reason (scope?).
With other words... Can I have a standalone application, that is tasked to run before the Android application, to gather data and it will be doing this EACH time the Android application is run on a client? I feel like it would be stupid if the IDE would present this like this would actually work but then when the application is made into a release then the standalone application will not "follow" and be part of the release...
If I could just combine the source codes, I will not be having this issue at all. No examples online, neither Github or Youtube can provide me with answers on how to do this. Many examples online provide me with source code that is either out of date or just not what I'm looking for, and I really hate Google's way of explaining things. Just look at how they give code examples under this page: Google API Client Library for Java, and not give a full example where they would fit into the a project. Maybe all I need to make everything work is to use the code under "The library runs on Android 4.0 or higher (#Beta)."

Allow app to communicate with web domain

I have a domain that is user posts based. I plan to create a user posts based app like 9gag. I need the app to be able to communicate and fetch data hosted from my domain.
Things I need the app to do:
1) Allow users to post pictures though the app.
2)Allow users to leave comments through the app.
3)Allow users to leave 'likes' though the app.
I want the data to be stored on my domain, while when a user opens the app, the app will fetch this data from the domain and display it for the user. How can I make my app communicate with the domain?
Thanks!
The best way to do this would be to implement an API on your domain that your app can send requests to. I cannot explain all this in detail here because it would require a lot of space and a full blown tutorial, but I can tell you what to research and what to implement to make this happen.
First off you need to create an API for your app to send requests to. I suggest a "RESTful" api as they are pretty strait forward to the average programmer. Here is a good video that explains what an API is and a little bit of how they are typically implemented. https://youtu.be/7YcW25PHnAA
After you have an API setup, you have "encode" the information so that it is easy to parse once your app has a hold of all that information. To do this we use a "data-interchange format". One of the big ones being used today is JSON, see their website to learn more here: http://www.json.org/ JSON is pretty strait forward and easy to understand if you have a concept of what Programming: objects, strings, arrays etc are.
Ok so you have gotten your information from the server, you have parsed it from the JSON you got, and displayed all your content... now, what do you do if your user give a thumbs up or comment on something? This is also implemented via the API, this part should be easiest for you, it involves wrapping up the required data (Content id, user id, what they did [ie liked the content]) and send this via a http request, just like how you got your information in the first place, but instead of reading the data response, now we are just sending the HTTP request from the app, and we don't care what happens next (on the app level) its up to the server to record the data from the HTTP request.
I would highly suggest looking up how to create API and look through some tutorials... there are a lot of tutorials out there that want you to modify the HTACCESS file on the server, this is really necessary (Boy I hope I don't get crucified for saying that; fellow Stack Overflow Citizens, if you disagree, please explain your reasoning) Obviously for a large mainstream website, the whole HTACCESS file might be a good idea, but for a beginner, I don't think it is really needed.

Is the Google Drive web host link feature in danger of being phased out?

I am working on an Android app that stores log on a client's Google Drive. We push static HTML/Javascript files to said Drive in order for the user to be able to read their logs in an user friendly way via their browser. This feature worked relatively well until now (notwithstanding some glitches due to server updates in the last few months).
2 weeks ago (.e. from the beginning of October 2014) we saw that the newer user interface of Google Drive has dropped the web host link capability altogether. For legacy accounts this feature is still there, but not for newer created accounts from the aforementioned date.
Does that mean that Google is planning to ultimately drop this feature, or is it going to be available for the foreseeable future, even if only accessible programmatically via SDK?
Note that we tested to see if programmatic access is affected, and it seems to work fine. We used java SDK function getWebViewLink() (class File) in order to get the link programmatically, and it still works no 1 for now. But the change in UI from Google does worry us that this feature will be dropped, like Dropbox dropped theirs recently. Is that the case? If so, what is the expected timeline of feature deprecation and eventual disappearance?
It looks like they moved/changed it but didn't remove it altogether. The instructions from Google on how to host webpages with Drive worked for me using an account I created after the UI change (after you posted this question).
Since their latest blog post on deprecating APIs does not say anything about getting rid of the web host feature, you are probably fine.
If so, what is the expected timeline of feature deprecation and eventual disappearance?
If the APIs they're deprecating are anything to go by, even if they do get rid of web hosting it will be a couple of years between the time they announce it and it actually being unavailable. It's not a perfect comparison since those are entire APIs and this is just a feature but it doesn't seem like they make a habit of making something unavailable at the drop of a hat.

Youtube API impossible on android?

I've been having tremendous problems with connecting my android app to the youtube API. Firstly I tried to go along the route of using the native youtube gdata java client(http://code.google.com/p/gdata-java-client/). I had read that this could then be integrated into an android app easily enough and so I set about doing that but I would stumble every time at the line
YouTubeService ytservice = new YouTubeService("AppName",Dev_Key);
I'd enter the correct details here, even have all the necessary external jars but every time I would be given a NoClassDefFoundError reporting that YouTubeService could not be found and neither could it's superclass, MediaService. (Just so you know, I had gdata-youtube-2.0.jar, gdata-client-1.0.jar, gdata-media-1.0.jar, guava.11.0.2.jar and jsr305.jar)
So then I tried which appeared to support android (http://code.google.com/p/google-api-java-client/wiki/Android). There was even a sample example where google tasks had been integrated so it looked promising. It didn't have an actual YouTube class like it did have a taskService but it did support OAuth 2.0 login which I could work with by just sending off URL requests to the youtube API with OAuth 2.0 authentication. I tried this but when the only key I could get from it in combination with android's AccountManager was an auth key token. Posting this with the URL request to google resulted in an 'authentication required' response from youtube(because i was providing an incorrect access token, it was at least twice the size of a working access token i was comparing it with).
How can I find the access token that I need for the youtube API from the AccountManager? Or even better, how can I get the YouTubeservice to work?
Thanks
rory
Edit
Amad, thanks for the answer but unfortunately that is what i am already doing:
(source: themobilelook.com)
maybe it'll help if i supply my project folder: here it's a barebones setup, literally just to test if the YouTubeService works.
using adt 20, jdk compliance level 1.6
if you manage to create a working version then itnwoild be great if you could share it
The YouTube API library/libraries must be included in the project. By going to the Project Properties > Build Path > Order and Export tab, you can tick the checkbox next to the all YouTube-API-related libraries to ensure that they will be included in the project when you export it. Make sure to clean and rebuild after doing this.
As for the access token... not totally sure. The documentation may help there. This Google Groups thread may help also.
If you get NoClassDefFoundError during Runtime, then I suspect you did not include them to work at runtime. You have to check the checkbox for each .jar like this:
(Of course you have to add them to your java build path first)

twitter4j logins using different accounts

I am totally confused over the twitter4j API and I think I could really use your help.
I am trying to build a desktop twitter client in java using the twitter4j API but somehow I am forced to used the OAuth method no matter what.
In the simplest of scenarios I only want my user to be able to login dynamically (like in tweekdeck) and post a tweet. However, using OAuth authentication my user will be forced to go through a number of steps to retrieve his tokens for no apparent reason.
To put it simply, I don't remember doing any of these when using tweekdeck for example. How can I go around this?
Thanks in advance.
Hey I am working on the same thing right now.
My solution : embed a browser and do the authentification from there.
I am using javafx which has a browser that is already ready, and I go through the whole thing like that, I don't think you will find a better solution.

Categories