Setting silent mode at a specific area by bluetooth on android - android

I want to developing an application which can but the mobile auto silent at a specific area, for example: i will but a bluetooth device in my company meeting room and that device name with: "a", i want my App. to set the mobile into silent mode when I enter to that meeting room, can I do that? how? can you please tell me how or tell me the keys of do that? thank you in advance.

Sure, this would be possible. Your best bet is to start at the Bluetooth interfaces page in the Android API documents. You'd probably want to have a service that would poll at some interval for available Bluetooth devices searching for the one you're looking for. If you find the device, use the AudioManager to set the ringer mode.
The biggest problem is the effect on battery life. A Bluetooth discovery takes anywhere up to 12 seconds to perform. If you do that every minute your battery will be dead in no time. So you'll have to determine if that's something your users will want.

Related

How does the battery drain in Android when the phone search others?

I will make the app about searching periodically with a bluetooth in Android.
The app is operating in background and the period may be too short, about 1 min.
but i dont know how I decide that.
I heard the energy with bluetooth gets low.
So. I want the quantitative data about searching with bluetooth.
Or approximate data, fine.
Plz give a hand to set the period.

Android what is the best way to auto-connect to ble device

I'm currently trying to make an Android app that will have some interaction with a BLE device. That device doesn't have the Ibeacon protocol.
What I want to do is auto connect to that device every time it is in range even (and almost 99% of the time) when the app is not in foreground. The only thing I know is that it is a BLE device, I have access to it name and address (00:1E:C0:29:BD:F8).
It is crucial tha the app connect to it every time it come in range. Even if the phone is lock it must connect no matter what (except if the phone is shut down XD). But as soon as the phone has booted and that bluetooth is activated, I must be sure that my app will be able to connect to tha device if it come in range.
I wanted to know what is the best way to do so.
The only way I can think of is to start a service as sticky, that will scan every 15 seconds (or something similar) for the device it already has registered to auto-connect.
The downfall of that method I guess is that it will surely drain the battery, I'm not sure about that but doing a scan for 3 to 4 second every 15 second must use up a lot of battery.
What do you guys think of that ?
Does anybody know a better solution I could use ?
Thank in advance for the help.

Android Awareness of remote Bluetoth-Request with disabled BluetoothAdapter

I'd like to use android's bluetooth for some kind of sensing devices. But I don't want to connect to these devices. As far as I know Devices won't react to scanning when their own bluetooth is disabled. But is there any way to get my app noticed when such a scan has been performed by a remote device, even when my app is running with bluetooth turned off?
I don't want to force toggling bluetooth on, but I need to get some kind of Action started in other devices running the same app. So I'm wondering if some there is any description/data field that can be sent with a bluetooth scan, so if scan is rejected the app has the opportunity to read that data just to know there was this specific call?
I need to leverage context-awareness within my system as to users, not knowing each other, still can interchange content (if they agree). But I need to find some ways of sensing while I also don't want to have all sensors activated all the time.
Hope you can give me a hint, or tell me that this is simply not possible, which would also help me not spending any more time on that.
Thanks.

Android opportunistic communication vs power management (what happens to service when phone goes to sleep)

I am writing an application for android that will use opportunistic communication. So when two devices are nearby they exchange data. For now it will happen when they are in the same wifi network (using mdns) or when they have paired bluetooth interfaces.
I was wondering from power manager point of view. Will my ongoing service be paused when phone enters sleep mode? If yes how do I prevent it?
Also any general tips how to make it consume as little power as possible? I was thinking to wake it up from time to time, but then there's a chance that it will miss a mdns query sent by other device which I want to avoid to maximize throughput.
And just to clarify - yes, I do want to use opportunistic communication and no I do not want to use any solution that involves connecting to the internet.
Any help appreciated.
Use Wakelock to indicate that your application needs to have the device stay on.
but it consumes considerable amount of power.
you can also use AlarmManager to start your app at that particular time when wifi is available

Android - When scanning for bluetooth devices, is my device discoverable?

Quick question,
As the title says -
Is my device discoverable when it is searching for other discoverable devices?
Thanks
No it is not - The radio can do only one thing at a time at the very lowest level. When scanning the process is continuous utilizing all the slots and nothing is available to perform any parallel activity
Unless you check the box to be discoverable(See your Bluetooth settings) your device will remain stealth during the search .
I don't think so.
Searching doesn't require broadcasting, only receiving the beacon signals of other broadcasting devices.
Think of it like looking for WiFi. You can see the hotspots because they want you to, but you aren't really broadcasting your information in the process.

Categories

Resources