Since MeshService is the core class of the CSRMesh Android library, you will need it in your main activity. Create a global variable and bind it inside the onCreate method:
private MeshService mMeshService;
@Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Make a connection to MeshService to enable us to use its services. Intent bindIntent = new Intent(this, MeshService.class); bindService(bindIntent, mServiceConnection, Context.BIND_AUTO_CREATE);}
If you notice, there is an unknown variable in the previous code, mServiceConnection. This is an object that will handle the service connection. Declare it using the following code:
private ServiceConnection mServiceConnection ...