cordova-plugin-openwith
cordova-plugin-openwith copied to clipboard
Share video from youtube is giving items [null]
I have added this plugin to my project. When I share video link from android youtube application, it opens my app but items are null.
Same issue in late 2019. @j3k0, any ideas?
Same here, items array contains a single null value. It happens if I try to share a link or some text. It seems to work with an image.
I install the plugin with ANDROID_MIME_TYPE='*/*'
+1, sharing a video from youtube I can't get the url
still the issue
hi, this work for me. check if in AndroidManifest.xml has the following:
<intent-filter>
<data android:mimeType="image/jpeg" />
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<data android:mimeType="text/plain" />
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
In Serializer.java replace public static JSONObject toJSONObject:
public static JSONObject toJSONObject(
final ContentResolver contentResolver,
final Intent intent)
throws JSONException {
JSONArray items = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
items = itemsFromClipData(contentResolver, intent.getClipData());
}
if (items == null || items.length() == 0) {
items = itemsFromExtras(contentResolver, intent.getExtras());
}
if (items == null || items.length() == 0) {
items = itemsFromData(contentResolver, intent.getData());
}
if (items != null) {
if (items.get(0).toString() == "null" && dedondetxt=="getClipData") {
final JSONObject json = new JSONObject();
final LocalDateTime fechahora = LocalDateTime.now();
json.put("fechahora", fechahora);
json.put("urltxt", (String) intent.getExtras().getString(Intent.EXTRA_TEXT));
json.put("type", (String) "text/url");
json.put("dedondetxt", (String) dedondetxt);
final JSONObject[] itemstxt = new JSONObject[1];
itemstxt[0] = json;
items = new JSONArray(itemstxt);
}
}
if (items == null) {
return null;
}
final JSONObject action = new JSONObject();
action.put("action", translateAction(intent.getAction()));
action.put("exit", readExitOnSent(intent.getExtras()));
action.put("items", items);
return action;
}
i hope this help you.