Advertisement
Guest User

Untitled

a guest
Aug 20th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.02 KB | None | 0 0
  1.  @Override
  2.     protected void onCreate(Bundle savedInstanceState) {
  3.         super.onCreate(savedInstanceState);
  4.         setContentView(R.layout.activity_main);
  5.  
  6.         txtCoordinates = (TextView) findViewById(R.id.LocationText);
  7.         btnSetInfo = (Button) findViewById(R.id.setInfoButton);
  8.         btnHelp = (Button) findViewById(R.id.getHelpButton);
  9.  
  10.  
  11.         if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
  12.                 && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
  13.  
  14.             ActivityCompat.requestPermissions(this, new String[]{
  15.                     Manifest.permission.ACCESS_FINE_LOCATION,
  16.                     Manifest.permission.ACCESS_COARSE_LOCATION
  17.             }, MY_REQUEST_CODE);
  18.         } else {
  19.             if (checkPlayServices()) {
  20.                 buildGoogleApiClient();
  21.                 createLocationRequest();
  22.             }
  23.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement