Showing data from a Website - android

i am fairly new at developing with Android but am trying to learn to learn new things:
I wanted to build a simple app that would take data from a website and then show it on the app. I considered using WebView but WebView seems to just put a browser within the app.
I understand that an app such as this would have to 1) Communicate a login and password and pass it to the website and then 2) show the data in the app
What i wanted to do was integrate the data into the app. Another question is if there are any implications regarding this type of app because a user would have to log in using a Username and Password.
So how could I go about this(i just need some general pointers, what to use, etc.)
Thank You!

You can use an HTTPClient to execute a POST function to return the html data from a webpage. You would only have to provide login credentials if the page you're trying to access is username/password protected. A simple tutorial on this can be found here
http://argillander.wordpress.com/2011/11/23/get-web-page-source-code-in-android/

Related

GroupMe API Callback

So, I am trying to use GroupMe's API. The issue is that I don't really know how to get the users access_token once I send them to the site to login. I don't really know how to create a callback or how to use it. So to sum it up
I need to send users to this site
https://oauth.groupme.com/oauth/authorize?client_id=CLIENT_ID,
then they login and groupme sends them to here
https://YOUR_CALLBACK_URL/?access_token=ACCESS_TOKEN.
But I don't know how/where to create a callback url. Then I don't know how to send that access_token back to the app.
Thanks.
A callback URL is simply a url exposed by your app that groupme can redirect users to. The page can be anything, however, oftentimes it takes the user back to your app if it is a webapp, or tells the user to close the page.
The important part is that the url is one that the app controls, so that it can get the contents of the url that contain the token and other data.
If you are writing a web app, then the framework or language should a method or variable you can call or read to get the url. If you are writing a desktop/moble app, one way of creating a callback url is to listen on a tcp port and speak http to the browser. Another way is using a lightweight web server library, or use a lightweight external server like lighthttp and communicate using cgi/fastcgi. All that matters is that you can get the url that groupme se,t the user to.
If you need anymore help, you are using Oauth2 so search for help with that. Nothing that you asked about here is specfic to groupme, so you should be able to use any OAuth2 library.

Facebook SDK for Android: Trying to get a notification when one "likes/comment" the post made by my Android app

I'm fairly new to Facebook SFD for Android.
What I'm trying to achieve is an Android app that uses facebook login, post to the user timeline and gets notified whenever one is commenting or liking that post.
I went thru Facebook tutorials for login and for Publish to Feed.
All went well.
Now I'm struggling with the last part. I don't see how to be notified whenever there is a like or comments. I browsed the web and stackoverflow forum without any success. I'm guessing that there is a mechanism to be notified by Facebook and that I don't have to start a process just to monitor the post...
Anyone could give me a hint on the API to use?
I'm currently looking at "Creating Object Types" section Associating Actions with Object Creation (https://developers.facebook.com/docs/opengraph/creating-object-types) but it looks like this describes how to do for facebook web app, and not for android app.
EDIT
I've found this https://developers.facebook.com/docs/graph-api/real-time-updates/ but not quite sure how to "translate" this into Android coding.
If anyone could help me with this, it would be greatly appreciated.
I guess you have to create a page in php that will handle the responses from Facebook, it starts with a
GET response from Facebook that you retrieve with $_GET["name"] in php, and you have to send back a confirmation to Facebook to confirm that the connection works, and Facebook will send you the answer you want via
a POST request ( $_POST["name"] ) (with a json object, containing the informations about the user in object for example, and the different updates in entry).
You can put all these informations in a database, and when the user start your application, you can automatically connect him to a php script that check if the database has new informations for him.
(specifying who he is, with a user variable that he keeps in the memory of his device, and then you ask for informations from the database about this user). I haven't tested, but it should work.

Recommended way to login to a website through an application

My application has to login to a website by posting a form, and keep track of the cookie provided till the application is terminated.
I have achieved this using the "WebView" class. I have doubts on weather this is the most efficient way to achieve this as I do not wish to display any webpages but Simply submitting another form once logged in.
Is their any other solution/Classes that can handle this with less traffic (smaller footprint)?
You can submit data to the login form just as you can to any other.
Using the HTTP library you can add a payload (of type x-www-form-encoded) to a RequestEntity. The JavaDocs are fairly clear on how to do this.

Authenticating Android User through CakePHP Auth

I know this is a general question and specifics are better here, but I don't know what specifics to ask yet.
Firstly, does anyone in the community here have experience with building and Android app that authenticates through a CakePHP site that uses the Cake Auth component?
I am currently walking through this tutorial Android Login and Registration with PHP, MySQL and SQLite and I am able to get it to do some things. When trying to login from my app I am getting a "Incorrect username/password" which means that I am making connection to my Cake application, but cannot get any further.
If you will notice in the instructions and the files it handles a value for $salt which has a specific value in the DB they tell you to create. Well with Cake you already have a users table tied to Auth and the $salt value is used by all users and not specific. Any ideas about how to get around this??? This is where I think my glitch is coming from.
Configure a login action that takes the posted login form sent by your login activity, and if login successful the action redirects you to an XML view or json view, inside your android app you parse the result and welcome the user. Sounds good:-)

How to find the HTTP Post URL and parameters of a website to parse in Android

I am trying to interface multiple accounts into a single one. I mean, consider you sell your own stuff at Sites A, B, C, D. I am trying to develop an app, such that the user has to enter his credentials in the settings screen, and from then on, the app automatically logs into each of the site, and parse the HTML to get the balance.
The issue here is, I don't find any API for any of the sites. So Can i open the source of the Login page, and use it to find the HTTP Post URL and the username and password field name tags and use it as normal post? Will it login? Have you ever tried such thing.
You help would be greatly appreciated.
Thanks,
Nithin
Use Firebug in Firefox or (Tools->Developer Tools in CHrome) to find out what is sent as POST parameters & then simulate the same in java.
I wrote a simple script to send SMS using a website and wrote on howto simulate logins. You can have a look at it here. It uses python but gives an idea of how is it done.

Categories

Resources