0

I need that my app will send a string to another android device and on the receiving android device side i want to make something with that string.

How can I use BroadcastReceiver with the callback OnReceive() just to program the string that he will get Without using the GCM if it is possible.

Thanks.

mynavy
  • 81
  • 2
  • 9

1 Answers1

0

BroadcastReceivers are for intra- or inter- application communications on a single device. To send messages between discrete devices without a cloud-based solution (such as GCM) then you'll be looking at using the Bluetooth stack for ah-hoc networks or the NetworkServiceDiscovery APIs for devices on the same local network.

Depending on your use case, there are examples to get you going under each of the provided links.

BrantApps
  • 6,362
  • 2
  • 27
  • 60
  • Assuming he really doesn't want to use a server-based solution (not just GCM). He could also use straight TCP sockets if the devices are on the same wifi network (assuming there is no wifi isolation, like they have at starbucks coffee shops and most large hotels). He could use NFC (assuming both devices are NFC-capable). He could use a QR code generated on a screen to be decoded by the camera of the second device (although, QR codes are not my favorites). And he could also use SMS (assuming using SMS is feasible for his particular use case, it may not be of course). – Stephan Branczyk May 06 '14 at 22:26
  • Thanks. I cant use bluetooth nor local network because of the distances between the devices .... @Stephan can you explain more about the SMS .. thats sound like something i should use. – mynavy May 07 '14 at 09:17
  • 1
    @mynavy - take a look at [this](http://stackoverflow.com/questions/7089313/android-listen-for-incoming-sms-messages) SO answer – BrantApps May 07 '14 at 17:44