JNI callObject fails: Intent putExtra (ACTION_SEND)
I'm just developing a sample APP to demonstrate HowTo VIEW or EDIT files from inside your APP in other APPs,
then getting Response code to see if User canceled or saved the edited file.
There are some traps - per ex. you cannot directly use files stored as APP DATA - you must copy them first to DOCUMENTS location, then when user has done his work copy this file back into your APP or only delete if user canceled.
I'll demonstrate how such a workflow could be implemented.
The Android part is nearly done, iOS work in progress
APP and Blog will be published in a week or so
Now I'm having a problem creating an Android Intent via JNI for SEND_FILE action.
from Java this works:
My JNI call:
jniIntent.callObjectMethod("putExtra", "(Ljava/lang/String;Landroid/net/Uri;)Landroid/content/Intent;", jniExtra.object<jstring>(), jniUri.object<jobject>());
reports an error:
java.lang.NoSuchMethodError: no non-static method "Landroid/content/Intent;.putExtra(Ljava/lang/String;Landroid/net/Uri;)Landroid/content/Intent;"
another JNI call for ACTION_VIEW or ACTION_EDIT where I have to set the uri in method setDataAndType it works:
jniIntent.callObjectMethod("setDataAndType", "(Landroid/net/Uri;Ljava/lang/String;)Landroid/content/Intent;", jniUri.object<jobject>(), jniType.object<jstring>());
any idea what's wrong with my JNI Call for putExtra ?
You were missing the uri type. IT`s not an String, its a Parceable
intent.callObjectMethod("putExtra", "(Ljava/lang/String;Landroid/os/Parcelable;)Landroid/content/Intent;", QAndroidJniObject::fromString("android.intent.extra.STREAM").object<jstring>(), uri.object<jobject>());
@Kyrw thx. already found this out but forgot to mention here and to close the thread.