java.lang.RuntimeException: невозможно запустить службу com.app.buildyourownfanbase.helper.CallNotificationService1@76527d с намерением { cmp=com.app.buildyourownfanbase/.helper.CallNotificationService1 }: java.lang.SecurityException: запуск FGS с тип микрофона callerApp=ProcessRecord{ebefb57 27259:com.app.buildyourownfanbase/u0a752} targetSDK=34 требует разрешений: все разрешения allOf=true [android.permission.FOREGROUND_SERVICE_MICROPHONE] любое из разрешений allOf=false [android.permission.CAPTURE_AUDIO_HOTWORD , android.permission.CAPTURE_AUDIO_OUTPUT, android.permission.CAPTURE_MEDIA_OUTPUT, android.permission.CAPTURE_TUNER_AUDIO_INPUT, android.permission.CAPTURE_VOICE_COMMUNICATION_OUTPUT, android.permission.RECORD_AUDIO], и приложение должно находиться в соответствующем состоянии/исключениях для доступа к разрешению только на переднем плане
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5286)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs(Unknown Source:0)
at android.app.ActivityThread $H.handleMessage(ActivityThread.java:2531)
в android.os.Handler.dispatchMessage(Handler.java:106)
в android.os.Looper.loopOnce(Looper.java:230)в android.os.Looper.loop(Looper.java:319)
в android.app.ActivityThread.main(ActivityThread.java:8919)
в java.lang.reflect.Method. вызвать (собственный метод)
на com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
на com.android.internal.os.ZygoteInit.main(ZygoteInit.java) :1103)
Причина: java.lang.SecurityException: запуск FGS с типом микрофона callerApp=ProcessRecord{ebefb57 27259:com.app.buildyourownfanbase/u0a752} targetSDK=34 требует разрешений: все разрешения allOf=true [ android.permission.FOREGROUND_SERVICE_MICROPHONE] любое из разрешений allOf=false [android.permission.CAPTURE_AUDIO_HOTWORD, android.permission.CAPTURE_AUDIO_OUTPUT, android.permission.CAPTURE_MEDIA_OUTPUT, android.permission.CAPTURE_TUNER_AUDIO_INPUT, android.permission.CAPTURE_VOICE_ COMMUNICATION_OUTPUT, android.permission.RECORD_AUDIO] и приложение должно находиться в соответствующем состоянии/исключениях для доступа к разрешению только переднего плана
в android.os.Parcel.createExceptionOrNull(Parcel.java:3069)
в android.os.Parcel.createException(Parcel .java:3053)
в android.os.Parcel.readException(Parcel.java:3036)
в android.os.Parcel.readException(Parcel.java:2978)
в android. app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:7234)
в android.app.Service.startForeground(Service.java:862)
в com.app.buildyourownfanbase.helper.CallNotificationService1. setCallNotification(CallNotificationService1.java:122)
в com.app.buildyourownfanbase.helper.CallNotificationService1.onStartCommand(CallNotificationService1.java:46)
в android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5268)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2531)
at android .os.Handler.dispatchMessage(Handler.java:106)
в android.os.Looper.loopOnce(Looper.java:230)
в android.os.Looper.loop(Looper.java:319) )
в android.app.ActivityThread.main(ActivityThread.java:8919)
в java.lang.reflect.Method.invoke(Native Method)
в com.android.internal.os .RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
на com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
Вызвано: android.os.RemoteException: Remote трассировка стека:
в com.android.server.am.ActiveServices.validateForegroundServiceType(ActiveServices.java:2741)
в com.android.server.am.ActiveServices.setServiceForegroundInnerLocked(ActiveServices.java:2452)at com.android.server.am.ActiveServices.setServiceForegroundLocked(ActiveServices.java:1797)
at com.android.server.am.ActivityManagerService.setServiceForeground(ActivityManagerService.java:15948)
at android.app.IActivityManager$Stub.onTransact$setServiceForeground$(IActivityManager.java:11974)
Я ожидал, что служба запустится без проблем и обработает функции, связанные с микрофоном.
AndroidManifest.xml
CallNotificationService1.java
private static final String TAG = CallNotificationService1.class.getSimpleName();
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.d(TAG, "Service Started");
setCallNotification(this);
return START_NOT_STICKY;
}
@Override
public void onDestroy() {
super.onDestroy();
Log.d(TAG, "Service Destroyed");
}
@Override
public void onTaskRemoved(Intent rootIntent) {
Log.d(TAG, "onTaskRemoved");
//stopStream1();
Intent intent = new Intent("GPSLocationUpdates");
intent.putExtra("Status", "App_kill");
LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(intent);
stopForeground(false);
stopSelf();
}
private void setCallNotification(Context context) {
String appName = context.getString(R.string.app_name);
long when = System.currentTimeMillis();
Intent intent = new Intent(context, VideoCallActivity.class);
intent.putExtra("notification", "true");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
int intents;
if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.S) {
intents = PendingIntent.FLAG_MUTABLE;
} else {
intents = PendingIntent.FLAG_IMMUTABLE;
}
PendingIntent resultPendingIntent =
PendingIntent.getActivity(context, 0, intent, intents);
Intent intent2 = new Intent(context, VideoCallActivity.class);
intent2.putExtra("_ACTION_", "endcall");
intent2.setAction("End Call");
intent2.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
PendingIntent endIntent = PendingIntent.getActivity(context, 0, intent2, intents);
String channelId = context.getString(R.string.notification_channel_id);
CharSequence channelName = context.getString(R.string.app_name);
int importance = NotificationManager.IMPORTANCE_HIGH;
NotificationManager mNotifyManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel notificationChannel = new NotificationChannel(channelId, channelName, importance);
mNotifyManager.createNotificationChannel(notificationChannel);
}
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context, channelId);
Notification notification = mBuilder.build();
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE){
Log.d(TAG, "setCallNotification11111111111111111111: ");
startForeground(128,notification,ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE);
}
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
startForeground(1000, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE | ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA /*| ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE*/);
} else {
startForeground(1000, notification);
}}
Подробнее здесь: https://stackoverflow.com/questions/789 ... livestream
Мы столкнулись с проблемой, из-за которой приложение аварийно завершает работу при сворачивании во время прямой трансляц ⇐ Android
Форум для тех, кто программирует под Android
1726468628
Anonymous
java.lang.RuntimeException: невозможно запустить службу com.app.buildyourownfanbase.helper.CallNotificationService1@76527d с намерением { cmp=com.app.buildyourownfanbase/.helper.CallNotificationService1 }: java.lang.SecurityException: запуск FGS с тип микрофона callerApp=ProcessRecord{ebefb57 27259:com.app.buildyourownfanbase/u0a752} targetSDK=34 требует разрешений: все разрешения allOf=true [android.permission.FOREGROUND_SERVICE_MICROPHONE] любое из разрешений allOf=false [android.permission.CAPTURE_AUDIO_HOTWORD , android.permission.CAPTURE_AUDIO_OUTPUT, android.permission.CAPTURE_MEDIA_OUTPUT, android.permission.CAPTURE_TUNER_AUDIO_INPUT, android.permission.CAPTURE_VOICE_COMMUNICATION_OUTPUT, android.permission.RECORD_AUDIO], и приложение должно находиться в соответствующем состоянии/исключениях для доступа к разрешению только на переднем плане
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5286)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs(Unknown Source:0)
at android.app.ActivityThread $H.handleMessage(ActivityThread.java:2531)
в android.os.Handler.dispatchMessage(Handler.java:106)
в android.os.Looper.loopOnce(Looper.java:230)в android.os.Looper.loop(Looper.java:319)
в android.app.ActivityThread.main(ActivityThread.java:8919)
в java.lang.reflect.Method. вызвать (собственный метод)
на com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
на com.android.internal.os.ZygoteInit.main(ZygoteInit.java) :1103)
Причина: java.lang.SecurityException: запуск FGS с типом микрофона callerApp=ProcessRecord{ebefb57 27259:com.app.buildyourownfanbase/u0a752} targetSDK=34 требует разрешений: все разрешения allOf=true [ android.permission.FOREGROUND_SERVICE_MICROPHONE] любое из разрешений allOf=false [android.permission.CAPTURE_AUDIO_HOTWORD, android.permission.CAPTURE_AUDIO_OUTPUT, android.permission.CAPTURE_MEDIA_OUTPUT, android.permission.CAPTURE_TUNER_AUDIO_INPUT, android.permission.CAPTURE_VOICE_ COMMUNICATION_OUTPUT, android.permission.RECORD_AUDIO] и приложение должно находиться в соответствующем состоянии/исключениях для доступа к разрешению только переднего плана
в android.os.Parcel.createExceptionOrNull(Parcel.java:3069)
в android.os.Parcel.createException(Parcel .java:3053)
в android.os.Parcel.readException(Parcel.java:3036)
в android.os.Parcel.readException(Parcel.java:2978)
в android. app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:7234)
в android.app.Service.startForeground(Service.java:862)
в com.app.buildyourownfanbase.helper.CallNotificationService1. setCallNotification(CallNotificationService1.java:122)
в com.app.buildyourownfanbase.helper.CallNotificationService1.onStartCommand(CallNotificationService1.java:46)
в android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5268)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2531)
at android .os.Handler.dispatchMessage(Handler.java:106)
в android.os.Looper.loopOnce(Looper.java:230)
в android.os.Looper.loop(Looper.java:319) )
в android.app.ActivityThread.main(ActivityThread.java:8919)
в java.lang.reflect.Method.invoke(Native Method)
в com.android.internal.os .RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
на com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
Вызвано: android.os.RemoteException: Remote трассировка стека:
в com.android.server.am.ActiveServices.validateForegroundServiceType(ActiveServices.java:2741)
в com.android.server.am.ActiveServices.setServiceForegroundInnerLocked(ActiveServices.java:2452)at com.android.server.am.ActiveServices.setServiceForegroundLocked(ActiveServices.java:1797)
at com.android.server.am.ActivityManagerService.setServiceForeground(ActivityManagerService.java:15948)
at android.app.IActivityManager$Stub.onTransact$setServiceForeground$(IActivityManager.java:11974)
Я ожидал, что служба запустится без проблем и обработает функции, связанные с микрофоном.
AndroidManifest.xml
CallNotificationService1.java
private static final String TAG = CallNotificationService1.class.getSimpleName();
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.d(TAG, "Service Started");
setCallNotification(this);
return START_NOT_STICKY;
}
@Override
public void onDestroy() {
super.onDestroy();
Log.d(TAG, "Service Destroyed");
}
@Override
public void onTaskRemoved(Intent rootIntent) {
Log.d(TAG, "onTaskRemoved");
//stopStream1();
Intent intent = new Intent("GPSLocationUpdates");
intent.putExtra("Status", "App_kill");
LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(intent);
stopForeground(false);
stopSelf();
}
private void setCallNotification(Context context) {
String appName = context.getString(R.string.app_name);
long when = System.currentTimeMillis();
Intent intent = new Intent(context, VideoCallActivity.class);
intent.putExtra("notification", "true");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
int intents;
if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.S) {
intents = PendingIntent.FLAG_MUTABLE;
} else {
intents = PendingIntent.FLAG_IMMUTABLE;
}
PendingIntent resultPendingIntent =
PendingIntent.getActivity(context, 0, intent, intents);
Intent intent2 = new Intent(context, VideoCallActivity.class);
intent2.putExtra("_ACTION_", "endcall");
intent2.setAction("End Call");
intent2.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
PendingIntent endIntent = PendingIntent.getActivity(context, 0, intent2, intents);
String channelId = context.getString(R.string.notification_channel_id);
CharSequence channelName = context.getString(R.string.app_name);
int importance = NotificationManager.IMPORTANCE_HIGH;
NotificationManager mNotifyManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel notificationChannel = new NotificationChannel(channelId, channelName, importance);
mNotifyManager.createNotificationChannel(notificationChannel);
}
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context, channelId);
Notification notification = mBuilder.build();
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE){
Log.d(TAG, "setCallNotification11111111111111111111: ");
startForeground(128,notification,ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE);
}
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
startForeground(1000, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE | ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA /*| ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE*/);
} else {
startForeground(1000, notification);
}}
Подробнее здесь: [url]https://stackoverflow.com/questions/78978470/we-are-facing-an-issue-where-the-app-crashes-when-minimized-during-livestream[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия