Blackberry : detect profile mode - blackberry

I play a ringtone in my application for notification message
InputStream stream = (InputStream)this.getClass()
.getResourceAsStream("/storm.mp3");
p = Manager.createPlayer(stream, "audio/x-wav");
p.realize();
p.prefetch();
p.start();
However, it keeps playing even when the device is in silent mode or vibrate mode. How can I detect the device profile mode? That is whether if it is in normal, silent or vibrate mode?

The Profiles class allows you to query some aspects of the profile. It is new in OS 7.1, so this won't help you for most BlackBerry users.

Related

AVAudioSession does not automatically connect to Bluetooth A2DP audio?

Description:
When I change my AudioSession to .playAndRecord via the following call:
AVAudioSession.sharedInstance().setCategory(.playAndRecord, mode: .default, options: [.defaultToSpeaker, .allowBluetoothA2DP, .mixWithOthers])
From these category options set, I expect that, once I pair bluetooth headphones with my phone, my running app should automatically route audio to my bluetooth A2DP headphones. Instead, my app still chooses to use the phone speaker. There is no indication at all, whether from querying the audio session instance or in the form of a route change notification, that I have bluetooth headphones connected..
Question: How do I ensure the audiosession connects automatically to the bluetooth headphones?
This behavior clearly has nothing to do with an incorrect line of code. As if I had bluetooth headphones paired before the I invoke audio-session category change, my audio will correctly continue to use the bluetooth headphones.
Moreover, if I had instead used the .allowBluetooth category option (for HFP instead of A2DP) during the code invocation, and then paired bluetooth headphones, the headphones connect automatically just fine. Behavior reproduced on: iPhone XR (iOS 13.6.1) with Apple AirPods Pro
iPhone XR (iOS 13.6) with Senso wireless 44.1kHz bluetooth headphones.
Reproduction steps:
For the sake of simplicity and reproducibility for Apple’s engineers, I have reproduced the issue on a lightly modified version of AVEchoTouch Demo Code from WWDC. As this was a demo project published by Apple, it is all correct code. My modified project, called BluetoothIssue, can be found here.
Step 1: Make sure your bluetooth headphones are currently not paired with the iPhone.
Step 2: Launch the “BluetoothIssue App”. When you toggle the “FX Out” or the “Speech Out” toggles, the app should be playing sounds (out of iPhone speaker)
Step 3: Now connect your bluetooth headphones to the phone. Even though the headphones are now connected and paired with phone, the app does not register the connection, and continues play out of the phones built-in speakers.
// Steps 4-5 (Optional): to see that nothing is wrong with the app’s category itself
Step 4: Now force kill the “BluetoothIssue” app, while your headphones are still connected.
Step 5: Now relaunch the “BluetoothIssue” app. The app plays sound correctly out to the bluetooth headphones.
I learned that if i set the mode to VideoRecording, iOS will change the route if I turn the bluetooth on (and I get a route change notification). Without this mode I had to allow both bluetooth, after detect one, change the category again without AllowBluetooth, just A2DP. Weird and slow solution, but worked. Now im just using videorecording mode.

Can an iOS device in kiosk mode receive remote notification

Hello Stackoverflowers!
Before I embark on a small change to my app, I would like to know if an iOS device in kiosk mode can receive a remote notification (of the same app that's in the kiosk mode)?
Thanks!
Tomiris

iOS Simulator makes headphones enter call mode

Every time I open iOS Simulator my headphones enter call mode. Why MacOS thinks an open Simulator is like a running call?
Headphones are connected wirelessly (Beoplay H9i).
Under Hardware, Audio Input select a different input device (such as built-in microphone).

How does Knock to unlock reliably detect knocks even on sleeping phones when in the background?

Here is the app: http://www.knocktounlock.com/
Which leads me to believe the prior threads on this topic(CoreMotion updates in background state) are no longer accurate because it does indeed work reliably even when your phone is in sleep mode and locked.
Based on their webpage, this is how it works. There is an app on the Mac. When you wake up the Mac screen, before unlocking, the Map app sends a BLE notification to the unlock app on the phone. BLE notifications can start iphone apps in the background. The iPhone app starts monitoring the accelerometer and send a BLE notification back to the Mac when you knock.

ios simulator - where is settings>notifications>appname?

I built a VOIP app for iphone where if you receive a call, you will hear a telephone ring tone. Some users have complained that they don't hear any ringtone. I discovered later that on the physical device, you can go to Settings>Notifications>TheAppName, and adjust your notification settings. One of htese settings is to disable sounds or allow sound, which corresponds to whether you get the ringtone or not when receiving a call. However, some users still don't seem to hear the ringtone at all despite having the most permissive sound settings.
I wanted to reproduce their issues in the iOS simulator. But I can't seem to find the Settings>NOtifications in the simulator. How do I locate this?
You cannot test push notification services on the simulator. You have to use a device to test it.

Resources