Hi guys could any one help me a little bit, I'm making an android app, for cabs request, but I need a way to send to the driver app, an alert where he accepts the invitation to pick up the client, if he choose the accept button, and alert pops up on the client app telling him that the driver is on the way :) Thanks, I think i need for Threads to me always watching for these client notifications.
You can use Socket programming. This is an example where it shows how to communicate between two android phones.Example shown in emulators
http://examples.javacodegeeks.com/android/core/socket-core/android-socket-example/
This question depends on a few factors. Whether there is a server to control the communication mechanism or not. Whether the devices are close to each other. Whether there is a network oriented method like SMS allowed to be placed and so on. To minimally answer this, the following could be the easiest way to communicate between two Android devices.
If the devices are close to each other, use Bluetooth
If the devices have a server to connect in between, use an Android service to take the connections things to the background
If there is an SMS/Call based connection between the devices, use Intents and Content providers to further deal with the data.
Related
I’m not sure if this is the right place to ask this question as this is my first question, but I have the following scenario and I need advice and guidance. Or, if this is the wrong place to ask this question, where should I post it?
I want to create a Java Bluetooth proxy application that will sit in the middle of an Android app and a bluetooth IoT device. I want this Java application to see all the traffic that is being exchanged between the app and the IoT device. I have found similar applications called btproxy and btlejuice, but I want to implement it within Java and I want it to be really simple. I have looked into Bluecove but I'm not having much luck. I’m guessing I will need 2 different machines or VM’s so I can use 2 different bluetooth adapters.
Basically, when you connect the Android app to the computer/VM, the data will be logged and it will be sent to the IoT device. The IoT device will then process it, and send its data back to the Android app via the computer/VM. I’m guessing this relies heavily on the UUID of the app and the device?
Is this possible to achieve, if so, have I got the right topology for this scenario and what would be the best Java API to use and is there any code that will help?
i am trying to realize the following scenario and am failing to do so since about a week.
I have a bluetooth mouse which i'd like to connect to my android phone and use it in an app. The problem is that i don't want to use the built in HID protocol because it has some limitations i don't like (especially swallowing signals when to short and stuff like that). In optimum case i want the app to start, open an inputstream to the already paired and connected BT mouse and add my listeners to it.
Well what i did achieve to do is, given that the device is NOT connected to the built-in android BT Manager, get a BluetoothSocket, connect to it and add my inputstream to it. Problem is: If the user decides to use the OS features to make the connection, my app fails. Also i have to etablish the connection (by clicking the BT-button on the mouse) with every app start. I currently open the connection by using java reflection to call "createRfcommSocket"and then connect if getInputStream().available() fails.
How can i directly read the data of the BT device, without using the HID protocol? It doesn't matter if the mouse-functions still work or not.
If such a thing is not possible, i'd like my app to remeber the pairing process with the app. Meaning: When i start the app, i want my last pairing to reetablish automatically (without pushing the connect-button). Android itself is able to do it (I turn on BT, click on the mouse left-button -> the mouse connects).
I would really, really appreciate every hint you have for as i'm desperate.
I am designing a simple Android application (might be ported to iOS in the future) where I want to have real-time communication between multiple devices. The procedure is that one device(creator) makes a "lobby" that have certain ID, using this ID other devices should be able to join this "lobby" and wait for messages from the creator. Then clients connected to the "lobby" should be able to respond to the messages from the creator. The connection should only be active for couple of minutes and no need to store the messages on the server side.
I am not sure what methods I should look into to archive this functionality. I have looked at comet, but I am not sure if that is the way to go for this project.
Have anyone solved similar problem? And if so how did you do it and what libraries/frameworks did you use?
I want to make one desktop application for our college so that it can be use in the way so that when we want to send update about the college fest it can be directly reached to all the person who have the desktop application in java.
For android we have the GCM concept. Is there any method for the desktop application also?
I do not want to use polling here .... So please tell me any suitable method how to do this?
Not without running a server of your own. GCM is a particular service that Google runs free of charge to encourage developers to use the Android platform, and it works by having every Android device make a TCP connection to Google and keep it open all the time waiting for incoming messages. You'd have to have your own similar server.
You could use a JMS publish/subscribe topic, but in this case, it is almost certainly a better idea to let the client poll for updates in JSON or RSS format. Is there a specific reason you don't want to poll?
Idea: create a remote control for your android phone.
Why: I like listening music on my phone in a dock station with speakers connected. Now sometimes I want to turn the volume up/down, change the song, etc. So I need to unlock the phone, locate app that is playing music (Music player, internet radio app, etc.). Sometimes I manage to undock the phone or just mess something up and generally this s*cks.
So I would like to control my phone (on a data connection, not wifi) from the laptop (on wifi).
I had investigated couple of approaches and would like to get some recommendations on them:
Use XMPP. This is nice as there a lots of free XMPP services I can use. Two libraries (both based on smack) that I tried work just fine (Flow aSmack port and Beem smack port). I could automatically create new user on device and present some id/password combination that I (user) would enter on a desktop side to link both devices.
Use JXTA. Should be the next real deal but could be an overkill. I would imagine running a rendezvous&relay server somewhere (need to get hosting to work around firewall/NAT) and creating a peer group protected with password. Use device unique id and password (withing group) to link to the desktop application. (A great eBook explaining p2p and JXTA can be downloaded from here).
Use C2DM. Could be the answer, but notification delivery sometimes can take more then couple of seconds to deliver and there would be no feedback mechanism.
So far first solutions looks like a lot easier choice. Create custom extension or just create chat between both endpoints and use that for relaying commands/messages. But I wonder if I would be abusing XMPP system?
JXTA sounds great, but from all the reading I done it is apparent that it is designed for group communication and service sharing and not a solution for connecting two endpoints.
What do you guys think? I welcome all suggestions too.
UPDATE I do not want to remote to a phone and interactively control it. I want to establish a connection (socket connection) between laptop and phone even if both of them are on different networks secured behind firewalls, routers. With this I could define a protocol to issue commands to the phone (lower volume, mute, start app, etc.).
UPDATE 2 I'm giving JXTA a shot. It is a nice solution but lack of documentation is a bit of a downer. Got VPS FreeBSD server to test RDV/relay side of things. I keep updating this question further as it may be helpful for others.
UPDATE 3 Some more reading:
How to make two android devices to communicate through TCP
Connection between two computers without opening ports using a third computer
UPDATE 4
So far I did not have enough time to further continue my project. I did find an interesting project. At the moment project owners are re-writing their library, you can track their progress here.
why do not you try installing VNC server on machine and then use VNC client on laptop to access mobile
Mobile Shell (Mosh) maybe just the tool you are looking for. I have been looking for a good project to use Mosh, your idea seems pretty interesting :)