Skip to content

Commit b341be7

Browse files
committed
네이버 로그인 시 앱설치 안되어있을 경우에 대한 예외처리 추가
1 parent a93587c commit b341be7

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

bootpay/src/main/java/kr/co/bootpay/BootpayWebView.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ public class BootpayWebView extends WebView {
5353

5454
private Request request = null;
5555

56+
private Context _context;
57+
5658
// private Locale locale = Locale.getDefault();
5759

5860
private boolean isLoaded = false;
@@ -89,6 +91,7 @@ public void handleMessage(Message msg) {
8991

9092
public BootpayWebView(Context context) {
9193
this(context, null);
94+
this._context = context;
9295
}
9396

9497
// public BootpayWebView(Context context, Request request) {
@@ -97,6 +100,7 @@ public BootpayWebView(Context context) {
97100

98101
public BootpayWebView(Context context, AttributeSet attrs) {
99102
this(context, attrs, 0);
103+
this._context = context;
100104
}
101105

102106
private void goBootpayRequest() {
@@ -258,9 +262,19 @@ private boolean start(Intent intent, Context context) {
258262
}
259263

260264
private boolean gotoMarket(Intent intent, Context context) {
265+
//context가 팝업인 웹뷰로 동작될 경우 no activity found 문제가 발생한다. 따라서 _context로 처리한다.
261266
final String appPackageName = intent.getPackage();
262267
if(appPackageName == null) {
263-
context.startActivity(new Intent(Intent.ACTION_VIEW, intent.getData()));
268+
Uri dataUri = intent.getData();
269+
270+
try {
271+
context.startActivity(new Intent(Intent.ACTION_VIEW, intent.getData()));
272+
} catch (Exception e) {
273+
Log.d("goToMarket Error", e.getMessage());
274+
if(dataUri != null || dataUri.toString().startsWith("nidlogin://")) { //네이버 로그인일 경우 appPackageName이 비어 있이기에, 예외처리를 해주자
275+
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + "com.nhn.android.search")));
276+
}
277+
}
264278
return true;
265279
}
266280
try {

sample/src/main/java/bootpay/co/kr/samplepayment/NativeActivity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public void onClick_request(View v) {
7272

7373
void goPGPay() {
7474
BootUser bootUser = new BootUser().setAddr("서울시 동작구 상도로 369").setEmail("[email protected]").setPhone("010-1234-2314");
75-
BootExtra bootExtra = new BootExtra().setQuotas(new int[] {1,2,3}).setPopup(0).setQuickPopup(0);
75+
BootExtra bootExtra = new BootExtra().setQuotas(new int[] {1,2,3}).setPopup(1).setQuickPopup(1);
7676

7777
// Payload payload = new Payload();
7878
// payload.setOrder_id("1232352354")
@@ -87,8 +87,8 @@ void goPGPay() {
8787
Bootpay.init(getFragmentManager())
8888
.setContext(this)
8989
.setApplicationId(application_id) // 해당 프로젝트(안드로이드)의 application id 값
90-
.setPG(PG.TOSS) // 결제할 PG 사
91-
.setMethod(Method.CARD)
90+
.setPG(PG.PAYAPP) // 결제할 PG 사
91+
.setMethod(Method.NPAY)
9292
// .setEasyPayUserToken("wef")
9393
// .setMethodList(Arrays.asList(Method.EASY_CARD, Method.PHONE, Method.BANK, Method.CARD, Method.VBANK))
9494
.setBootExtra(bootExtra)

0 commit comments

Comments
 (0)