我已将我的应用上传到Google Play,并在应用中添加了IAP.我可以成功检索我的应用程序的IAP列表及其价格,但当我实际尝试购买时,我的设备会出现以下错误(没有错误)
This version of the application is not configured for billing through
Google Play. Check the help centre for more information.
以下是检索IAP可用并进行购买的代码
ArrayList skuList = new ArrayList();
skuList.add("MysqLmanager_pro");
Bundle querySkus = new Bundle();
querySkus.putStringArrayList("ITEM_ID_LIST",skuList);
try
{
Bundle skuDetail = mService.getSkuDetails(3,getPackageName(),"inapp",querySkus);
Log.d("Billing","Response Received");
int billingResponse = skuDetail.getInt("RESPONSE_CODE");
if (billingResponse == 0)
{
//Get list of IAP's to purcase - NOT NEEDED
ArrayList responseList = skuDetail.getStringArrayList("DETAILS_LIST");
Log.d("Billing","Response");
Bundle buyIntentBundle = mService.getBuyIntent(3,"MysqLmanager_pro","");
PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");
startIntentSenderForResult(pendingIntent.getIntentSender(),Defines.IntentRequestCodes.IAP_PURCHASE_REQUEST,new Intent(),Integer.valueOf(0),Integer.valueOf(0));
/*for (String thisResponse : responseList)
{
JSONObject object = new JSONObject(thisResponse);
String sku = object.getString("productid");
String price = object.getString("price");
}*/
}
}
catch (Exception ex)
{
Log.e("Billing",ex.toString());
}
我的onCreate包含以下内容
mServiceConn = new ServiceConnection() {
@Override
public void onServicedisconnected(ComponentName name) {
mService = null;
}
@Override
public void onServiceConnected(ComponentName name,IBinder service) {
mService = IInAppBillingService.Stub.asInterface(service);
}
};
bindService(new Intent("com.android.vending.billing.InAppBillingService.BIND"),mServiceConn,Context.BIND_AUTO_CREATE);
以下是我的清单文件
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.BoardiesITSolutions.MysqLManager"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.android.vending.BILLING" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.BoardiesITSolutions.MysqLManager.Agreement"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/app_name">
</activity>
<activity
android:name=".NewDBConnection"
android:label="@string/new_MysqL_connection">
</activity>
<activity
android:name=".ConnectionManager"
android:label="@string/connection_manager">
<Meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity"/>
</activity>
<activity
android:name=".EditDBConnections"
android:label="@string/edit_database_connections">
</activity>
<activity
android:name=".ServerStatus"
android:label="Server Status">
<Meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ConnectionManager"/>
</activity>
<activity
android:name=".ConnectedDBManagerHost"
android:label="Connected to DB">
</activity>
<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>
感谢您的任何帮助,您可以提供
解决方法
>将apk上传到Google Play后,您需要等待一段时间
用于Google的服务器更新(类似于您发布时的服务器)
更新).根据我的经验,这可能需要一两个小时或更长时间.所以
几个小时后再试一次.
>确保为您上传的apk版本配置
IAP(通过权限),然后只用签名测试IAP
APK.也就是说,从Eclipse导出并签署你的apk,然后安装
本地到您的设备上.否则,如果您运行未签名的版本
直接来自IDE的应用程序,它将无法正常工作
你会看到一个错误.
注意:只要当前上载的草稿apk配置了正确的权限并且您在开发控制台上发布了IAP项目,就不需要在每次进行微小更改时上传新的apk.唯一令人讨厌的部分是,每次进行更改后都必须导出并签署应用程序并在本地设备上运行它.>检查上传的apk的versionCode是否相同versionCode作为apk的本地版本.>您无法使用开发者帐户进行测试购买,因为Google电子钱包不允许您从中购买商品你自己.因此,您需要在开发人员上设置一些测试帐户控制台并尝试从运行测试的设备购买项目帐户.