我在我的应用程序中使用InApp V3代码进行应用内购买,我收到此错误,BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE并且error value :3当设备中没有Google帐户时.我想知道是否还有其他可能性来获取此错误,因为当我收到此错误时,我需要向用户显示一些数据弹出窗口.如果由于设备上没有Google帐户而导致此问题,我将显示包含相关文字的对话框.这是我正在使用的代码
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result) {
if (!result.isSuccess()) {
// error here
return;
}
}
});
Run Code Online (Sandbox Code Playgroud)
这是错误 Error checking for billing v3 support. (response: 3:Billing Unavailable)
我几天来一直在努力解决这个问题.我知道在SO上有很多关于同样问题的问题,但是我无法让它发挥作用.
我做了什么
码
AndroidManifest.xml中
<uses-permission android:name="com.android.vending.BILLING" />
MainActivity.java
public class MainActivity extends AppCompatActivity {
private IabHelper mHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// ...
setupInAppBillings();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (!mHelper.handleActivityResult(requestCode, resultCode, data)) {
super.onActivityResult(requestCode, resultCode, data);
}
}
// [....]
private void setupInAppBillings() {
String base64EncodedPublicKey = "MY PUBLIC KEY";
mHelper = new IabHelper(this, base64EncodedPublicKey);
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result) {
if (!result.isSuccess()) { …Run Code Online (Sandbox Code Playgroud)