Home » Android » java – Implementing USSD features. Binding a service to the PhoneUtils without restarting the phone on every update

java – Implementing USSD features. Binding a service to the PhoneUtils without restarting the phone on every update

Posted by: admin April 23, 2020 Leave a comment

Questions:

I’m trying to implement an application to send, receive and parse USSD codes on android. So far i used the code on http://commandus.com/blog/?p=58 in order to get this functionality. In order for the service to work, the phone needs to be restarted. This wouldn’t be a problem the first time the user installs the application, but what i’ve noticed while testing on the emulator is that the phone will require a restart on every update, even if there’s nothing new with the service.
What i would like to know is the following:

  • Might there be away to make the PhoneUtils bind to my service without a restart? At least on update time?
  • In case there’s no way to do so, i’m thinking of creating 2 applications, one that is the normal application the user would interact with and a separate one containing my service. In this case the user will be prompted on first run, in case he/she requires any of the ussd features, to install the second application. I’m worried though that this is annoying for the user. What do you think would be the best way to tackle such approach?

For reference, i’ve included the code i used for the service as the interface part is different than the one posted on the original website.

Interface:

Service:

Thank you

How to&Answers:

Please be clear, you are completely off into the weeds of internal implementations of the platform. It sounds like you are wanting this to work “well”. What you are doing is not going to work well, period. You have no guarantee that these internal implementations are going to stay the same across different versions of the platforms, or even different builds of the platform on manufacturer devices, nor that the behavior you are seeing around this interface will work the same in different situations.

This is just bad bad bad. Don’t do this.