TedPermission
TedPermission copied to clipboard
V/TedPermission: permissionResult(): null
After providing permission library logs V/TedPermission: permissionResult(): null It makes app freeze a bit, also when app goes in the background it pushes app back on screen in 2-3s. Looks like some problems with bus events. Implementing lib according to described documentation.
@tigransarkisyan Can you show me your code?
안녕하세요! 저도 permissionResult(): null 나오네요ㅠ 이게 모든 버전이 안되면 다행인데 다른 사람들은 잘되더라구요.
일단 코드는 아래와 같고, 제 안드로이드 버전은 7.0 이며 LG V20 기기 쓰고 있습니다!
if (SmartLocation.with(MainApplication.mContext).location().state().locationServicesEnabled()) {
//권한 설정이후 작업
DisposableManager.add(TedRx2Permission.with(mContext)
.setRationaleTitle("위치 정보 추가")
.setRationaleMessage("위치 정보를 동의하시면 현재 내 거리로부터 가까운 곳을 보실 수 있습니다 :)")
.setDeniedTitle("위치 정보를 배제한 정보가 표시됩니다.")
.setPermissions(Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION)
.setGotoSettingButton(true)
.request()
// 옵저버블
// 온넥스트를 실행
// 중간에 에러 발생 -> 온에러
// 잘 끝남 -> 온컴플릿
.subscribe(tedPermissionResult -> {
if (tedPermissionResult.isGranted()) {
// 허용 받음
// 위치 정보 가져오기
SmartLocation.with(MainApplication.mContext).location().oneFix().start(location -> {
MainApplication.lat = location.getLatitude();
MainApplication.lng = location.getLongitude();
getAddress(MainApplication.lat, MainApplication.lng, address -> {
if (address != null) {
// 성공
setLocation(MainApplication.lat + "", MainApplication.lng + "", address, LOCATION_CURRENT);
} else {
// 실패
cancelLocationChange(LOCATION_CURRENT);
}
});
});
} else {
// 거절 받음
Toast.makeText(mContext, "동의후 이용가능합니다.", Toast.LENGTH_SHORT).show();
cancelLocationChange(LOCATION_CURRENT);
}
}, throwable -> {
Toast.makeText(mContext, "동의후 이용가능합니다.", Toast.LENGTH_SHORT).show();
cancelLocationChange(LOCATION_CURRENT);
}, () -> {
}));
}
@kkotkkio Rx에서는 tedPermissionResult가 null이 emit 될 수 없습니다. 문제가 발생하는 코드의 샘플 프로젝트 예제를 올려주시면 확인해보겠습니다.