When I try to bind to a service that I started already, I am not sure if the zero indicator exception on the line mService.start () get. I do the same thing with different activities (where the service starts) everything gets corrected. All these activities are part of an application.
Do you think I am wrong?
Public square root map map activity {Private constant final integer NEW_LOCATION = 1; Personal Static Finals GPSPS = 2; Private map view mMapView; Private ILOS Service MS Service; Private boolean mServiceStarted; Private boolean mBound; Private intent mServiceIntent; Private Double Mallitad, Molgate; Private service connection connection = new service connection () {Service connected on public wired (ComponentName class name, IBinder iservice) {mService = ILocService.Stub.asInterface (iservice); MBound = true; } Service Disconnect on Public Zero (ComponentName className) {mService = null; MBound = false; }}; Crate on Public Zero (Bundle Saved Instantstate) {Super. Secret (Saved Instantstate); SetContentView (R.layout.mapview); Find MMapView = (MapView) VVBIID (RID Mapview); MMapView.setBuiltInZoomControls (true); MServiceIntent = new intent (); MLatitude = 0.0; Mg = 0.0; MBound = false; } @ Override Public Wide OnStart () {super.start (); MServiceIntent.setClass (this, LocationService.class); // startService (mServiceIntent); If (! MBound) {mBound = true; This.bindService (mServiceIntent, Connection, Context.BIND_AUTO_CREATE); }} @ Override Public Records on Resum () {Super. Rebirth (); Try {mService.start (); } Grip (Remote Exception e) {e.printStackTrace (); }} @ Override Public Own On Pause () {super.onPause (); If (mBound) {this.unbindService (connection); }} @ Override Protected Boolean Harrayed Display () {// TODO Auto generated method stub returns false; }
You have no way of knowing that service onResume ()
. Bind service ()
does not have a calling block call mService.start ()
from your onServiceConnected ()
method.
Comments
Post a Comment