开发者

In-app billing testing RESULT_DEVELOPER_ERROR

开发者 https://www.devze.com 2023-04-12 15:21 出处:网络
I\'m testing an app on my phone with a developer account and with test items (android.test.purchased). When I call the isBillingSupported() method, my ResponseCode is RESULT_DEVELOPER_ERROR. I didn\'t

I'm testing an app on my phone with a developer account and with test items (android.test.purchased). When I call the isBillingSupported() method, my ResponseCode is RESULT_DEVELOPER_ERROR. I didn't publish the app on the market, but I read that it is unnecessary because I use android.test.purchased.

<uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <uses-permission android:name="android.permission.READ_OWNER_DATA"/>
    <uses-permission android:name="android.permission.WRITE_OWNER_DATA"/>        
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_S开发者_运维问答TORAGE"/>  
    <uses-permission android:name="com.android.vending.BILLING"/>

I uploaded it on the market as a draft, and still no luck... I'm losing my nerve...


To answer the questions in your comments to @Samir's answer:

"my question is do i need to sign an app for release"

Yes, you do.

"do i need to publish on market???"

No, you don't.


Make sure your package name is correct.

Although you will eventually need to have the app signed for release (how to do this), you should be able to call isBillingSupported()WITHOUT signing the app, and have it return RESULT_OKas long as you have the BILLING permission on AND your package name is the same exact one for your app. I was using a different, hard coded package name, and isBillingSupported()was returning RESULT_DEVELOPER_ERROR.

So here is my working code that calls isBillingSupported():

String packageName = context.getPackageName();

try
{
    IInAppBillingService service = activity.getBillingService();
    int response = service.isBillingSupported(3, packageName, "inapp");
    Log.i("mylogtag", "response: " + response);
}
catch (RemoteException re)
{
    re.printStackTrace();
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号