android 计费 inApp/subscription 无法找到明确的 activity ProxyBillingActivity

android billing inApp/subscription Unable to find explicit activity ProxyBillingActivity

我想实现订阅计费功能,但是当我调用 launchBillingFlow 方法时,出现这样的错误

android.content.ActivityNotFoundException: Unable to find explicit activity class {com.calendargb/com.android.billingclient.api.ProxyBillingActivity}; have you declared this activity in your AndroidManifest.xml

这是我的样品

  BillingFlowParams purchaseParams = BillingFlowParams.newBuilder()
                    .setSku(skuId).setType(billingType).setOldSku(oldSku).build();
  mBillingClient.launchBillingFlow(mActivity, purchaseParams);

我应该在清单文件中显式声明 ProxyBillingActivity 吗?提前致谢!

您应该在清单文件中声明 ProxyBillingActivity,如下所示:

<activity
   android:name="com.android.billingclient.api.ProxyBillingActivity"
   android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
   android:theme="@android:style/Theme.Translucent.NoTitleBar" />

.class public Lcom/android/billingclient/api/ProxyBillingActivity; .super Landroid/app/Activity; .source ""

实例字段

.field private c:Landroid/os/ResultReceiver;

.field private d:Z

直接方法

.method public 构造函数 ()V .registers 1

invoke-direct {p0}, Landroid/app/Activity;-><init>()V

return-void

.结束方法

.method private final a()Landroid/content/Intent; .寄存器 3

new-instance v0, Landroid/content/Intent;

const-string v1, "com.android.vending.billing.PURCHASES_UPDATED"

invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

invoke-virtual {p0}, Landroid/app/Activity;->getApplicationContext()Landroid/content/Context;

move-result-object v1

invoke-virtual {v1}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

move-result-object v1

invoke-virtual {v0, v1}, Landroid/content/Intent;->setPackage(Ljava/lang/String;)Landroid/content/Intent;

return-object v0

.结束方法

虚拟方法

.方法保护 onActivityResult(IILandroid/content/Intent;)V .寄存器 8

invoke-super {p0, p1, p2, p3}, Landroid/app/Activity;->onActivityResult(IILandroid/content/Intent;)V

const/4 v0, 0x0

const-string v1, "ProxyBillingActivity"

const/16 v2, 0x64

if-ne p1, v2, :cond_73

invoke-static {p3, v1}, Lc/e/a/b/f/g/a;->a(Landroid/content/Intent;Ljava/lang/String;)Lcom/android/billingclient/api/g;

move-result-object p1

invoke-virtual {p1}, Lcom/android/billingclient/api/g;->b()I

move-result p1

const/4 v2, -0x1

if-ne p2, v2, :cond_1b

if-eqz p1, :cond_19

const/4 p2, -0x1

goto :goto_1b

:cond_19
const/4 p1, 0x0

goto :goto_39

:cond_1b
:goto_1b
new-instance v2, Ljava/lang/StringBuilder;

const/16 v3, 0x55

invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(I)V

const-string v3, "Activity finished with resultCode "

invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

