Skip to content

Commit

Permalink
Functional communication through bindings to start and stop service m…
Browse files Browse the repository at this point in the history
…ethods
  • Loading branch information
JacobSheehy committed Apr 18, 2013
1 parent a42c460 commit be58e96
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/ca/cumulonimbus/pressurenetsdk/test/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,18 @@ public class MainActivity extends Activity {
boolean mBound;

public void stopCollectingData(View v) {
if (!mBound)
return;
Message msg = Message
.obtain(null, CbService.MSG_STOP, 0, 0);
try {
mService.send(msg);
} catch (RemoteException e) {
e.printStackTrace();
if (mBound) {
Message msg = Message
.obtain(null, CbService.MSG_STOP, 0, 0);
try {
mService.send(msg);
} catch (RemoteException e) {
e.printStackTrace();
}
} else {
log("error: not bound");
}

}

private ServiceConnection mConnection = new ServiceConnection() {
Expand All @@ -53,7 +56,6 @@ public void onServiceDisconnected(ComponentName className) {
}
};


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down

0 comments on commit be58e96

Please sign in to comment.