In my new app, i would like to have a text dialog where the user can enter their email address to subscribe to our newsletter and to hear of new updates, features to come.
I am already familiar with using Text dialogs in android.
My question is, when the user hits submit, i would like for the users information entered to be sent to my website or maybe written to a file on my website.
OR is there a way i can have it sent to my email some how? If i could some how add them to a spreadsheet that would also be nice.
At this point i am open to any option that would work and not to difficult to implement.
I dont own a server, but i do have a website with storage space etc through GoDaddy.
Thanks guys.
It depends on how much work you want to do, and how much security you want.
If you go with the email option, your application will need a valid email address, password, and server to send email from. This means you will need to embed those variables within your application, and it could be abused.
If you want the address to be written on a file on your website, you will have to allow FTP access within your application, which is another security concern and will increase the amount of code your application needs to work.
The best solution for this scenario would be to have a servlet running on your webserver that can securely communicate with a database. Your Android application can call an HTTP POST message to your servlet containing the user's email address, and the servlet can then save it to a database, which you can pull a spreadsheet from.
This will be the fastest and most secure way of accomplishing what you're wanting.
Related
I need to send data from a feedback form somewhere. Currently, the app pulls up a dialog that makes the user select an email client to send it with. The email is pre-populated, so I have properly collected the data from the form. However, I feel as though there is a better way to do this. I haven't worked much with data processing, so I want to know if there is a better way to process and receive the data that the app receives. Sending it in an email seems too clunky. I want the user to be able to input into the form, hit send, and have me recieve whatever they input. Any help is appreciated.
Using email is fine for such goal. Alternatively, you can post the information directly to your server using HTTPClient if you have Internet access permission.
If you have any running web site, maybe you can make http call by another thread in the app and post the data you collected from user.
I am using this method as a solution for something different and it's working fine.
I am developing a java web application using JSF and I will like to find out if it is possible for me to hold (and save) user information in an different location, say a file, and then when the user confirm their email before the date is save to the database.
I don't yet understand certain thing. What I intend to know is if it is possible to use serialization for this problem.
You need to persist the user on the database before it has confirmed its email.
You need to set him a status NOT_CONFIRMED which can be transformed to CONFIRMED.
Until he has confirmed, you should not allow the application login for users which are found, but having an illegal status like NOT_CONFIRMED.
There's no benefit in saving the user data somewhere else for most usecases.
HTML5 proposes the local storage API which permits storing data in the browser of your client. Since the user is not logged, you'll be unable to recognize him from another computer, so it's fair that the data will be available only on the browser he wrote it in.
You can then transfer the data to your server once the user is connected (htis feature is used by Google documents, offline gmail etc...). If you're using GWT, a java API is available to access the native browser API, otherwise, you'll need some js coding
Best Regards,
Zied Hamdi
http://1vu.fr
I am creating an application to access a GMail account and some other EMail accounts that are not GMail. How can I access the inboxes of those email accounts my application?
I assume the following:
You want to use Java.
You are trying to retrieve a list of emails.
You need to do this for GMail and non-GMail accounts.
You didn't mention anything about persisting the mails on your device, so I assume you want a quick snapshot of the inbox.
You didn't mention whether you want to leave the emails in the inbox or delete them upon retrieval, so you need a choice concerning that option.
You have no knowledge how fetching EMails works technically.
So first you need to decide on how to access the mails. As you need to access GMail and non-GMail accounts, it seems that accessing the mails via POP3 would be a natural fit. "Usually" this access method will also delete the mails from the users inbox, but there is an option to download mails without deleting them. Authenticating via POP3 is handled in numerous ways, so I would go for a library that does this for you.
I am neither an Android Developer nor do I have much to do with Java outside of JSF, but the Java Mail API seems to be capable of doing POP3 retrieval. And there is an implementation for Android.
Apart from that, your GUI might be missing a possibility to specify a server, a port and an option to pick the relevant encryption. You can of course "guess" these parameters from the given domain of the users email address, but you will need this information to retrieve the emails.
And of course you could also use IMAP, which the Java Mail API also seems to be capable of.
I'm building an app to let users export data from a university system. Currently, they can log in and see the data in HTML, but I would like to let people download it as CSV.
I have an app where users supply their username and password. I would like to log in to the university system and HTML scrape the resulting page. How can I do this?
I'm building a GWT app. I could either do this in Java-transliterated-JS on the client, or Java on the server.
Update: Selenium might be nice, but it looks like overkill.
You're going to have to do this from the server unless the domains are the same. You'd need to determine what the POST transaction used by the other server for the login step looks like - parameter names etc. Then you'd perform that operation and do whatever you want with what comes back. If you need to see multiple pages, you need to maintain the appropriate session cookie too so that the server knows you're still logged in on the subsequent HTTP requests.
If you have to hit another site to validate the credentials, then I'm not so sure that people should feel comfortable providing those credentials to you. That is, if you don't have rights to check the credentials directly, why are you trustworthy to receive them? I know sometimes people need to integrate with a system they don't own, so this is just a question.
First, this has to be done server-side because of the limitations on client scripting due to the same origin policy.
The typical way of handling the "screen scraping" you mention is to treat the web page as if it was an XML service. First, examine the source code of the page, then using an internet/HTTP stack, craft a POST to the correct URL and read the response using a standard XML library. It will take some ingenuity to come up with a good way to dig into the XML to find the piece you need that will be as insulated as possible from changes to the page. Keep in mind that your system can break any time that the owners of the site change their page.
Sometimes, you can't just send the POST but have to request the blank page initially in order to get hidden form values that need to be returned in the POST. You'll have to experiment to find out what it requires.
Additionally, you probably have to handle cookies as well, since they usually are an integral part of the web site's authentication and session management (though you might get lucky that the session doesn't matter between the initial POST and the first response).
Last, you may be unlucky enough that the site uses javascript to do part of the authentication work, which may require additional digging to understand how the credentials are posted to the site.
There are other potential barriers such as the site checking to see that the referrer is their own site, possible use of SSL (HTTPS) and so on.
I'm pretty sure that the protection against cross-site scripting in web browsers will mean that you can't log in to the university's app using javascript running in the web browser. So the part of your program that fetches data from the university will need to run on your server. Once you have the data, you can process it either on your server or in javascript in the browser, but I think it would be easier to do it on the server.
See http://en.wikipedia.org/wiki/Same_origin_policy
I'm not too sure about GWT, but in general, you would take the form data submitted by the user, check it against a database of username and hashed passwords. If the database checks out, set a session cookie that says the user is logged in.
In your pages, check if the session cookie say the user is logged in. If not, redirect to login page, otherwise allow them to view the pagfe.
I am working with a small webpage using java and servlets. From my webpage I want to open a third party website without showing its login page. I mean to say authenticating it from Java and entering its home page. Can anyone help me with it?
You have to distinguish between the server (your app) and the client (the browser). Even if you (the server) would authenticate successfully, the client still wouldn't be authenticated, as you have no way to pass the authentication data to the client (cookie restrictions etc.).
So what you could do is read the HTML data of the foreign site on your server and stream it out to your client. But the performance would be miserable, you would have to rewrite every single link on the pages and most of all: you would probably violate copyright laws. Don't do it!
I don't think there is a sane solution for you, unless the author of the other site agrees on a shared authentication mechanism with you.