invoke-virtual {v2, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

const-string p2, " and billing\'s responseCode: "

invoke-virtual {v2, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

move-result-object p2

invoke-static {v1, p2}, Lc/e/a/b/f/g/a;->b(Ljava/lang/String;Ljava/lang/String;)V

:goto_39
iget-object p2, p0, Lcom/android/billingclient/api/ProxyBillingActivity;->c:Landroid/os/ResultReceiver;

if-eqz p2, :cond_49

if-nez p3, :cond_41

const/4 p3, 0x0

goto :goto_45

:cond_41
invoke-virtual {p3}, Landroid/content/Intent;->getExtras()Landroid/os/Bundle;

move-result-object p3

:goto_45
invoke-virtual {p2, p1, p3}, Landroid/os/ResultReceiver;->send(ILandroid/os/Bundle;)V

goto :goto_8e

:cond_49
invoke-direct {p0}, Lcom/android/billingclient/api/ProxyBillingActivity;->a()Landroid/content/Intent;

move-result-object p1

if-eqz p3, :cond_6f

invoke-virtual {p3}, Landroid/content/Intent;->getExtras()Landroid/os/Bundle;

move-result-object p2

if-eqz p2, :cond_5d

invoke-virtual {p3}, Landroid/content/Intent;->getExtras()Landroid/os/Bundle;

move-result-object p2

invoke-virtual {p1, p2}, Landroid/content/Intent;->putExtras(Landroid/os/Bundle;)Landroid/content/Intent;

goto :goto_6f

:cond_5d
const-string p2, "Got null bundle!"

invoke-static {v1, p2}, Lc/e/a/b/f/g/a;->b(Ljava/lang/String;Ljava/lang/String;)V

const/4 p2, 0x6

const-string p3, "RESPONSE_CODE"

invoke-virtual {p1, p3, p2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;

const-string p2, "DEBUG_MESSAGE"

const-string p3, "An internal error occurred."

invoke-virtual {p1, p2, p3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

:cond_6f
:goto_6f
invoke-virtual {p0, p1}, Landroid/app/Activity;->sendBroadcast(Landroid/content/Intent;)V

goto :goto_8e

:cond_73
new-instance p2, Ljava/lang/StringBuilder;

const/16 p3, 0x45

invoke-direct {p2, p3}, Ljava/lang/StringBuilder;-><init>(I)V

const-string p3, "Got onActivityResult with wrong requestCode: "

invoke-virtual {p2, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

invoke-virtual {p2, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

const-string p1, "; skipping..."

invoke-virtual {p2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

invoke-virtual {p2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

move-result-object p1

invoke-static {v1, p1}, Lc/e/a/b/f/g/a;->b(Ljava/lang/String;Ljava/lang/String;)V

:goto_8e
iput-boolean v0, p0, Lcom/android/billingclient/api/ProxyBillingActivity;->d:Z

invoke-virtual {p0}, Landroid/app/Activity;->finish()V

return-void

.结束方法

.方法保护 onCreate(Landroid/os/Bundle;)V .寄存器 14

invoke-super {p0, p1}, Landroid/app/Activity;->onCreate(Landroid/os/Bundle;)V

const/4 v0, 0x0

const-string v1, "result_receiver"

const-string v2, "ProxyBillingActivity"

if-nez p1, :cond_a6

const-string p1, "Launching Play Store billing flow"

invoke-static {v2, p1}, Lc/e/a/b/f/g/a;->a(Ljava/lang/String;Ljava/lang/String;)V

invoke-virtual {p0}, Landroid/app/Activity;->getIntent()Landroid/content/Intent;

move-result-object p1

const-string v3, "BUY_INTENT"

invoke-virtual {p1, v3}, Landroid/content/Intent;->hasExtra(Ljava/lang/String;)Z

move-result p1

const/4 v4, 0x0

if-eqz p1, :cond_27

invoke-virtual {p0}, Landroid/app/Activity;->getIntent()Landroid/content/Intent;

move-result-object p1

invoke-virtual {p1, v3}, Landroid/content/Intent;->getParcelableExtra(Ljava/lang/String;)Landroid/os/Parcelable;

move-result-object p1

check-cast p1, Landroid/app/PendingIntent;

goto :goto_4b

:cond_27
invoke-virtual {p0}, Landroid/app/Activity;->getIntent()Landroid/content/Intent;

move-result-object p1

const-string v3, "SUBS_MANAGEMENT_INTENT"

invoke-virtual {p1, v3}, Landroid/content/Intent;->hasExtra(Ljava/lang/String;)Z

move-result p1

if-eqz p1, :cond_4a

invoke-virtual {p0}, Landroid/app/Activity;->getIntent()Landroid/content/Intent;

move-result-object p1

invoke-virtual {p1, v3}, Landroid/content/Intent;->getParcelableExtra(Ljava/lang/String;)Landroid/os/Parcelable;

move-result-object p1

check-cast p1, Landroid/app/PendingIntent;

invoke-virtual {p0}, Landroid/app/Activity;->getIntent()Landroid/content/Intent;

move-result-object v3

invoke-virtual {v3, v1}, Landroid/content/Intent;->getParcelableExtra(Ljava/lang/String;)Landroid/os/Parcelable;

move-result-object v1

check-cast v1, Landroid/os/ResultReceiver;

iput-object v1, p0, Lcom/android/billingclient/api/ProxyBillingActivity;->c:Landroid/os/ResultReceiver;

goto :goto_4b

:cond_4a
move-object p1, v4

:goto_4b
const/4 v1, 0x1

:try_start_4c
iput-boolean v1, p0, Lcom/android/billingclient/api/ProxyBillingActivity;->d:Z

invoke-virtual {p1}, Landroid/app/PendingIntent;->getIntentSender()Landroid/content/IntentSender;

move-result-object v6

new-instance v8, Landroid/content/Intent;

invoke-direct {v8}, Landroid/content/Intent;-><init>()V

const/16 v7, 0x64

const/4 v9, 0x0

const/4 v10, 0x0

const/4 v11, 0x0

move-object v5, p0

invoke-virtual/range {v5 .. v11}, Landroid/app/Activity;->startIntentSenderForResult(Landroid/content/IntentSender;ILandroid/content/Intent;III)V
:try_end_60
.catch Landroid/content/IntentSender$SendIntentException; {:try_start_4c .. :try_end_60} :catch_61

return-void

:catch_61
move-exception p1

invoke-static {p1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

move-result-object p1

invoke-static {p1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

move-result-object v1

invoke-virtual {v1}, Ljava/lang/String;->length()I

move-result v1

new-instance v3, Ljava/lang/StringBuilder;

add-int/lit8 v1, v1, 0x35

invoke-direct {v3, v1}, Ljava/lang/StringBuilder;-><init>(I)V

const-string v1, "Got exception while trying to start a purchase flow: "

invoke-virtual {v3, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

invoke-virtual {v3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

move-result-object p1

invoke-static {v2, p1}, Lc/e/a/b/f/g/a;->b(Ljava/lang/String;Ljava/lang/String;)V

iget-object p1, p0, Lcom/android/billingclient/api/ProxyBillingActivity;->c:Landroid/os/ResultReceiver;

const/4 v1, 0x6

if-eqz p1, :cond_8d

invoke-virtual {p1, v1, v4}, Landroid/os/ResultReceiver;->send(ILandroid/os/Bundle;)V

goto :goto_a0

:cond_8d
invoke-direct {p0}, Lcom/android/billingclient/api/ProxyBillingActivity;->a()Landroid/content/Intent;

move-result-object p1

const-string v2, "RESPONSE_CODE"

invoke-virtual {p1, v2, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;

const-string v1, "DEBUG_MESSAGE"

const-string v2, "An internal error occurred."

invoke-virtual {p1, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

invoke-virtual {p0, p1}, Landroid/app/Activity;->sendBroadcast(Landroid/content/Intent;)V

:goto_a0
iput-boolean v0, p0, Lcom/android/billingclient/api/ProxyBillingActivity;->d:Z

invoke-virtual {p0}, Landroid/app/Activity;->finish()V

return-void

:cond_a6
const-string v3, "Launching Play Store billing flow from savedInstanceState"

invoke-static {v2, v3}, Lc/e/a/b/f/g/a;->a(Ljava/lang/String;Ljava/lang/String;)V

const-string v2, "send_cancelled_broadcast_if_finished"

invoke-virtual {p1, v2, v0}, Landroid/os/Bundle;->getBoolean(Ljava/lang/String;Z)Z

move-result v0

iput-boolean v0, p0, Lcom/android/billingclient/api/ProxyBillingActivity;->d:Z

invoke-virtual {p1, v1}, Landroid/os/Bundle;->containsKey(Ljava/lang/String;)Z

move-result v0

if-eqz v0, :cond_c1

invoke-virtual {p1, v1}, Landroid/os/Bundle;->getParcelable(Ljava/lang/String;)Landroid/os/Parcelable;

move-result-object p1

check-cast p1, Landroid/os/ResultReceiver;

iput-object p1, p0, Lcom/android/billingclient/api/ProxyBillingActivity;->c:Landroid/os/ResultReceiver;

:cond_c1
return-void

.结束方法

.方法保护 onDestroy()V .寄存器 4

invoke-super {p0}, Landroid/app/Activity;->onDestroy()V

invoke-virtual {p0}, Landroid/app/Activity;->isFinishing()Z

move-result v0

if-nez v0, :cond_a

return-void

:cond_a
iget-boolean v0, p0, Lcom/android/billingclient/api/ProxyBillingActivity;->d:Z

if-nez v0, :cond_f

return-void

:cond_f
invoke-direct {p0}, Lcom/android/billingclient/api/ProxyBillingActivity;->a()Landroid/content/Intent;

move-result-object v0

const/4 v1, 0x1

const-string v2, "RESPONSE_CODE"

invoke-virtual {v0, v2, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;

const-string v1, "DEBUG_MESSAGE"

const-string v2, "Billing dialog closed."

invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

invoke-virtual {p0, v0}, Landroid/app/Activity;->sendBroadcast(Landroid/content/Intent;)V

return-void

.结束方法

.方法保护 onSaveInstanceState(Landroid/os/Bundle;)V .寄存器 4

iget-object v0, p0, Lcom/android/billingclient/api/ProxyBillingActivity;->c:Landroid/os/ResultReceiver;

if-eqz v0, :cond_9

const-string v1, "result_receiver"

invoke-virtual {p1, v1, v0}, Landroid/os/Bundle;->putParcelable(Ljava/lang/String;Landroid/os/Parcelable;)V

:cond_9
iget-boolean v0, p0, Lcom/android/billingclient/api/ProxyBillingActivity;->d:Z

const-string v1, "send_cancelled_broadcast_if_finished"

invoke-virtual {p1, v1, v0}, Landroid/os/Bundle;->putBoolean(Ljava/lang/String;Z)V

return-void

.结束方法