Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1.  
  2.  
  3.  
  4.  
  5. MyActivity implements ActivityCompat {
  6.  
  7.  
  8.  
  9. public onCreate() {
  10.  
  11. if (iHavePermission) {
  12. startLocation();
  13. } else{
  14.  
  15. }
  16.  
  17.  
  18. }
  19.  
  20. @Override
  21. public onRequestPermissionResult(int code, string[] permissions, int result) {
  22. if (permissions contains fine_location) {
  23. if (result == DENIED) {
  24. // Show Error Message
  25. } else {
  26. startLocation();
  27. }
  28. }
  29.  
  30. }
  31.  
  32. private startLocation() {
  33. // Start location requests, blah balha blah
  34.  
  35. }
  36.  
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement