Hi
What would be a best solution to initiate the task on App Engine?
What I am trying to achieve is to send email to user every 6, 16, 30 days after the registration. This service should run independently from the app (so not user initiated).
What would be the best way to achieve this with App Engine and GWT (Java)?
Thanks.
You'll want to use the Scheduled Task API (Python or Java) or Task Queue API (Python or Java) depending on your use case. Perhaps send the initial e-mail using the task queue and then the follow-up e-mails could be generated via scheduled tasks.
Related
I've been studying App Engine for a work assignment which is to implement a chat service similar to Facebook's desktop page chatting. I had previously implemented something similar but since it ran on proprietary servers where there was no limit to traffic and technologies, I'm not sure that same implementation will work on App Engine.
Some things to notice:
This is for a web page/app. There is no specific messaging client application
App Engine doesn't support websockets
App Engine doesn't allow threads to outlive their requests (meaning I can't hold a background thread that awaits for new messages and pushes them to the user)
App Engine wants to service requests in a matter of seconds. I had thought of using long polling like facebook does but I'm not sure if this will be allowed
Is long polling every 30 seconds even an option? I'm afraid it massively increases my traffic costs...
I looked at XMPP but I think it doesn't really apply to web applications. Also I think I read somewhere in the docs that it is not/will not be supported anymore?
I'd like some advice on how I should go about this. I'm going to use Cloud Datastore for storage and I was hoping to implement this as a simple RESTful microservice to be honest but I'm not sure anymore.
You can merge goole app engine with google firebase to easily achieve a realtime chat application
you can access the realtime database on firebase using only javascript to update and display chats
Need to schedule time for sending email via javamail on Google app engine, I already tried OOP MailScheduler for this but at the end I am getting error due to it does not support for Google App Engine, it only support to Tomcat, is there any other efficient way to schedule the time for sending emails.
When you create a task and add to the task queue, you can specify when this task should be executed.
I am doing a lot of long lasting computation stuff in java and want to stay informed.
Is there any standard method ( library etc. ) to send push notifications from a desktop java program to my Android device?
When there is no , could someone provide me with some starting ideas how to write this on my own?
The "3rd-party application server" mentioned in https://developer.android.com/google/gcm/server.html can also be a desktop pc running a simple java program.
You will need to setup some IDs, an app that receives push messages, a way to display the phone registration ID so you can enter it in the desktop app.
But the rest is basically as simple as adding the gcm server jar to a desktop app (I'd use this version here: https://github.com/kurthuwig/gcm/commit/d37f4d1c37ed8deaf1a161ca7b881c1d843f80df ) and then calling 3 methods or so.
Like what zapl suggested I would say GCM is a good choice. Also, all benefits aside, if you're into messaging you can have a go at AMQP, specially the RabbitMQ implementation. You can run the RabbitMQ server on your desktop and push your messages out to all listening devices.
If I am developing an Android application, what is the most feasible way to get near real-time notifications about an incoming email? Is there a push-like mechanism, or can I hold my IMAP connection for a long time, or do I use IDLE command?
Consider that user is authorized to use GMail services via OAuth and I don't want to poll IMAP server madly.
Update:
I'm not using the phone's configured-in Google account. There is another account set up using OAuth.
I'm using Apache Commons Net to connect to IMAP/SMTP in my app. It's a bare-bone library for IMAP, but I can perhaps modify it to add IMAP commands/extensions.
You can register a ContentObserver with GMail, anytime something changes in GMail, the observer will be called.
contentResolver.registerContentObserver(Uri.parse("content://gmail-ls"), true, myContentObserver );
Override onChange in your ContentObserver to do stuff when something in GMail changes.
Since IMAP does natively provide any sort of push notifications and the Google extensions don't either, you have to implement it yourself.
One way is to use IDLE requests, which is still a cheap way to do polling. Of course, you can't expect your app to be running all the time, so you need to use a background service. An 'always-on' service is however an anti-pattern on Android and will drain the battery quickly and likely get you many 1-stars. Additionally the system may decide to kill it at any time. The other alternative is to use AlarmManager to start the service periodically, but starting it every couple of seconds or so is just as bad. So you are basically back to square one: polling.
The other way is to get push notifications using GCM or a similar service. This does require you to have a server, and the server needs to have the authentication info for the user (which might be a problem), but there are no real constraints concerning keeping open connections and sending IDLEs each second, etc. On the Android side, if you want to implement push yourself, you need to keep an open socket to get notifications. This is not very easy to do if you are not a system app (see above), so that leaves GCM. The connection it uses is manged by the system (Google Services framework), it can do things a regular app cannot, and you basically get it for free, since it's already there. It receives small pieces of data when there is something to do, called 'tickles'. Those in turn trigger broadcasts, Google Play updates, etc.
So, take your pick. Or just give up, register the account and use GMail and its labels Android API.
I'd check out Google Cloud Messaging (GCM):
http://developer.android.com/training/cloudsync/gcm.html
My understanding is that this works without requiring the user's Google account, and lets you handle authentication.
See a tutorial here:
http://www.techrepublic.com/blog/app-builder/implementing-googles-cloud-to-device-messaging/428
You would need additional server-side code running to do this though.
I am having a a method which listens continuously to a stream from a server and writes that data to datastore in google app which is later on retrieved by other methods.
How can i do that in google app engine i.e calling that method one time during the starting of app and having it running for unlimited time without affecting other things.
I am new to java world,So please help from that point of view also.How's that done in Java?
Specific for the google app engine you would use a task. However, on google app engine tasks are limited to 30 seconds execution time or anything that runs on appengine, like a http request. This means you are limited in running long running tasks.
See: http://code.google.com/appengine/docs/java/taskqueue/overview.html