사용자가 사용료를 지불해야하는 몇 가지 기능을 갖춘 응용 프로그램을 개발 중입니다. 사용자는 버튼을 클릭하여 각 활동별로 구매할 수 있습니다. 이렇게하려면 Android 인앱 결제 및 robotmedia/AndroidBillingLibrary를 사용합니다. 모든 장치가 내 장치에서 제대로 작동하는 것 같습니다 : HTC Wildfire S (Android 2.3.5) 및 Asus Transformer Pad (Android 4.1.1)이지만 구매 버튼을 클릭 한 후 다른 장치에서 아무 것도 발생하지 않는 정보 (로그 캡처 포함)가 있습니다. 장치 :AndroidBillingLibrary : 원격 서비스가 BillingController.requestPurchase에서 충돌했습니다.
- 갤럭시 ACE (안드로이드 2.3.5)는
- HTC 센세이션 (4.0.3의 Andorid)
- 페리아 네오 V (안드로이드 2.3.4) 여기
은 로그 캡처 :
11-30 15:05:16.157: D/Parent Activity:(30220): Request Purchase: myitem
11-30 15:05:16.177: W/BillingService(30220): Remote billing service crashed
11-30 15:05:16.177: W/BillingService(30220): Caused by: null
이 내 활동에서 코드의 일부는 다음과 같습니다
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
(...)
initViews();
initBilling();
}
@Override
protected void onDestroy()
{
BillingController.unregisterObserver(mBillingObserver);
(...)
super.onDestroy();
}
private void initBilling()
{
mBillingObserver = new BillingObserver(this);
BillingController.registerObserver(mBillingObserver);
BillingController.setConfiguration(new BillingConfiguration());
BillingController.checkBillingSupported(getApplicationContext());
if (!mBillingObserver.isTransactionsRestored()) {
BillingController.restoreTransactions(getApplicationContext());
}
Settings.updateOwnedItems(this);
}
private void showPurchaseAlert()
{
if(Settings.isOnline() && BillingController.checkBillingSupported(this) == BillingStatus.SUPPORTED)
{
(...)
((Button) alertRoot.findViewById(R.id.alert_billing_yes))
.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
requestPurchase(BillingElement.CATALOG[number].sku);
alert.cancel();
}
});
}
else
{
(...)
//Purchase Alert Invisible
}
}
public void requestPurchase(String itemId)
{
Log.d("Parent Activity:", "Request Purchase: "+itemId);
BillingController.requestPurchase(getApplicationContext(), itemId, true, null);
}
이 코드에서 나는 장치가 온라인인지, 인앱 결제가 지원되는지 항상 확인합니다.
가 는private void runRequest(BillingRequest request){
try {
long requestId = request.run(mService);
BillingController.onRequestSent(requestId, request);
} catch (RemoteException e) {
Log.w(this.getClass().getSimpleName(), "Remote billing service crashed");
Log.w(this.getClass().getSimpleName(), "Caused by: "+e.getCause());
// TODO: Retry?
}
}
가
사람은 RemoteException을 슬로우 왜 나를 설명 할 수 : 이 구글에서 IMarketBillingService 인앱 결제는 RemoteException 을 던져가 billingService는 클래스에 robotmedia/AndroidBillingLibrary에 사로 잡았 것 같다? 그리고 어떻게 처리합니까 ? 테스트를 많이했지만 기기에서 인앱 결제가 항상 올바르게 작동합니다. RemoteException이 던져지는 이러한 장치에서 흥미로운 점은 때때로 발생하는 경우입니다.