質問

私がやろうとしていること


こんにちは、私は自分のアプリ用に寄付用のアプリ内製品を作成しようとしています。私の友人の無料の音楽を配っているからです-彼はラップします。いずれにせよ、開発者アカウントで5つのアプリ内製品を作成しました:

  • donate_small
  • donate_midsmall
  • donate_medium
  • donate_large
  • donate_xlarge

    これは私がそこで生成した参照キーです。それらは保存され、公開されます。このチュートリアルでアプリ内サービスを作成した場合:アプリ内の簡単なチュートリアル。コードは完璧に機能しているようで、エラーはなく、デモコードをコンパイルすると機能します。しかし、試してみると、常にこのエラーが発生します: ジェネラコディセタグプレ

    質問


    では、ユーザーが異なるアプリ内製品を選択できるように変更するにはどうすればよいですか?どこかで宣言する必要がありますか?また、このようなものがすべて十分に説明され、完全に機能している、私にとって素晴らしいチュートリアルがある場合は、教えてください。

    これは、アプリ内サービスに使用するクラスです:

    de.stepforward

    • ChannelActivity
    • SplashActivity

      de.stepforward.billing

      • AppMainTest.class->これは私のアクティビティです
      • BillingHelper.class
      • BillingReceiver.class
      • BillingSecurity.class
      • BillingService.class
      • C.class

        de.stepforward.billing.util

        • Base64.class
        • Base64DecoderException.class

          今のところ、BillingHelperとアクティビティのコードを提供します。さらにコードが必要な場合は教えてください。

          コード


          AppMainTest.class ジェネラコディセタグプレ

          BillingHelper.class ジェネラコディセタグプレ


          事前にご協力いただきありがとうございます

          よろしく

          サファリ

          付録


          マニフェスト ジェネラコディセタグプレ

          LogCat(詳細情報) ジェネラコディセタグプレ

役に立ちましたか?

解決

If you take a look at this method:

  private static boolean amIDead() {
    if (mService == null || mContext == null) {
        Log.e(TAG, "BillingHelper not fully instantiated");
        return true;
    } else {
        return false;
    }
}

That log is printed when your Service is null or your context. Aaaand your service is null when:

 protected static void instantiateHelper(Context context, IMarketBillingService service) {
            mService = service;
            mContext = context;
    }

instantiateHelper is not called aaand

 @Override
    public void onServiceConnected(ComponentName name, IBinder service) {
            Log.i(TAG, "Market Billing Service Connected.");
            mService = IMarketBillingService.Stub.asInterface(service);
            BillingHelper.instantiateHelper(getBaseContext(), mService);
    }

is called when your Service is connected, and I can see you attempt to connect to the service like this:

 startService(new Intent(mContext, BillingService.class));

SO:

Have you declared the service in your manifest?

 <application ...
     <service android:name=".BillingService" />
     ...
 </application>

EDIT

I was right :-) It's just your service tag is outside your application tag.

See here: https://stackoverflow.com/a/5439157/413127

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top