• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to stop system from pauseing a service

 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have an simple app that mutes the microphone the problem is if i run the service then go into google or youtube etc and select voice search then my service gets paused untill search times out then starts again which makes the service useless i want it to be mused all the time unless i unmuted it for phone calls etc manually from app. I know it can be done as i have seen similar apps that do it. the service is max_prioity etc the code is below if anyone could point me in the right direction would be great thanks.
 
Ranch Hand
Posts: 606
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I apologize but i do not understand exactly what you want to achieve, namely when exactly you expect the service to not get stopped? Which application, which precise action?
Just in the case may  be still helpful,  please consider also me and Tim replied you in your previous post from 6 days ago about the use of Service.

You put some logs, what is the flow behavior, is the `ondestroy` callback called when expected and if so  is the boolean  flag value changed?
 
john bean
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for reply there is nothing of use in logcat the only 3 lines printed are


the only reason i know it is being paused is the toasts stop when voice assistant is opened and resume when it closes before i put in toasts i just assumed my service was not running the aim is to kill the microphone completely unless it is manually turned on by the user  never really worked with services before trying to fumble through it and learn it does work during phone calls its just google voice search that pauses my service
 
Giovanni Montano
Ranch Hand
Posts: 606
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

john bean wrote:thanks for reply there is nothing of use in logcat the only 3 lines printed are


the only reason i know it is being paused is the toasts stop when voice assistant is opened and resume when it closes before i put in toasts i just assumed my service was not running the aim is to kill the microphone completely unless it is manually turned on by the user  never really worked with services before trying to fumble through it and learn it does work during phone calls its just google voice search that pauses my service


ok i still have problems to understand what you want to achieve, i do not get when you said that you start the service "then you go to youtube" press search with voice and there is another app that works, if you take your time to write sequentially what do you expect and what happens i can help.

please consider that in the companies there is a way to describe the bugs: steps you take to reproducesequentially, 1,2, 3 ex from screen one i put the app in background pressing the soft button back, then i open youtube, and i press voice search.
I EXPECT
that.....
WHAT INSTEAD HAPPENS
is......

note: there is an app called spotify that when i press etc
 
john bean
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry if i am being unclear
1. i run my service and the microphone is muted it is muted during calls and the toasts launch every 3 seconds
however if
2. i close my app or put it in background and open either firefox or youtube and select voice search the toasts stop and the microphone works
3. after voice search ends the toasts resume and the microphone gos back to being muted

I need it to work all the time i have tried altering onStartCommand() to return START_STICKY; as this prevents system from killing for memory purposes but voice search still pauses my service

thanks for reply
 
john bean
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
k i was testing on different device with higher sdk which since oreo needs a channel for notifications and it works fine on the higher sdk running lineage



so if it is in the if statement it works if it is in the else statement it stops for assistant
 
Giovanni Montano
Ranch Hand
Posts: 606
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

john bean wrote:k i was testing on different device with higher sdk which since oreo needs a channel for notifications and it works fine on the higher sdk running lineage



so if it is in the if statement it works if it is in the else statement it stops for assistant



really good, as i told you before Services are a pain because Android manage them differently because of privacy, security, and battery optimizations. Well done!
 
john bean
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok after digging through logs this message is posted wen service starts


And this happens when voice assist is launched



so maybe it has something to do with switching to speaker as a mic?
 
Giovanni Montano
Ranch Hand
Posts: 606
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The only think I can relate is spotify, when I listen to it and then switch to youtube and open a video the audio switches to youtube. Is how should work I guess, please which app has a different behavior, you mentioned one right?  
 
john bean
Ranch Hand
Posts: 86
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok the solution was to record the audio into an array but never save it
 
Marshal
Posts: 79232
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SI: welcome to the Ranch
reply
    Bookmark Topic Watch Topic
  • New Topic