Detact Emergency call signal android studio - android-studio

I am trying to detact no signal or Emergency call only for mobile network i followed Get Signal Strength in Android
But it return only values even on flight mode is there is any better way to detact no signal

Related

Is there any way to automatically accept BLE pairing request in Android 11?

I have an android app that connects to a few classic Bluetooth and BLE devices. Starting from one of the security patch releases of Android 10 I am getting pairing requests on my Android device. Is there a way to automatically accept these requests in code? The BLE devices do not have a pin and only need a certain flow of read and write operations to pair. Right now my write operations are failing unless I wait for the bond state to change to BONDED which happens on accepting the pairing request on the Android device.
So far I've tried setPairingConfirmation(true) which does not seem to be working.
I guess the idea of pairing is that the user must accept that an "unknown" device being paired to his system. Otherwise different shady apps could just pair devices in the background without the user's consent.
A peripheral that is not meant to be paired to a user should hence not require pairing in the first place, to perform various operations.

How to analyze my own transmitted Bluetooth signal on Android

I want to create an Android app where I want to be able to receive my own transmitter Bluetooth signal in Android , since Bluetooth signal is omnidirectional.
I.e. I want to receive and transmit Bluetooth at same time and receive my own transmitted signal and analyze it on same phone.
Or I tried to use beacon simulator to simulate LE beacon Bluetooth signal and in my Bluetooth setting I tried to scan for available devices but it does not show my android device.
How can I do so?
It is not possible to simultaneously transmit and receive the same packets from the same antenna systems. Theoretically, you can receive packets resulting from reflections. In the practice, this application has no right to work. Switching the operating mode from the transmitter to the radio receiver requires time.
To track bluetooth packets you can use the CC2640 dongle with the PC application:
http://www.ti.com/tool/PACKET-SNIFFER

Android Studio start activity when detected an bluetooth device by MAC Address/UUID?

I am making application that will run specific activity when detected an bluetooth iBeacon (not when connected because iBeacon is just transmiting signal)
I have multiple iBeacons each one will start different activity so the application need to recognize each beacons by MAC Address/UUID
My Application are now able to scan iBeacon device
but to make them start activity and recognize each one. I don't know how to start
I used the code from here (not my project)
https://github.com/danasf/hm10-android-arduino/tree/master/Android/BT4LEDTest
I didn't change his code much so it should be similar to my current code (if I post all my code it's exceed 30000 char limit)
for specific device, you will get list of available device nearby apart from it you will get information like mac as each device as unique mac id
You can start activity from service once you get onConnectionStateChange callback where Bluetooth device is connected.
or
you can broadcast event for successful connection event and 'onreceive()' start activity.

How do Android and iOS scan for Bluetooth beacons without battery issues?

if i want to develop own my iBeacon services in Android or IOS, it has to be practical. which means customer can use my services without shortage of battery.
i think even if iBeacon technology is based on Bluetooth Low Energy, it could be still lack of battery. that's because an application must be running to scan iBeacon device all the time.
As i know, iOS has its own solution for battery issue. when an IOS application detect iBeacon devices, it is running in the background and IOS(not app) is scanning specific UUIDs by itself, not the all UUIDs nearby. this is how they save energy. am i right?
but in case of Android, any solution for battery issue is not provided. what's more,
when an Android application detects iBeacon devices, it scans all the UUIDs nearby and it deals with everything, not the Android OS. is this right?
so Im worry about this battery problems, before i start to develop own my services.
is it gonna be ok with battery?
is there any good solution to share?? how do you guys solve this problem??
The Pro version of the Android iBeacon Library comes with an automatic battery saver that slows down scans when the app is in the background to save battery. The open source Android iBeacon Library also allows configuration of a foreground and background bluetooth scan rate, and provides methods to call to tell the library when the app is in the foreground and the background.
On iOS the battery saving strategy is similar. When no app is ranging for iBeacons in the foreground, bluetooth scans are not performed constantly. The exact frequency of background scans is not published, but I have measured it happening once every 15 minutes on a iPhone 4S with iOS 7.1.
Scanning for specific UUIDs has no effect on battery life. At the OS-level, a Bluetooth LE scan looks for any Bluetooth LE device that is advertising regardless of whether it is an iBeacon or whether it has a specific UUID. The filter for specific UUIDs is handled in software at a higher level.

SW2 Control Extension stop updating the Display when the smartphone is idle

I'm working on a Control Extension for Sony SmartWatch 2 that needs to update a TextView every second on the SW2 Display.
It happens that if I've my Smartphone connected via USB or when USB disconnected if I've my Smartphone screen active, the Control Extension works as expected on SmartWatch 2.
But soon my SmartPhone screen idles, the control extension stops the regular TextView updates. First starts breaking and eventually get stuck. The Extension is not closed by the Host Application and the SW2 continues well paired with the Smartphone. In fact if I touch the display, the Extension appears to recover state for some moments with a few TextView updates, but rapidly breaks and get stuck again.
Meanwhile, if I turn ON my Smartphone screen, the control extension recovers the state and resume the normal TextView updates.
It seems that when the smartphone idles it stops to send the regular bluetooth messages to the SW2. I've tried many solutions to avoid this behaviour, even set the keepRunningWhenConnected to true. But the behaviour is allways the same.
Is anyone also having this problem or have a clue for the solution?
Thanks :)
What model of phone are you using?
If it is indeed that the bluetooth connection is not persisting then you could try the following possible solutions:
Is there a setting on the phone to keep bluetooth on even when going into idle?
You could set the phone to not go into idle while your app is running, of course this is not ideal as it will cause battery drain.
Ok. After testing and testing several solutions (AlarmManager, BluetoothAdapter, etc...) I came to following conclusion:
Its not the Bluetooth connection that is lost, otherwise the SmartWatch 2 would lost connection with the Smartphone, and that never happens. In fact is the Phone CPU that is lost by the ControlExtension, because when the Smartphone idles the CPU also idles. By loosing the Phone CPU the ControlExtension cannot process the "sendText(...)" call and this means that the corresponding upper call "sendHostApp(...)" that uses the Bluetooth messages its also never called, that's why the TextView is not updated on the SmartWatch 2.
Also I think that when I touch the SmartWatch 2 screen, this triggers an hardware interruption that wake up the Phone CPU for short seconds to answer to the SmartWatch 2 Touch Event and thats why when I touch the SW2 screen the TextView is updated a few times before get stuck again.
This works fine for static Control Extension applications that only display static content and/or replies to the user (touch, swipe, etc...) events. But its a complete disaster for Control Extensions applications that need to be doing some processing regardless the user direct interaction.
I never though in this terms because I though that it was the job of the SmartConnect Host Application to guarantee Phone CPU to the Control Extensions.
So the solution for some apps could be using an AlartManager in order to schedule wake up calls to do some processing. For other apps the solution could be the PowerManger and use a wakelock.aquire()/wakelock.release().

Resources