Cordova PhoneGap插件返回按钮

Cordova PhoneGap插件返回按钮,cordova,youtube-api,phonegap-plugins,Cordova,Youtube Api,Phonegap Plugins,我使用以下代码从我的Phonegap/Cordova插件启动YouTubeStandalonePlayer意图: package com.remcob00.plugins.youtube; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.content.Intent; import

我使用以下代码从我的Phonegap/Cordova插件启动YouTubeStandalonePlayer意图:

package com.remcob00.plugins.youtube;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.app.Activity;
import android.content.Intent;

import org.apache.cordova.api.Plugin;
import org.apache.cordova.api.PluginResult;

import com.google.android.youtube.player.YouTubeInitializationResult;
import com.google.android.youtube.player.YouTubeStandalonePlayer;

public class YouTube extends Plugin {

@Override
public PluginResult execute(String action, JSONArray args, String callbackId) {
    try {
        JSONObject jo = args.getJSONObject(0);
        doSendIntent(jo.getString("videoid")); 
        return new PluginResult(PluginResult.Status.OK);
    } catch (JSONException e) {
        return new PluginResult(PluginResult.Status.JSON_EXCEPTION);
    }
}

private void doSendIntent(String videoid) {
    // API key instructions https://developers.google.com/youtube/android/player/register
    Intent youtubeIntent = YouTubeStandalonePlayer.createVideoIntent((Activity) this.cordova, "YOUR_API_KEY", videoid);
    this.cordova.startActivityForResult(this, youtubeIntent, 0);
}

}
()


但问题是,如果我打开YouTube Intent并按下后退按钮,它不会返回到打开Intent的页面,而是返回index.html文件。如何修复此问题?

如果找不到更好的解决方案,可以在每次页面更改后使用window.localStorage存储当前位置,然后在打开index.html时,检测恢复事件并检查window.localStorage的值是否为空


如果不是-只需重定向到该位置。

这似乎是Android Emulator中的一个问题。我已经在一台真正的设备上进行了测试,效果很好