I would like to ask if it is possible through the use of android codes, to send a request(or data) from one android device to another and having the receiver's android device to display a toast message saying that data/request is received and vibrates the phone?
-
May i know how to do it? I only figured out how to do it using notification but for toast, how do you check for any data / request received on the receiver's end? – CodeNewbie Jan 23 '14 at 12:29
-
You can do this by GCM notification – Prachi Jan 23 '14 at 12:29
-
There is not way to send a Toast, you send a "message" (maybe via GCM) and them you show the user what you want how you want it (a Toast, Notification or whatever) – s1m3n Jan 23 '14 at 12:32
-
i am actually sending data/request to another phone.. not a toast message though. But thanks anyways =D – CodeNewbie Jan 23 '14 at 12:35
2 Answers
Depending on what you're trying to do, it might be simpler to send an SMS message from one device to the other, as an alternative to using Google Cloud Messaging.
Info about SMSManager here.
There's a good tutorial on sending SMS messages here.
You could use a custom vibration (more nuanced than the standard Android buzz vibration) using the Immersion UHL, described here, and downloadable from this page.

- 4,953
- 10
- 40
- 60
You would need to have one device be aware of the other (either directly or through a central server). Having that you can use GCM to push messages to the device, and once received, show the Toast
and vibrate.
I recommend you use Android notifications rather than Toast
and the vibration let it be what the user has configured to avoid being too intrusive.
You can start by reading up on GCM: http://developer.android.com/google/gcm/index.html

- 623
- 6
- 21