Android 应用内计费 : Receiver's onReceive never getting called even after a successful purchase

标签 android service android-intent receiver in-app-billing

我不确定在此处放置什么代码,但我的应用程序中有一个有效的应用程序内购买设置(从某种意义上说,正确的金额和项目已计入我的帐户)但问题是更改从未显示在用户端,当他们购买商品时,接收器永远不会收到广播,这将允许我运行在本地保存购买的代码。

大部分代码我都是从这里复制过来的:

Simple in app billing Payment

所以我不知道是什么问题。没有任何卡住,一切正常,只是从不运行 BillingReceiver 的 onReceive() ......其他人有这个吗?

最佳答案

需要更多信息才能给出具体答案。我没有收到消息,因为我将接收方节点放在了 </application> 之后关闭节点。我应该把它放在 <application> 之间</application>标签。

<application android:icon blah blah...>
    <activity android:name="MyActivity">
    </activity>

    <service android:name=".BillingService" />
    <receiver android:name=".BillingReceiver">
          <intent-filter>
                <action android:name="com.android.vending.billing.IN_APP_NOTIFY" />
                <action android:name="com.android.vending.billing.RESPONSE_CODE" />
                <action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED" />         
          </intent-filter>
    </receiver> 
</application>

关于Android 应用内计费 : Receiver's onReceive never getting called even after a successful purchase,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6419877/

相关文章:

android - 是否可以在新线程中启动服务?

android - 使用 Intent 重新启动当前 Activity

tomcat - 如何在安装新的 tomcat 服务时添加 Java 选项

python - 如何使 Python 脚本(作为服务安装)在注销后仍然存在?

Android Studio - 将图像复制并粘贴到可绘制文件夹中不起作用

Java 类扩展了 MainActivity 但 findViewById 返回 null?

android - PhoneGap/Cordova 日历集成 (Android)

Android:如何通过 Intent 在 Facebook 上共享图像和文本?

android - 通过Gradle执行本地单元测试时,为什么BuildConfig.DEBUG设置为false?

android - RecyclerView Adapter 在更新不同的 observable 时更改列表