我正因不恰当的购买而与ServiceConnection做斗争。ServiceConnected或onServiceDisconnected上的任何方法都不会被调用。罗格猫是空的!我做错了什么?
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.inapp);
mServiceConn = new ServiceConnection() {
@Override
public void onServiceDisconnected(ComponentName name) {
mService = null;
showtouser("Disconnection from server");
}
@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);
showtouser("");
}
};发布于 2014-03-16 09:25:39
Ofc什么也不做,因为回调方法onServiceConnected()是在绑定成功后调用的。现在,在bindService()被绑定后调用它。此代码没有操作。例如,在setContentView()之后调用它。检查docs http://developer.android.com/guide/components/bound-services.html
https://stackoverflow.com/questions/22435102
复制相似问题