J'utilise PhoneGap 3.4 et le plugin InAppBrowser.InAppBrowser: Erreur lors du chargement du marché de l'url: // détails? Id = com.mydomain.myapp
Lorsque j'essaie d'ouvrir des URL externes, il lance le navigateur sans problème.
Cependant lorsque je tente de lancer URL pour évaluer mon application, je reçois l'erreur suivante:
05-13 04:30:34.527: D/InAppBrowser(2894): InAppBrowser: Error loading url market://details?id=com.mydomain.myapp:android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://details?id=com.mydomain.myapp }
Je vois qu'il ya une fonction sur InAppBrowser.java comme;
public String openExternal(String url) {
try {
Intent intent = null;
intent = new Intent(Intent.ACTION_VIEW);
// Omitting the MIME type for file: URLs causes "No Activity found to handle Intent".
// Adding the MIME type to http: URLs causes them to not be handled by the downloader.
Uri uri = Uri.parse(url);
if ("file".equals(uri.getScheme())) {
String mimeType = webView.getResourceApi().getMimeType(uri);
intent.setDataAndType(uri,mimeType);
} else {
intent.setData(uri);
}
this.cordova.getActivity().startActivity(intent);
return "";
} catch (android.content.ActivityNotFoundException e) {
Log.d(LOG_TAG, "InAppBrowser: Error loading url "+url+":"+ e.toString());
return e.toString();
}
}
Ce code me semble correct, mais il tombe toujours dans l'instruction catch. Y at-il une solution de contournement pour cela? MISE À JOUR: Le code fonctionne bien sur le périphérique réel, ne fonctionne pas pour l'émulateur, voici pourquoi;
https://stackoverflow.com/a/11073856/929902
c'est ok pour http: // urls mais ne fonctionne pas pour le marché: //. Avez-vous confirmé que cela fonctionne pour phonegap 3.4? –