Launching an app with bluetooth - android

I am working on an android app that needs to be able to toggle a setting on one phone after a bluetooth message from the other. I need to know how to make it so that when the message is received, my app opens to handle the request. Similar to how nfc tags work, you can launch an app with it, then read the data on the tag. I need to be able to launch my app, then read the data inside the bluetooth message. Thanks for the help.

The message can't launch an app directly, you have to design a background service wich listen bluetooth message and trigger the app.
Moreover, you can start this service at start up with a broadcast receiver

Related

Is it possible to trigger a notification in another android phone using broadcastreceiver?

I'm new in android development, and need some help and guidance in triggering my notification in my application. I manage to read some documentation about BroadcastReceiver where in it broadcast an announcement and another app can receive that announcement and trigger something to happen(like popping out a notification). I tried doing it, wherein I have 2 (two) application in 1 (one) android device and it worked. But when I try separate the 2 (two) application and install it separately into 2 (two) android device and try to send the broadcast, the receiver didn't manage to receive the broadcast. Then I tried to do more research and saw that BroadcastReceiver is a "System-Wide" broadcast, means (correct me if I'm wrong) it will only work inside 1 (one) android device. So my question is now, is there anyway to make the BroadcastReceiver send the broadcast in the network so that if an android device with a receiver can receive the sent broadcast? if it's not possible, is there another way to trigger notification in 1 device using another device w/o using the FCM/GCM?
PS:
The reason why I don't want to use FCM/GCM is that I'm trying to do this in an adhoc network, wherein internet connection is not present. And I'm not sure how FCM/GCM will behave w/o the internet connection. I appreciate any help. Thanks you.
You can setup a server in a background service on one of the devices and send data to if from the other device, and then have that service create a notification when it gets data.
If you want the devices to automatically be able to discover each other try using the network discovery service. https://developer.android.com/training/connect-devices-wirelessly/nsd.html

Receive Android GCM after restarting phone (without running related app)

I'm guessing this is a really rookie question, so I'm hoping someone can steer me in the right direction quickly & easily.
I have an app that receives GCM messages. The code that contains the GcmListenerService-derived class is located within my app. Because of this, the user MUST run my app after starting their phone in order for my listener to start listening (verified by restarting my phone, sending a test from Postman, and NOT getting the message / notification until I launch my app).
Do I need to create some type of service or something that will allow my app to get new GCM messages, even after restarting the phone (and not launching the app)?
Thanks!
Yes. You will need a broadcast receiver which listens on the BOOT_COMPLETED broadcast message and launches the push notification service. However, you still have to start the app once to register the receiver. It will also not work if the user force quit the app. There are some approaches, which also will restart the app automatically if the user killed the app, but I think it is a bad practice. In some circumstances the user wants to stop the app and keep it closed.

Message Broadcast simulation in Android

I am developing a POC Message client in Android. This app mimics a messaging application, there is no server interaction. The application starts a new chat with a random user. I want to use Broadcast receiver & message object ( as in a real application ). As there is no server interaction, I want to create a Broadcast sender part in this app, which should randomly generate some messages; My app receives these messages through Broadcast receiver, process the message & show on UI. So, while demoing, it looks like a real messaging app.
If any one knows a simulator engine app in Android which I can use instead of developing a broadcast sender inside my app, Please let me know.
Or, if any one can suggest some better idea for implementing a mimic messaging application, please advise. Thanks in advance.
You can create a service for your app which will always listen on ACTION/signal/message you want. It will activate your app if it gets specific message. And it will run always in the background so that user will never notice it. Hope this will give you a hint.

Android NFC Proof of Concept

I have an idea for an android NFC application but am not entirely sure how to implement it.
I want to be able to have an application that is always on (starts on bootup) and the user cannot exit out of the application. I want two have two phones with NFC enabled. One phone is set up as a listener, the other phone is set up as a sender. Both of these devices will have a code. Sender inputs a code (1234), and the listener has a code (123). If the sender puts the phone up to the listener, and the code is incorrect (1234 instead of 123). The device will lock. The only way the device can unlock is if the sender has the same code as the listener.
I don't want code samples.. I just want an explanation of how you would go about doing this.. and if it is possible.
Basically you need your app to start a service after the phone has booted, use BroadCastReceiver which takes action with the BOOT_COMPLETED intent. When that broadcast receiver has been notified of the boot completion you'll start the service which will handle your nfc jobs.

How to start/stop custom built application on remote Android device

I have written an app in Eclipse and now I just need to add an additional method, but I'm wondering how to do it.
Method should listen to incomming messages somehow, and when SMS arrive to device it should start/stop my current app running in background.
So, I send SMS to device with specific content in message (e.g START123) and when device receives it, content application will automatically start and perform all further tasks on it.
Any idea/coding on how to accomplish this is welcome. :)
Thanks and regards.
https://stackoverflow.com/a/8720582 do your work from a service.
Don't forget to catch on boot if your app should run after reboots.

Categories

Resources