Phonegap で Android アプリを作成しました。
私の JavaScript コード内では、次のことを行います。
window.location.href = "http://m.facebook.com/dialog/" + params;
.. Facebook にリダイレクトしたいからです。これまでのところ問題なく動作していますが、Android デバイスの [戻る] ボタンを押すと、アプリにエラー メッセージが表示されたポップアップが表示されます。
Application Error
A network error occured. (file:///android_asset//www/index.html#article?id=61142746)
ログを確認したところ、Facebook ページにアクセスすると次のように出力されました。
11-30 16:50:25.480: I/PRIME(12998): <CallBackProxy> Send to WebViewClient.
11-30 16:50:25.480: D/CordovaWebView(12998): >>> loadUrl(http://m.facebook.com/dialog/feed?app_id=408479945865356&link=http://nachrichten.mydomain.de/obama-geraet-wegen-seiner-personalpolitik-weiter-in-bredouille/id_61142746/index&picture=http://mcp.mydomain.de/images/id_61143440/af_amp/bilder/uno-botschafterin-und-obama-vertraute-susan-rice-unter-beschuss.jpg&name=Skandalkandidatin%20bringt%20Obama%20in%20die%20Bredouille%0A&caption=mydomain.de%20Nachrichten&description=Skandalkandidatin%20bringt%20Obama%20in%20die%20Bredouille%0A...&redirect_uri=http://nachrichten.mydomain.de/obama-geraet-wegen-seiner-personalpolitik-weiter-in-bredouille/id_61142746/index)
11-30 16:50:25.490: D/CordovaWebView(12998): >>> loadUrlNow()
11-30 16:50:25.620: W/webcore(12998): [webViewCore::webkitDraw] defer message ====
11-30 16:50:25.640: W/System.err(12998): java.net.SocketException: Socket closed
11-30 16:50:25.640: W/System.err(12998): at libcore.io.Posix.accept(Native Method)
11-30 16:50:25.640: W/System.err(12998): at libcore.io.BlockGuardOs.accept(BlockGuardOs.java:55)
11-30 16:50:25.640: W/System.err(12998): at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:98)
11-30 16:50:25.640: W/System.err(12998): at java.net.ServerSocket.implAccept(ServerSocket.java:202)
11-30 16:50:25.640: W/System.err(12998): at java.net.ServerSocket.accept(ServerSocket.java:127)
11-30 16:50:25.640: W/System.err(12998): at org.apache.cordova.CallbackServer.run(CallbackServer.java:195)
11-30 16:50:25.640: W/System.err(12998): at java.lang.Thread.run(Thread.java:864)
11-30 16:50:25.650: D/DroidGap(12998): onMessage(onPageStarted,http://m.facebook.com/dialog/feed?app_id=408479945865356&link=http://nachrichten.mydomain.de/obama-geraet-wegen-seiner-personalpolitik-weiter-in-bredouille/id_61142746/index&picture=http://mcp.mydomain.de/images/id_61143440/af_amp/bilder/uno-botschafterin-und-obama-vertraute-susan-rice-unter-beschuss.jpg&name=Skandalkandidatin%20bringt%20Obama%20in%20die%20Bredouille%0A&caption=mydomain.de%20Nachrichten&description=Skandalkandidatin%20bringt%20Obama%20in%20die%20Bredouille%0A...&redirect_uri=http://nachrichten.mydomain.de/obama-geraet-wegen-seiner-personalpolitik-weiter-in-bredouille/id_61142746/index)
11-30 16:50:25.830: I/PRIME(12998): <CallBackProxy> Send to WebViewClient.
11-30 16:50:25.830: D/CordovaWebView(12998): >>> loadUrl(http://m.facebook.com/login.php?app_id=408479945865356&skip_api_login=1&cancel=http%3A%2F%2Fnachrichten.mydomain.de%2Fobama-geraet-wegen-seiner-personalpolitik-weiter-in-bredouille%2Fid_61142746%2Findex&next=http%3A%2F%2Fm.facebook.com%2Fdialog%2Ffeed%3F_path%3Dfeed%26app_id%3D408479945865356%26redirect_uri%3Dhttp%253A%252F%252Fnachrichten.mydomain.de%252Fobama-geraet-wegen-seiner-personalpolitik-weiter-in-bredouille%252Fid_61142746%252Findex%26display%3Dtouch%26link%3Dhttp%253A%252F%252Fnachrichten.mydomain.de%252Fobama-geraet-wegen-seiner-personalpolitik-weiter-in-bredouille%252Fid_61142746%252Findex%26picture%3Dhttp%253A%252F%252Fmcp.mydomain.de%252Fimages%252Fid_61143440%252Faf_amp%252Fbilder%252Funo-botschafterin-und-obama-vertraute-susan-rice-unter-beschuss.jpg%26name%3DSkandalkandidatin%2Bbringt%2BObama%2Bin%2Bdie%2BBredouille%250A%26caption%3Dmydomain.de%2BNachrichten%26description%3DSkandalkandidatin%2Bbringt%2BObama%2Bin%2Bdie%2BBredouille%250A...%26from_login%3D1%26client_id%3D408479945865356&rcount=1&_rdr)
11-30 16:50:25.830: D/CordovaWebView(12998): >>> loadUrlNow()
11-30 16:50:25.830: D/skia(12998): notifyPluginsOnFrameLoad not postponed
11-30 16:50:25.830: D/Cordova(12998): onPageFinished(http://m.facebook.com/login.php?app_id=408479945865356&skip_api_login=1&cancel=http%3A%2F%2Fnachrichten.mydomain.de%2Fobama-geraet-wegen-seiner-personalpolitik-weiter-in-bredouille%2Fid_61142746%2Findex&next=http%3A%2F%2Fm.facebook.com%2Fdialog%2Ffeed%3F_path%3Dfeed%26app_id%3D408479945865356%26redirect_uri%3Dhttp%253A%252F%252Fnachrichten.mydomain.de%252Fobama-geraet-wegen-seiner-personalpolitik-weiter-in-bredouille%252Fid_61142746%252Findex%26display%3Dtouch%26link%3Dhttp%253A%252F%252Fnachrichten.mydomain.de%252Fobama-geraet-wegen-seiner-personalpolitik-weiter-in-bredouille%252Fid_61142746%252Findex%26picture%3Dhttp%253A%252F%252Fmcp.mydomain.de%252Fimages%252Fid_61143440%252Faf_amp%252Fbilder%252Funo-botschafterin-und-obama-vertraute-susan-rice-unter-beschuss.jpg%26name%3DSkandalkandidatin%2Bbringt%2BObama%2Bin%2Bdie%2BBredouille%250A%26caption%3Dmydomain.de%2BNachrichten%26description%3DSkandalkandidatin%2Bbringt%2BObama%2Bin%2Bdie%2BBredouille%250A...%26from_login%3D1%26client_id%3D408479945865356&rcount=1&_rdr)
11-30 16:50:25.830: D/CordovaWebView(12998): >>> loadUrlNow()
11-30 16:50:25.830: D/DroidGap(12998): onMessage(onNativeReady,null)
11-30 16:50:25.830: D/DroidGap(12998): onMessage(onPageFinished,http://m.facebook.com/login.php?app_id=408479945865356&skip_api_login=1&cancel=http%3A%2F%2Fnachrichten.mydomain.de%2Fobama-geraet-wegen-seiner-personalpolitik-weiter-in-bredouille%2Fid_61142746%2Findex&next=http%3A%2F%2Fm.facebook.com%2Fdialog%2Ffeed%3F_path%3Dfeed%26app_id%3D408479945865356%26redirect_uri%3Dhttp%253A%252F%252Fnachrichten.mydomain.de%252Fobama-geraet-wegen-seiner-personalpolitik-weiter-in-bredouille%252Fid_61142746%252Findex%26display%3Dtouch%26link%3Dhttp%253A%252F%252Fnachrichten.mydomain.de%252Fobama-geraet-wegen-seiner-personalpolitik-weiter-in-bredouille%252Fid_61142746%252Findex%26picture%3Dhttp%253A%252F%252Fmcp.mydomain.de%252Fimages%252Fid_61143440%252Faf_amp%252Fbilder%252Funo-botschafterin-und-obama-vertraute-susan-rice-unter-beschuss.jpg%26name%3DSkandalkandidatin%2Bbringt%2BObama%2Bin%2Bdie%2BBredouille%250A%26caption%3Dmydomain.de%2BNachrichten%26description%3DSkandalkandidatin%2Bbringt%2BObama%2Bin%2Bdie%2BBredouille%250A...%26from_login%3D1%26client_id%3D408479945865356&rcount=1&_rdr)
11-30 16:50:25.840: D/DroidGap(12998): onMessage(onPageStarted,http://m.facebook.com/login.php?app_id=408479945865356&skip_api_login=1&cancel=http%3A%2F%2Fnachrichten.mydomain.de%2Fobama-geraet-wegen-seiner-personalpolitik-weiter-in-bredouille%2Fid_61142746%2Findex&next=http%3A%2F%2Fm.facebook.com%2Fdialog%2Ffeed%3F_path%3Dfeed%26app_id%3D408479945865356%26redirect_uri%3Dhttp%253A%252F%252Fnachrichten.mydomain.de%252Fobama-geraet-wegen-seiner-personalpolitik-weiter-in-bredouille%252Fid_61142746%252Findex%26display%3Dtouch%26link%3Dhttp%253A%252F%252Fnachrichten.mydomain.de%252Fobama-geraet-wegen-seiner-personalpolitik-weiter-in-bredouille%252Fid_61142746%252Findex%26picture%3Dhttp%253A%252F%252Fmcp.mydomain.de%252Fimages%252Fid_61143440%252Faf_amp%252Fbilder%252Funo-botschafterin-und-obama-vertraute-susan-rice-unter-beschuss.jpg%26name%3DSkandalkandidatin%2Bbringt%2BObama%2Bin%2Bdie%2BBredouille%250A%26caption%3Dmydomain.de%2BNachrichten%26description%3DSkandalkandidatin%2Bbringt%2BObama%2Bin%2Bdie%2BBredouille%250A...%26from_login%3D1%26client_id%3D408479945865356&rcount=1&_rdr)
11-30 16:50:26.670: D/skia(12998): notifyPluginsOnFrameLoad not postponed
11-30 16:50:26.680: D/Cordova(12998): onPageFinished(http://m.facebook.com/login.php?app_id=408479945865356&skip_api_login=1&cancel=http%3A%2F%2Fnachrichten.mydomain.de%2Fobama-geraet-wegen-seiner-personalpolitik-weiter-in-bredouille%2Fid_61142746%2Findex&next=http%3A%2F%2Fm.facebook.com%2Fdialog%2Ffeed%3F_path%3Dfeed%26app_id%3D408479945865356%26redirect_uri%3Dhttp%253A%252F%252Fnachrichten.mydomain.de%252Fobama-geraet-wegen-seiner-personalpolitik-weiter-in-bredouille%252Fid_61142746%252Findex%26display%3Dtouch%26link%3Dhttp%253A%252F%252Fnachrichten.mydomain.de%252Fobama-geraet-wegen-seiner-personalpolitik-weiter-in-bredouille%252Fid_61142746%252Findex%26picture%3Dhttp%253A%252F%252Fmcp.mydomain.de%252Fimages%252Fid_61143440%252Faf_amp%252Fbilder%252Funo-botschafterin-und-obama-vertraute-susan-rice-unter-beschuss.jpg%26name%3DSkandalkandidatin%2Bbringt%2BObama%2Bin%2Bdie%2BBredouille%250A%26caption%3Dmydomain.de%2BNachrichten%26description%3DSkandalkandidatin%2Bbringt%2BObama%2Bin%2Bdie%2BBredouille%250A...%26from_login%3D1%26client_id%3D408479945865356&rcount=1&_rdr)
11-30 16:50:26.680: D/CordovaWebView(12998): >>> loadUrlNow()
11-30 16:50:26.680: D/DroidGap(12998): onMessage(onNativeReady,null)
11-30 16:50:26.680: D/DroidGap(12998): onMessage(onPageFinished,http://m.facebook.com/login.php?app_id=408479945865356&skip_api_login=1&cancel=http%3A%2F%2Fnachrichten.mydomain.de%2Fobama-geraet-wegen-seiner-personalpolitik-weiter-in-bredouille%2Fid_61142746%2Findex&next=http%3A%2F%2Fm.facebook.com%2Fdialog%2Ffeed%3F_path%3Dfeed%26app_id%3D408479945865356%26redirect_uri%3Dhttp%253A%252F%252Fnachrichten.mydomain.de%252Fobama-geraet-wegen-seiner-personalpolitik-weiter-in-bredouille%252Fid_61142746%252Findex%26display%3Dtouch%26link%3Dhttp%253A%252F%252Fnachrichten.mydomain.de%252Fobama-geraet-wegen-seiner-personalpolitik-weiter-in-bredouille%252Fid_61142746%252Findex%26picture%3Dhttp%253A%252F%252Fmcp.mydomain.de%252Fimages%252Fid_61143440%252Faf_amp%252Fbilder%252Funo-botschafterin-und-obama-vertraute-susan-rice-unter-beschuss.jpg%26name%3DSkandalkandidatin%2Bbringt%2BObama%2Bin%2Bdie%2BBredouille%250A%26caption%3Dmydomain.de%2BNachrichten%26description%3DSkandalkandidatin%2Bbringt%2BObama%2Bin%2Bdie%2BBredouille%250A...%26from_login%3D1%26client_id%3D408479945865356&rcount=1&_rdr)
11-30 16:50:26.840: D/SQLiteDatabase(12998): Create pool connection
11-30 16:50:26.840: D/SqliteDatabaseCpp(12998): DB info: open db, path = /data/data/de.mydomain2.my_place_de/databases , key = sefraes, flag = 1, file size = 12288
11-30 16:50:26.840: D/SqliteDatabaseCpp(12998): DB info: path = /data/data/de.mydomain2.my_place_de/databases , key = sefraes, handle: 0xb14f98, type: r, r/w: (1,1), mode: wal, disk free size: 1753 M
11-30 16:50:26.890: I/SqliteDatabaseCpp(12998): sqlite returned: error code = 1, msg = no such table: __version__
そして、これは、戻るボタンを押したときにログに表示される内容です。
11-30 16:50:52.210: D/CordovaWebView(12998): >>> loadUrl(file:///android_asset/www/index.html#article?id=61142746)
11-30 16:50:52.210: D/CordovaWebView(12998): >>> loadUrlNow()
11-30 16:50:52.220: D/chromium(12998): Unknown chromium error: -6
11-30 16:50:52.220: D/DroidGap(12998): onMessage(onPageStarted,file:///android_asset/www/index.html#article?id=61142746)
11-30 16:50:52.230: D/Cordova(12998): CordovaWebViewClient.onReceivedError: Error code=-1 Description=Es ist ein Netzwerkfehler aufgetreten. URL=file:///android_asset/www/index.html#article?id=61142746
11-30 16:50:52.230: D/DroidGap(12998): onMessage(onReceivedError,{"errorCode":-1,"url":"file:\/\/\/android_asset\/www\/index.html#article?id=61142746","description":"Es ist ein Netzwerkfehler aufgetreten."})
11-30 16:50:52.320: D/skia(12998): notifyPluginsOnFrameLoad not postponed
11-30 16:50:52.350: W/System.err(12998): java.net.SocketException: Socket closed
11-30 16:50:52.350: W/System.err(12998): at libcore.io.Posix.accept(Native Method)
11-30 16:50:52.350: W/System.err(12998): at libcore.io.BlockGuardOs.accept(BlockGuardOs.java:55)
11-30 16:50:52.350: W/System.err(12998): at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:98)
11-30 16:50:52.350: W/System.err(12998): at java.net.ServerSocket.implAccept(ServerSocket.java:202)
11-30 16:50:52.350: W/System.err(12998): at java.net.ServerSocket.accept(ServerSocket.java:127)
11-30 16:50:52.360: W/System.err(12998): at org.apache.cordova.CallbackServer.run(CallbackServer.java:195)
11-30 16:50:52.360: W/System.err(12998): at java.lang.Thread.run(Thread.java:864)
11-30 16:50:52.360: D/DroidGap(12998): onMessage(onPageStarted,file:///android_asset/www/index.html#article?id=61142746)
11-30 16:50:52.360: D/Cordova(12998): onPageFinished(file:///android_asset/www/index.html#article?id=61142746)
11-30 16:50:52.360: D/CordovaWebView(12998): >>> loadUrlNow()
11-30 16:50:52.370: D/DroidGap(12998): onMessage(onNativeReady,null)
11-30 16:50:52.370: D/DroidGap(12998): onMessage(onPageFinished,file:///android_asset/www/index.html#article?id=61142746)
11-30 16:50:52.370: D/SoftKeyboardDetect(12998): Ignore this event
11-30 16:50:52.390: D/Cordova(12998): onPageFinished(file:///android_asset/www/index.html#article?id=61142746)
11-30 16:50:52.390: D/CordovaWebView(12998): >>> loadUrlNow()
11-30 16:50:52.390: D/DroidGap(12998): onMessage(onNativeReady,null)
11-30 16:50:52.390: D/DroidGap(12998): onMessage(onPageFinished,file:///android_asset/www/index.html#article?id=61142746)
どうしたの?
注:これは、これらのデバイスでのみ発生します。
- HTC ワン
- サムスンギャラクシーノート
次の場合は発生しません。
- HTCセンセーション
- サムスンギャラクシー S2
- サムスンギャラクシーS3