应用程序内结算V3服务nullpointer Android

San*_*der 5 java service binding android

目前我正在尝试"应用内结算V3".根据谷歌的说法,我必须创建一个服务,所以我已经做到了,但我无法绑定.

这是我的代码:

主要活动:

Intent("com.android.vending.billing.InAppBillingService.BIND"),
                    mServiceConn, Context.BIND_AUTO_CREATE);
Run Code Online (Sandbox Code Playgroud)

我也有这个:

IInAppBillingService mService;

ServiceConnection mServiceConn = new ServiceConnection() {

     public void onServiceConnected(ComponentName name, 
              IBinder service) {

                System.out.println("Test!");
               mService = IInAppBillingService.Stub.asInterface(service);
     }

     public void onServiceDisconnected(ComponentName name) {
       mService = null;
     }


};
Run Code Online (Sandbox Code Playgroud)

在我的清单文件中,我有这个:

<service android:name="com.android.vending.billing.IInAppBillingService" />

我使用http://developer.android.com/google/play/billing/billing_integrate.html作为来源.