问题
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);
But the service's onreceive() method never gets called.
Is there a different way of registering the activity to get receiver calls?
回答1:
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.
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>
来源:https://stackoverflow.com/questions/10547507/can-manifest-receiver-for-in-app-payment-be-moved-to-java-code-instead