Reputation: 147
i tried to implement in app purchase in adroid. I have everything set up correctly... I use following code :
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;
}
But if I set the product id instead of "android.test.purchased" to "com.company.item.itemID" the response i got from the store is ItemNotFound? DOes someone know what to do with this?
in my manifest.xml I set everything , like permission, service and other....... And everywhere i have set com.companyname.AppID. On google pla i Have set the app. and the item i set as published.
Does anyone know what to do with this?
Update:
<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>
Upvotes: 0
Views: 1646
Reputation: 5825
Try this:
Upvotes: 1