我试图在adroid中的应用程序购买中实现。我已正确设置所有内容...我使用以下代码:
public void onClick(View v) {
switch (v.getId()) {
case R.id.main_purchase_yes:
if(BillingHelper.isBillingSupported()){
BillingHelper.requestPurchase(TopOption.this, "android.test.purchased");
// android.test.purchased or android.test.canceled or android.test.refunded or com.blundell.item.passport
} else {
Toast msg = Toast.makeText(TopOption.this, "Can't purchase on this device", Toast.LENGTH_LONG);
msg.setGravity(Gravity.CENTER, msg.getXOffset() / 2, msg.getYOffset() / 2);
msg.show();
Log.i(TAG,"Can't purchase on this device");
// XXX press button before service started will disable when it shouldnt
}
break;
default:
// nada
Log.i(TAG,"default. ID: "+v.getId());
break;
}
但是如果我将产品ID而不是“android.test.purchased”设置为“com.company.item.itemID” 我从商店得到的回复是ItemNotFound?有人知道该怎么做吗?
在我的manifest.xml中我设置了所有内容,如权限,服务和其他....... 在任何地方我都设置了com.companyname.AppID。 在谷歌我已经设置了应用程序。和我设置为已发布的项目。
有谁知道该如何处理?
更新
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.companyname.productid"
android:versionCode="1"
android:versionName="1.0" android:installLocation="preferExternal">
<uses-sdk
android:minSdkVersion="4"
android:targetSdkVersion="15" />
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.android.vending.BILLING" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/newname"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<activity
android:name=".TopOption"
android:label="@string/appName"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".mygame"
android:label="@string/title_activity_main"
android:screenOrientation="portrait">
</activity>
<activity
android:name=".aboutclass"
android:label="@string/title_activity_main"
android:screenOrientation="portrait" >
</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>
</manifest>
答案 0 :(得分:1)
试试这个: