괴도군의 블로그

[android] inapp 인앱 결제 롤리팝 오류(lollipop) 본문

#프로그래밍/Android

[android] inapp 인앱 결제 롤리팝 오류(lollipop)

괴도군 2015. 8. 28. 17:11
반응형



이런식으로 선언을해주고..

private ServiceConnection mServiceConn = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
mService = IInAppBillingService.Stub.asInterface(service);
}

@Override
public void onServiceDisconnected(ComponentName name) {
mService = null;
}
};


요런식으로 바인딩을 해주면 된다.

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
bindService(new Intent("com.android.vending.billing.InAppBillingService.BIND"),
mServiceConn, Context.BIND_AUTO_CREATE);
} else {
Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
serviceIntent.setPackage("com.android.vending");
bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE);
}


반응형
Comments