簡體   English   中英

找不到Android應用程式內購買商品

[英]Android in-App purchase Item not found

我試圖在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設置為“ com.company.item.itemID”而不是“ android.test.purchased”,則從商店獲得的響應為ItemNotFound? 有人知道該怎么辦嗎?

在manifest.xml文件中,我設置了所有內容,例如權限,服務和其他......。在所有地方,我都設置了com.companyname.AppID。 在google pla上,我已經設置了應用程序。 和我設置為已發布的項目。

有誰知道該怎么辦?

更新:

   <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>

嘗試這個:

  1. 將您的應用導出為APK文件。
  2. 將APK上載到Google Play。
  3. 將相同的APK側面載入您的測試設備。
  4. 等待一個小時左右,以便Google Play更新其服務器。
  5. 測試已安裝的APK。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM