Advertisement
Guest User

hh

a guest
Mar 30th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1.  
  2.  
  3. @Override
  4. public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
  5. super.onRequestPermissionsResult(requestCode, permissions, grantResults);
  6. switch (requestCode)
  7. {
  8. case PERMISSIONS_REQUEST_READ_CONTACTS: {
  9. if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED)
  10. {
  11. Toast.makeText(Splash.this, "Permission Telah di izinkan.", Toast.LENGTH_SHORT).show();
  12. //reload my activity with permission granted or use the features what required the permission
  13. finish();
  14. startActivity(getIntent());
  15. } else
  16. {
  17. Toast.makeText(Splash.this, "The app was not allowed to get your phone state. Hence, it cannot function properly. Please consider granting it this permission", Toast.LENGTH_LONG).show();
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement