Ich versuche, die Abrechnung in meiner Anwendung zu verwenden. Ich lese die offizielle Dokumentation, aber einige Dinge funktionieren nicht für mich.Methode queryInventoryAsync In-App-Abrechnung
Ich muss die Kosten für Käufe von ID erhalten. Aber mein Code nicht kompiliert:
MainActivity
import com.developer.skyline.livewallpapershd.util.IabHelper;
import com.developer.skyline.livewallpapershd.util.IabResult;
import com.developer.skyline.livewallpapershd.util.Inventory;
...
private IabHelper mHelper;
...
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String base64EncodedPublicKey = "My Public Key";
mHelper = new IabHelper(this, base64EncodedPublicKey);
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result) {
if (!result.isSuccess()) {
Log.i(TAG, "In-app Billing setup failed: " + result);
} else {
Log.i(TAG, "In-app Billing is set up OK");
try {
ArrayList<String> additionalSkuList = new ArrayList<String>();
additionalSkuList.add("all");
mHelper.queryInventoryAsync(true, additionalSkuList, mGotInventoryListener);
} catch (Exception e) {}
}
}
});
}
IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() {
public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
if (result.isFailure()) {
Log.i(TAG, "Query Inventory Error!");
} else {
Log.i(TAG, "Query Inventory Success!");
// update UI accordingly
}
}
};
Mein Problem ist nicht auf diese Methode queryInventoryAsync() im Zusammenhang
kann nicht aufgelöst Methode queryInventoryAsync
https://hostingkartinok.com/show-image.php?id=af1b85c0c86aa0663130d8ab2fe853f2
Ich sah ähnliche Fragen, aber ich fand keine Lösung für mich.
Log
Information:Gradle tasks [:app:assembleDebug]
D:\AndroidStudio\AndroidStudioProjects\LiveWallpapersHD\app\src\main\java\com\developer\skyline\livewallpapershd\MainActivity.java
Error:(62, 32) error: no suitable method found for queryInventoryAsync(boolean,ArrayList<String>,QueryInventoryFinishedListener)
method IabHelper.queryInventoryAsync(boolean,List<String>,List<String>,QueryInventoryFinishedListener) is not applicable
(actual and formal argument lists differ in length)
method IabHelper.queryInventoryAsync(QueryInventoryFinishedListener) is not applicable
(actual and formal argument lists differ in length)
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
Information:BUILD FAILED
Information:Total time: 2.838 secs
Information:2 errors
Information:0 warnings
Information:See complete output in console
https://developer.android.com/training/in-app-billing/list-iab-products.html – user233804
Danke, aber ich brauche die Dokumente nicht. Ich habe dir gerade gesagt, was mit deinem Code nicht stimmt. (Die von Ihnen gepostete Fehlermeldung gibt die erwarteten Parameter an.) IabHelper.queryInventoryAsync (Liste, Liste , QueryInventoryFinishedListener) ist nicht anwendbar (tatsächliche und formale Argumentlisten unterscheiden sich in der Länge) –
Kuffs
@ user233804 - Die Dokumente sind nicht wirklich hilfreich . Sie sind veraltet, du kannst nicht auf sie zählen. Ich weiß nicht, warum Google solche lückenhaften Informationen liefert, aber es ist so wie es ist.Wir müssen uns damit abfinden. Sehen Sie sich das GitHub-Projekt für IABHelper an. Du brauchst definitiv alle vier Parameter oder nur einen wie ich in meiner Antwort erwähnt habe. – Opiatefuchs