1

I tried to find answer to my question without success, please excuse me if it is a trivial question....

I managed to add Restlet server to an existing Android application. It works well, serving get/put/post request as needed. The problem that on selected POST request I have to start an Android activity or send a message to an activity. I could not find any way to do it. The android context is not available within ServerResource, so cannot use intents, and messages.

The best would be to send intents (broadcast message), so I can use it for any communication.

Any help welcome! Thanks

  • you could add a static getContext() method to your application class... – Andy Dennie Nov 14 '14 at 02:09
  • First I used a trick, as the I have to write the received JSON to a file anyway, I set up a file monitoring on the main activity. Worked well. Then did the proper way, created a util class which has a static Context variable and at startup the one I'm interested registers itself to it, and there is a query function can be called from anywhere. Works well. Thanks – Zsolt Gaspar Nov 15 '14 at 17:15

0 Answers0