LA_*_*LA_ 4 service binding android in-app-purchase
我正在尝试基于示例应用程序在我的应用程序中实现应用内结算.但bindService总是回归false.
这就是我所拥有的. AndroidManifest.xml:
<service android:name="tv.app.billing.BillingService" />
Run Code Online (Sandbox Code Playgroud)
Preferences.java(需要从Preferences屏幕开始购买):
protected void onCreate(Bundle savedInstanceState) {
mBillingService = new BillingService();
mBillingService.setContext(this); // tried to use getApplicationContext also
Run Code Online (Sandbox Code Playgroud)
BillingService.java:公共类BillingService extends Service实现ServiceConnection {
/**
* Binds to the MarketBillingService and returns true if the bind
* succeeded.
* @return true if the bind succeeded; false otherwise
*/
private boolean bindToMarketBillingService() {
try {
if (Debug.DEBUG) {
Log.i(TAG, "binding to Market billing service");
}
boolean bindResult = bindService(
new Intent(Consts.MARKET_BILLING_SERVICE_ACTION),
this, // ServiceConnection.
Context.BIND_AUTO_CREATE);
if (bindResult) {
return true;
} else {
Log.e(TAG, "Could not bind to service.");
}
} catch (SecurityException e) {
Log.e(TAG, "Security exception: " + e);
}
return false;
}
Run Code Online (Sandbox Code Playgroud)
在LogCat中我看到:
WARN/ActivityManager(48): Unable to start service Intent { act=com.android.vending.billing.MarketBillingService.BIND }: not found
Run Code Online (Sandbox Code Playgroud)
我需要在这里纠正什么?
| 归档时间: |
|
| 查看次数: |
5816 次 |
| 最近记录: |