1

Nokia X、Nokia X+、Nokia XL 向けの Android ゲームを作成しています。アプリケーションにアプリ内購入を追加したい。私は多くの方法を試しますが、うまくいきません。以下のコードを参照してください。このコードを onCreate メソッドから呼び出します。

    //Verify In-App Payment enabler SHA1 fingerprint. 
    Intent paymentEnabler = new Intent("com.nokia.payment.iapenabler.InAppBillingService.BIND");
    paymentEnabler.setPackage("com.nokia.payment.iapenabler"); 
    bindService(paymentEnabler, mServiceConnection, Context.BIND_AUTO_CREATE);

mServiceConnection のコードは以下のとおりです。

ServiceConnection mServiceConnection = new ServiceConnection() {

@Override
public void onServiceDisconnected(ComponentName name) {
    Toast.makeText(getApplicationContext(), "disconnect", Toast.LENGTH_LONG).show();
    mService = null;
}

@Override
public void onServiceConnected(ComponentName name, IBinder service) {
    mService = INokiaIAPService.Stub.asInterface(service);
    if (isBillingSupported()) {
        Bundle productMappings = new Bundle(); 
        productMappings.putString("1023608", "com.testapp.sword");
        productMappings.putString("1023609", "com.testapp.mighty_sword");
        productMappings.putString("1023610", "com.testapp.axe");
        Toast.makeText(getApplicationContext(), "support billing", Toast.LENGTH_LONG).show();

        try {
            mService.setProductMappings(3, getPackageName(), productMappings);
            Toast.makeText(getApplicationContext(), "support billing work", Toast.LENGTH_LONG).show();
        } catch (RemoteException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }else {
        Toast.makeText(getApplicationContext(), "support not billing", Toast.LENGTH_LONG).show();
    }
}

}; このコードは私には機能しません。トーストが表示されていません。したがって、サービス接続が接続されていないことを意味します。マニフェストで請求許可を与えます。正しい結果が得られない理由を教えてください。

4

1 に答える 1

1

そのコードを Nokia X エミュレーターまたは実際のデバイスで実行していますか? 支払いイネーブラーが存在する場合は、サービスにバインドする必要があります。エミュレーターで実行している場合は、AVD ターゲットが Nokia X システム イメージであることを確認してください (nokia スタイルの UI を表示できます)。

Br、ジャンヌ

于 2014-04-03T13:22:27.537 に答える