How to do Client server communication in Android? - android

I want to send and receive information between Emulators in Android.i am using two systems and i have installed android in both the systems and i have to consider one emulator as server and another as client.Now i want to send data from one to another.Anyone knows regrading this please help me with some sample code.

What sort of information do you want to send between the emulators?
You can transmit SMS messages, or simulate phone calls, from one emulator to another using the target emulator's console port number as the number to dial. The Android Developer Site describes the process in more detail under "Sending a Voice Call or SMS to Another Emulator Instance"
If you want to transmit data, unfortunately Android doesn't currently provide any P2P or Instant Messaging APIs, so there's no generic technique available through the SDK you can use.
Your best alternative is to create your own server-based solution (or your own P2P API, though that might be a little more complicated).

Take a look at Java Socket.

Related

Is it possible to send an SMS from Visual Basic 2013 through my smartphone?

I would like to send an SMS from a VB2013 application with my smartphone programmatically. I have already found several solutions how to solve this with Windows Phone (Outlook-Windows Phone). The only problem is, that I have an android device. So my question is, do you know any idea or solution that supports android?
The workflow that I want to implement is the following:
The user types into a textbox the phone number and the text on a VB2013 app.
He/She clicks to the "Send" button, and somehow it sends an SMS from the android phone to the phone number that is given by himself/herself.
Regards,
Roland
I would say that this is not possible directly.
The problem you already found is that your Smartphone is Android and
Vb.Net needs a .net Framework with which it works.
So the possibility I see is to get a connection
via USB port to your device and send some specific commands to
make your smartphone send SMS. To do this you have to use a serial port from
my point of view.
This question has already been asked, so
please take a look at:
Sending SMS with Vb.net
The .Net framework does not natively run on Android, so no this is not possible.
However, the Xamarin framework allows you to write android apps in Visual Studio.
Specifically towards your question, Xamarin has an SmsManager class that allows you to send Sms messages, the documentation can be found here.
Hope this helps.
There are several different ways to do this, but the best one is use an api like Twilio. You can literally send an sms with one line of code. They have a nuget package which would get you up and running even faster.
Another is to use carrier mail. You have to know the users carrier and then you can create an email address that sends as a text ie. 1231234123#txt.att.net. The issue with using cellular carrier email is that spammers often use this and one minute there is a message from your site and then next is spam, since it will be coming from the same carrier.email address.

Is it possible to make two-way communication between two devices via NFC?

I am trying to provide an application which sends multiple data between two different devices via NFC. For ex: device1 sends "date" comment and device2 gets the comment via NFC communication and then device2 checks the comment coming from device1. For device2, "date" means date of today and then device2 sends response message (such as 23.05.2013 14:21:45) at the same time. Not only "date" comment, but also the other comments should be used for the communication. For ex: when device1 sends "who are you" comment via NFC, device2 should send "i am Alice's device" at the same time. Is it possible? Can i make such a communication between two different devices at the same time? Thank you for your help.
Sending data via Android Beam in response to a received NDEF message transfered via Android Beam is not possible.
Technically the protocol Android Beam is built upon (LLCP) allows bi-directional data exchange on roughly 240 logical channels at the same time. This capability is just not exposed to Android applications.
You can hope for an API update, but I wouldn't wait for it. A hidden API for this existed in Android 2.3.3 but was later removed for some reason.
As Nils said - via NFC alone, this is not possible due the the limited Android API.
However, I am aware of one way of achieving it by using connection handover. Essentially, the NFC communication is used to send some credentials to the other device that allow the two of them to connect over Bluetooth.
The EasyNFC library claims to achieve this bluetooth functionality. I gave it a try and I think I was able to set up a socket, but never properly tested it. I didn't find it too reliable and I did not want the addition of bluetooth in my application, nor the use of the "Touch-to-beam" UI.

Getting started with Bluetooth development for Android: Suggestions for test application

I have a task to integrate a Bluetooth device into my application. Now my requirement is very specific. The device has a specific communication protocol which relies on certain ACKs but I figured it would make my development much easier if there was a program that let me test communication with the device.
I was wondering if there was a program for Linux, or perhaps a simple Android program which let me communicate with any Bluetooth device with a series of pings using data I enter and simply log the responses.
EDIT: I might not have been clear enough in my question.
I have a scale that I need to integrate into my application, and the scale has a protocol similar to this:
Get a specific byte string from device
Transfer data
Transfer packet for disconnection
Receive acknowledgement for disconnect packet
Disconnect
Now when I have to issue a POST request from my application, I usually build a test script online so I can test if the POST works properly.
I was wondering if there was something similar I could do with the device.
Thanks
Your question is not clear enough. To communicate with a BT device, you need to know what profile your device supports. Depending on that, you can find a way in Android or Linux or windows to communicate with the device.
The simplest way is to open an RFCOMM channel from android/PC and transfer data to and from the device. For this the device has to support the serial port profile (SPP). If you want to do this in Android, look for the BluetoothChat example from google.
If you want to use a PC/mac/linux look at the Bluez python module. It's really simple to use. There are plenty of other options too..
I was looking for something like SENA BTerm. It lets me connect to any device and send whatever data I wish.
It is an extremely useful tool for testing my code.
http://www.sena.com/download/manual_bterm/overview.html is where you can find it.

How to send messages to android phone by using putty?

I want to send messages from android phone by using putty. Is that possible?
AFAIK, the telnet interface that is available for the emulator does not exist for hardware. You may be able to find a third-party SSH server or something, though that is not really in-scope for StackOverflow.

Transfer data between android devices

I have created an android app and would like to enable users to transfer data (e.g. over TCP). Both have my app installed. Is there any framework or guide how to use bluetooth and/or w-lan to get a good user experience? How do they initiate the connection?
Thanks!
I learned how to use Bluetooth on Android by this link, analysing the source code of the example.
About sending information through TCP/IP, use normal Java for that (Sockets, for example). The only extra you could put it is to send an Intent to activate Wireless if was not activated yet.

Categories

Resources