java - Service not starting when button is pressed? -
I know that a hundred times before it has been asked, but nothing is working for me I have a There is a service in a different category that requires a push button after launch from a Long story short, here's my goal: Wait three seconds for the running commands & gt; Launch app & gt; Start Service Monitor the service CONFIGURATION_CHANGED broadcast. Reveal (parts which are important): MyService.java: And then in my main activity, I have the following line to call to start javascript: I am more confused than a mosquito in the effigy shop. Logcat did not exactly Nothing is returning useful. Do I have something wrong here? I am not even seeing tiists from starting the service. Ensure that your service has been announced in the Android manifest launch entity .
& lt; / Activity & gt; & Lt; Receiver Android: name = "MyReceiver" & gt; & Lt; Intent-Filter & gt; & Lt; Action Android: name = "android.intent.action.CONFIGURATION_CHANGED" & gt; & Lt; / Action & gt; & Lt; / Intent-Filter & gt; & Lt; / Receiver & gt; & Lt; Service Android: Enabled = "True" Android: name = ". MyService" /> & Lt; / Application & gt; & Lt; / Reveal & gt;
import android.content.Context; Import android.content.Intent; Android Import android.widget.Toast; Import android.app.Service; Public class service expands MyService {string [] commandsdefault = {"/ x"}; Create on public zeros () {toast. Make Text (this, "X", Toast. LNNHHHRT); } Public Zero Bedesto () {Toast. Make Text (this, "X", Toast. LNGHHRT); } Public vacuum receiver (reference reference, intent to intent) {main activity ogres = new main activity (); Ogres.RunAsRoot (commandsdefault); } @ Override Public Wide Onstart (intent of intention, int-start) {toast. Make Text (this, "X", Toast. LNNHHHRT); } @ Override public ibindor on bind (intent to intent) {return tap; }}
startService (new intent ( GetApplicationContext), MyService.class));
u = 0 found .
Comments
Post a Comment