能体现接收机在应用程序的支付被转移到Java的code呢? [英] Can Manifest Receiver for In app payment be moved to Java code instead?

查看:332
本文介绍了能体现接收机在应用程序的支付被转移到Java的code呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谷歌例如在应用程序内支付说明添加了清单实体,以便收到付款确认。但是,在本机扩展的AIR,接收器将无法找到它的不同的包。让我感动的接收器部分code如下:

Google example for in-app payment suggests to add the manifest entry in order to receive the payment confirmations. But in Native Extension for AIR, the receiver will not be found as its a different package. So i moved the receiver part to code as follows

final IntentFilter filter = new IntentFilter("com.android.vending.billing.IN_APP_NOTIFY");
filter.addAction("com.android.vending.billing.RESPONSE_CODE");
filter.addAction("com.android.vending.billing.PURCHASE_STATE_CHANGED");

a.registerReceiver(billingReceiver, filter);   

但服务的的onReceive()方法永远不会被调用。

But the service's onreceive() method never gets called.

是否有登记的活性以获得接收机的呼叫不同的方式?

Is there a different way of registering the activity to get receiver calls?

推荐答案

据一些参考点,增加在code账单接收器不工作。所以,把它移到清单文件,删除的软件包,并从根目录中提到它。所以,问题就解决了​​。

According to some reference sites, adding the billing receiver in code doesn't work. So moved it to manifest file, removed the package and referred it from the root directory. So problem solved.

清单的AIR应用程序看起来像这样为那些谁试图了解更多信息!

Manifest for AIR app would look like this for more info for those who are trying out!

<android>
    <manifestAdditions>

      <![CDATA[
      <manifest android:installLocation="auto">
       <uses-permission android:name="com.android.vending.BILLING" />
        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.RECORD_AUDIO"/>
      <uses-permission android:name="android.permission.VIBRATE"/>

        <application>

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

        <receiver android:name="<package>.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>


</manifest>]]>
    </manifestAdditions>
  </android>

这篇关于能体现接收机在应用程序的支付被转移到Java的code呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