Skip to content

Instantly share code, notes, and snippets.

@virendersran01
Forked from muthuraj57/PreferenceUtil.java
Created July 11, 2020 11:31
Show Gist options
  • Save virendersran01/8f5e9e6c7413a56dbaaf6ba81503bcf4 to your computer and use it in GitHub Desktop.
Save virendersran01/8f5e9e6c7413a56dbaaf6ba81503bcf4 to your computer and use it in GitHub Desktop.
public static void firstTimeAskingPermission(Context context, String permission, boolean isFirstTime){
SharedPreferences sharedPreference = context.getSharedPreferences(PREFS_FILE_NAME, MODE_PRIVATE;
sharedPreference.edit().putBoolean(permission, isFirstTime).apply();
}
public static boolean isFirstTimeAskingPermission(Context context, String permission){
return context.getSharedPreferences(PREFS_FILE_NAME, MODE_PRIVATE).getBoolean(permission, true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment