Getting Data from App Inventor app in Eclipse app - java

Does anybody have any idea how to send data from an App Inventor app and the receive it in an app made in Eclipse.
I need to launch the app from within App inventor (already done this part) and send a string of data from app inventor to the other app and then manipulate the data in the other app.
Any help would be highly appreciated
Thanks
Patrick

So I finally figured it out.
Here is my code from both apps:
App Inventor:
In the Activity Starter settings you need the following:
ActivityPackage: something.something.Packagename
ActivityClass: something.something.Packagename.classname
ExtraKey: APP_INVENTOR_START
ExtraValue: Value that you would like to send.
This how you receive the value in Eclipse app:
Bundle extras = getIntent().getExtras();
String ReceivedValue = extras.getString("APP_INVENTOR_START");
YES. IT IS REALLY AS SIMPLE AS THAT!

Patrick's answer is the preferred one, but if you really do want to do something like Einar mentioned (i.e. open a socket) you could have your Eclipse-based app run a small HTTP server and use App Inventor's Web component to communicate to it.

If exchange of variables is impossible you might be able to do it opening à socket. If they both run on the same machine the latency would not be too high.

Related

how to create instant messaging app in android

I want to implement an instant messaging feature in my android app which will show the chat list of the current user and the conversation with each of them. I want to know which is the best option for doing so because i have heard about various feature like pusher,gcm,xmpp,etc.
I am using retrofit 2.0,php and mysql now in my app to create messaging feature,everything is working out great but but i cant figure out how to show the message received or send in the conversation instantly because for that network request call has to called every time the received or send and i have a feeling i might not be good idea as it will slow down app or something.
Any help will be appreciated
Thanks in advance
If I were you I would look at https://socket.io/. There is also a demo project for Android chat app

comunication between server, JavaFX desktop app and android app

this is a theoric question.
I want to deploy an app, actually 3, that:
-Manage a database (SQLite) from the desktop, in JavaFX, Done!!
-Server/WebApp that sends data(JSON) to several android devices.(¿Grails??)
-Android App to recieve and manage the JSON (and more things).
My doubts are:
-In my desktop app when the user chilck the "Send info to device"
the app must do a call to the service app like http://myserver/receiveJSONtoSend and the server listen the request and send the data to the device? and in the device recieve and do things with the JSON, and when the task are finished send other request to the server and the server comunicate to the desktop app. This is right?
-How the server comunicate with the desktop app? by suscribing like a listener?
Sorry abot my english and my non especific question, if some extra information is needed tell to me please!
Thanks a lot!!!
Since Java is painfully object oriented its often a good idea to use a JavaRMI engine for Java to Java communication.
#mod: I see this as a comment, but can't put it there on my own. Thanks!

What is the established way to request data from an android device

I currently have an small application that I have been using to learn java/android programming. Right now I have a setup were the app on one phone sends a request (via sms) to another phone running the same app. The remote phone receives the request and sends back some info. Next I would like to try this from the web. Is there an established "best" way to to this?
I was thinking I would have a web server send requests to the device via google cloud messaging and then have the device return the data directly to the web server. (Not that I really know how to do any of that just yet).
I see that there is a google cloud messaging return path (send messages from the device to the google cloud server, but it seems very new, do I need something like that? The main thing I want is to be able to ask the phone to do something when I want, not have it poll to see if there is a request, or just periodically update some status.
UPDATE:
Thanks to the answers below for confirming to me that I was on the right track.
I now have some basic functionality.
I started out using this gcm android demo code
https://code.google.com/p/gcm/source/browse/#git%2Fgcm-client%2Fsrc%2Fcom%2Fgoogle%2Fandroid%2Fgcm%2Fdemo%2Fapp%253Fstate%253Dclosed
and this ruby gem
https://github.com/spacialdb/gcm/blob/master/README.md
between the above two I was able to send a message to my phone pretty easily.
To get the round trip working, I setup a very simple rails app on heroku.
I included a modified version of the sample code in the gcm gem in a controller and then used
HttpPatch (needed for rails 4) to send a post/patch from my phone to my web app, the controller then echoes the message back to my phone.
I guess it would be nice to get the two way gcm stuff to work, but I am not sure there are any gems that handle that, and I am not qualified to handle a task like that :)
I would say it's the right call: Google Cloud Messaging for Android
From the site Android Developer:
This could be a lightweight message telling your app there is new data
to be fetched from the server (for instance, a movie uploaded by a
friend), or it could be a message containing up to 4kb of payload data
(so apps like instant messaging can consume the message directly).
In this case you don't want to fetch data from the server but you want to send them.
You can send them in different ways. I would suggest, since you are learning, to try a RESTful solution using one of the implementation of JAX-RS.
As a short and direct answer for beginner : GCM (Google Cloud Messaging) would solve your issue. However, if your app turned out to be something bigger, other more technical and complicated solutions are present too.
see this link.

Syncing Android and Server

I don't know what this is called, but it is something like syncing android application and a Web server. Examples are RSS Feeds and Weather Forecast
Does anyone know the concept behind developing application? I mean how do you sync the Android phone with a web server. Is there any programming needed in the server side and the client side(Android)
Are there any programming books that tackles this subject? Thanks.
What should I do to connect to Server from eclipse - Android?
check the whole conversation here
The server should make the data available in a meaningfull parsable format (for machines). For example RSS/XML feeds, etc. Your application should poll frequently and updates the status/screen.

sending message to my cell using Java application

I have written an chat application in java, now I like to update my application whenever user registers my chat application I should get a sms on my cell.
I am not getting how should I start with messaging service. Let me know any ideas or links.
Thanks
The solution is fully explained here (it even provides an example application available for download with source):
http://wiki.forum.nokia.com/index.php/How_to_Send_Text_SMS_in_Java_ME
Unless you've already know how to write Java MIDlets, I've explained the "startup"-steps here:
how can I create an application for mobile phone with .JAR extension?

Categories