I am using Android 4.x and would like to send some data connectionless. I tried the Android API (BluetoothSocket) but it's only possible to send data if the device is connected. Is there a possibility to send data connectionless? This should be possible since BluetoothV3.0.
Thanks.
Related
I have been working on an app that sends a JSON object using a PUT request and I have this successfully working and saving the data on my Oracle Database. However, this is through using the emulator on Android Studio and using my computer's IP address in the URL.
I have now tried to send the request from my android device and instead of my computer's IP address I have used the localhost which was advised. Although this did not work as expected and I received no response or the database did not save the record.
What differences are needed when sending a request on an android device instead of an Android emulator??
Using AsyncTask also.. can show code if needed.
Thanks
I am developing an android application and i need to send a notification from the app to a phone number (another device).
Can anyone tell me how can i implement this? any methods or API i can use?
Thank you in advance
I don't think you can do it without developing server-side software that Android devices will connect to. In your server-side software you can use FCM(Firebase Cloud Messaging) or any other framework/library to send notifications to one or group of devices.
Problem is that you need to have connection to the other device and you can't know if that device is connected to internet and even if it is you don't know the address of that device. 99.99% that you need server-side software.
the easiest way (but the most expensive i guess) is to have the first device send a request to a server (whose backend you have to build, eg. php) that will send a push notification to the second device via Google Cloud messaging service.
that's not so easy because the second device to receive the notification must register at GCM and the first device must identificate the id of this device (the common way is to have a common id like username)
There is on possibility without using server side code, Send SMS to the second Phone and read the SMS in second phone and display your notification in second phone. It will cost the SMS charges in both phones.
Create an API that communicates with the users of the application this will be able to send updates to the registered users at real-time.
http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/
I want to use Google Cloud Messaging for my app for both upstream and downstream use, using xmpp. However I am wondering how I can select and input data to and from my MySQL database to be sent over the GCM network.
Can I use PHP with GCM or do I have to use Java or Python?
GCM is used for sending messages FROM server TO your android application. Also a GCM message can only carry a maximum of 4KB Only.
So in my opinion, send data to your MySQL db directly from the app (If you want to make this asynchronous, look into Android Sync Adapter); and for sending data from server to your application asynchronously, send a ping to your app using GCM (it can be any short message), so your app can undergo a normal http request-response procedure to get the data from MySQL.
For more information of Sync Adapters: http://developer.android.com/training/sync-adapters/index.html
And for a tutorial on a simple GCM using PHP: http://www.programming-techniques.com/2014/01/google-cloud-messaging-gcm-in-android.html
There are XMPP libraries for PHP. See https://code.google.com/p/xmpphp/ for example.
So, PHP is possible, however i would really like to hear what is a recommended approach, as im going to implement it too.
As I understand it, there are two ways to send data from GAE to my app:
The app does a request and the server sends the data as a response.
The server sends the data directly to the app without the app doing a request.
I know how to send data with (1) but how do I send data with (2)?
It seems you are looking for Google Cloud messaging which helps "Push"ing the messages from your server to your app (via GCM Service)
Read for details
http://developer.android.com/guide/google/gcm/index.html
How can I use serial communication (port) via Bluetooth to send data?
I need to send serial data through an Android device to a Bluetooth model (BlueSMiRF Silver) (that is connected to an Arduino board).
I was literally sitting for three day trying to understand how to do that...
Would be nice to have more details about what you tried and where you are stuck.
On the Android side the first step is to pair with the BlueSMiRF module. You should be able to discover the BlueSMiRF and pair from the "Bluetooth Settings" on android. You might have to put the BlueSMiRF module in discoverable mode (and you can set the a pin code for it).
Once paired, to be able to send and receive data you need to connect using a Bluetooth socket. To communicate with the BlueSMiRF module you need to use the Serial Port Profile (SPP) and create and RFCOMM socket. For an example you can have a look at this post.