This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ApiConfig { | |
| private static final String BASE_URL = "urlxxx/api/"; | |
| private static Retrofit retrofit; | |
| public static Retrofit getClient(){ | |
| if (retrofit == null){ | |
| retrofit = new Retrofit.Builder() | |
| .baseUrl(BASE_URL) | |
| .addConverterFactory(GsonConverterFactory.create()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //check permission | |
| private boolean checkPermission() { | |
| if (SDK_INT >= Build.VERSION_CODES.R) { | |
| return Environment.isExternalStorageManager(); | |
| } else { | |
| int result = ContextCompat.checkSelfPermission(requireContext(), android.Manifest.permission.READ_EXTERNAL_STORAGE); | |
| int result1 = ContextCompat.checkSelfPermission(requireContext(), android.Manifest.permission.WRITE_EXTERNAL_STORAGE); | |
| return result == PackageManager.PERMISSION_GRANTED && result1 == PackageManager.PERMISSION_GRANTED; | |
| } | |
| } |