Comments (4)
Hello @AshwiniPore
I don't have exact advice but I guess the problem could be in not enough value for foregroundServiceType parameter.
In a foreground service, we keep a connection with a server and interact with SDK. I mean we are using the microphone and camera as well.
Please try to change the parameters for foregroundServiceType and startForegroundService to support also camera and microphone as well.
An example of possibly using you can see in a code snippet below:
AndroidManifest file:
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
<uses-permission android:name="android.permission.CAPTURE_AUDIO_OUTPUT" />
<application>
<service
android:name=".quickblox.service.CallService"
android:exported="false"
android:foregroundServiceType="mediaPlayback|camera|microphone" />
service class:
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
//some code for build notification
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
startForeground(SERVICE_ID, notification, getServiceType());
} else {
startForeground(SERVICE_ID, notification);
}
return super.onStartCommand(intent, flags, startId);
}
@RequiresApi(api = Build.VERSION_CODES.Q)
private int getServiceType() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
return ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK | ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA | ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE;
} else {
return ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK;
}
}
Hope it will help you.
from quickblox-android-sdk.
Hello!
We are having the same issue after migrating to android sdk 34.
Still trying to figure @kirillTolmachev's solution, for some reason the calls are not working anymore on our side (the firebase secret keys json is successfully added and sometimes a call is getting through).
More specifically, I have two test devices, Device1 - Android 13, Device 2 - Android 14. I can call from android 13 to 14 without any issues but I cannot receive a background call, through push notifications, from Android 14 to Android 13.
I'm just wondering, @AshwiniPore did you manage to find a solution for this case?
Thanks!
from quickblox-android-sdk.
Hello @mihAdsc
Please try to follow the instructions below:
To solve this problem, remove the "mediaPlayback" type of the foreground service. Only types for the camera and microphone should remain android:foregroundServiceType="camera|microphone".
More information about foreground service types can be read in the official documentation Foreground service types are required | Android Developers .
To do this, you need to make changes in several files:
AndroidManifest.xml
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<service
android:name=".quickblox.service.CallService"
android:exported="false"
android:foregroundServiceType="camera|microphone" />
CallService.java
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
//some code for build notification
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
startForeground(SERVICE_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA | ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE);
} else {
startForeground(SERVICE_ID, notification);
}
return super.onStartCommand(intent, flags, startId);
}
In addition, should obtain runtime-permissions Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO before starting the CallService Request runtime permissions | Android Developers
Let us know if the instructions provided helped you resolve your issue.
from quickblox-android-sdk.
@QB-maksym-pidhorbunskyi it worked just fine! Thank you.
from quickblox-android-sdk.
Related Issues (20)
- Not Working push notifications with Latest Firebase bom HOT 3
- Unexpected signature in session api HOT 2
- Message send issue if use same device for two different login HOT 1
- Audio/Video call connection issue (Not calling onReceiveNewSession method when call coming) HOT 1
- Corner Radius in QBRTCSurfaceView HOT 1
- Private chat Notification receiving for all the users HOT 3
- How to assign admin ownership to the second participant in the group HOT 1
- Automatic push subscription doesn't work. HOT 2
- Cannot create push subscriptions for two applications on one device HOT 5
- Crash on call service in android 12 HOT 2
- Cannot upload document files on Quickblox android HOT 6
- Issue with calling when login on multiple devices HOT 9
- Push subscription HOT 12
- Failed to resolve: HOT 1
- App is crashing internally due to the error in the SDK HOT 2
- Send Location and Contacts in Chat HOT 5
- Push Notification not working for call HOT 1
- Dialog Name As my Contact Name HOT 3
- Could not download chat-message-adapter-2.0.aar HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quickblox-android-sdk.