我嘗試添加應用內購買時被銷燬,當我打電話OpenIabHelper::launchPurchaseFlow
功能:
什麼力量機器人活動啓動另一個活動
- 我看到谷歌播放購買窗口
onStop
和onDestroy
在我的主要活動,而不調用那麼,到底執行onActivityResult
我留下GOOGLEPLAY窗口和我的死應用
我試圖通過startActivityForResult
啓動另一個活動,它工作得很好
(沒有被破壞,onActivityResult
叫),如此看來這個問題是OpenIAB library
因此,我的問題是:
什麼可能會迫使我的活動在致電OpenIabHelper::launchPurchaseFlow
後被銷燬?
它似乎不是系統,因爲它有足夠的內存,正如我所說startActivityForResult
工作正常。
也沒有例外是trown所以我很困惑
任何幫助,將不勝感激
MyActivity.java
public class MyActivity extends AppCompatActivity {
private OpenIabHelper m_helper;
private Boolean m_bOpenIabInitialized = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
OpenIabHelper.Options.Builder builder = new OpenIabHelper.Options.Builder()
.addAvailableStores(new GooglePlay(this,null))
.addPreferredStoreName(OpenIabHelper.NAME_GOOGLE)
.setStoreSearchStrategy(OpenIabHelper.Options.SEARCH_STRATEGY_INSTALLER_THEN_BEST_FIT)
.setVerifyMode(OpenIabHelper.Options.VERIFY_SKIP)
.setCheckInventory(false);
m_helper = new OpenIabHelper(this, builder.build());
m_helper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result) {
m_bOpenIabInitialized = result.isSuccess();
}
});
}
public void onListViewItemClicked(String sku, String payload) {
if (m_bOpenIabInitialized == null || !m_bOpenIabInitialized) return;
m_helper.launchPurchaseFlow(this, sku, 10001, null, payload);
}
@Override
public void startActivityForResult(Intent intent, int RequestCode) {
// never reaches here
Log.d(TAG, "startActivityForResult()");
}
@Override
protected void onActivityResult(int RequestCode, int ResultCode, Intent data) {
// never reaches here
Log.d(TAG, "onActivityResult()");
}
}
AndroidManifest.xml中
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example" >
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="com.android.vending.BILLING" />
<application
android:allowBackup="true"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
<activity
android:name=".MyActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar"
android:configChanges="orientation|screenSize|keyboardHidden|screenLayout">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
你不能在你的debug.apk –
測試Live產品SKU如此,照顧它 –
@VishalPatoliya很好的知道,但在釋放問題依然存在和谷歌商店活動工作正常 –