Skip to content

Instantly share code, notes, and snippets.

@mibrahimdev
Created May 29, 2018 17:58
Show Gist options
  • Save mibrahimdev/e7876d4513dbeac52371a695f0e55f70 to your computer and use it in GitHub Desktop.
Save mibrahimdev/e7876d4513dbeac52371a695f0e55f70 to your computer and use it in GitHub Desktop.
public class LocationActivity extends AppCompatActivity {
...
private void bindLocationListener() {
//You can safely pass (this) as it expose only the type not the view
BoundLocationManager.bindLocationListenerIn(this, mGpsListener, getApplicationContext());
}
@Overrideprotected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.location_activity);
if (!hasLocationPermission()){
//ask for permissions
} else {
bindLocationListener();
}
}
...
....
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment