Javascript 钛安卓,接收意图,如何访问本机文件?

Javascript 钛安卓,接收意图,如何访问本机文件?,javascript,android-intent,titanium,titanium-android,Javascript,Android Intent,Titanium,Titanium Android,在我的TiApp.xml中,我得到了以下块: <activity android:name=".TestActivity" android:label="@string/app_name" android:theme="@style/Theme.Titanium" android:configChanges="keyboardHidden|orientation|screenSize"> <intent-filter> <action and

在我的TiApp.xml中,我得到了以下块:

<activity android:name=".TestActivity" android:label="@string/app_name" android:theme="@style/Theme.Titanium" android:configChanges="keyboardHidden|orientation|screenSize">
    <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
    </intent-filter>
    <intent-filter android:label="@string/kmob.intent.menu.send">
        <data android:mimeType="*/*"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <action android:name="android.intent.action.SEND"/>
    </intent-filter>
</activity>
如何访问本机文件或其文件名?或者至少是它的延伸?(这是我唯一需要的东西,因为我有文件内容。我可以通过我需要的扩展名创建一个包含内容的临时文件)

在文档中,我只能找到带有简单文本文件或仅显示图像内容的示例。他们从不访问本机文件或其文件名

这里是intent和blob的字符串表示:

intent = {
    "action": "android.intent.action.SEND",
    "bubbleParent": true,
    "data": null,
    "type": "image/jpeg", // NOTE : This value is not always the same. For an android 4.2.x, it's "image/jpeg", on android 4.1.x, it's "image/*".
    "apiName": "Ti.Android.Intent",
    "flags": 50331649
};

blob = {
    "height": 0,
    "bubbleParent": true,
    "type": 2,
    "mimeType": "application/octet-stream",
    "apiName": "Ti.Blob",
    "nativePath": null,
    "file": null,
    "text": "<IMAGE CONTENT AS STRING>"
}
intent={
“action”:“android.intent.action.SEND”,
“泡泡父母”:没错,
“数据”:空,
“type”:“image/jpeg”,//注意:此值并不总是相同的。对于android 4.2.x,它是“image/jpeg”,而对于android 4.1.x,它是“image/*”。
“apiName”:“Ti.Android.Intent”,
“旗帜”:50331649
};
水滴={
“高度”:0,
“泡泡父母”:没错,
“类型”:2,
“mimeType”:“应用程序/八位字节流”,
“apiName”:“Ti.Blob”,
“nativePath”:空,
“文件”:空,
“文本”:”
}

您应该尝试读取blob对象的
nativePath
属性。这应该表示文件位置,包括文件名(以及我猜的扩展名)


另一种可能是访问
blob.file
属性。然后您可以使用
blob.file.getName()
访问文件名。

您应该尝试读取blob对象的
nativePath
属性。这应该表示文件位置,包括文件名(以及我猜的扩展名)


另一种可能是访问
blob.file
属性。然后可以使用
blob.file.getName()
访问文件名。

已尝试,但未成功:(blob仅包含图像内容。
blob.file
blob.nativePath
均为
null
。我将使用blob的字符串表示形式编辑我的问题。您的blob似乎不代表文件。根据此问题:开发人员无法访问nativePath和文件(至少对于iOS来说,这可能也是问题所在。)mimeType=application/octet流表示blob不知道原始文件的文件扩展名。已尝试,但未成功:(blob仅包含图像内容。
blob.file
blob.nativePath
均为
null
。我将使用blob的字符串表示形式编辑我的问题。您的blob似乎不代表文件。根据此问题:开发人员无法访问nativePath和文件(至少对于iOS来说,这可能也是这里的问题。)mimeType=application/octet流表示blob不知道原始文件具有哪个文件扩展名。
intent = {
    "action": "android.intent.action.SEND",
    "bubbleParent": true,
    "data": null,
    "type": "image/jpeg", // NOTE : This value is not always the same. For an android 4.2.x, it's "image/jpeg", on android 4.1.x, it's "image/*".
    "apiName": "Ti.Android.Intent",
    "flags": 50331649
};

blob = {
    "height": 0,
    "bubbleParent": true,
    "type": 2,
    "mimeType": "application/octet-stream",
    "apiName": "Ti.Blob",
    "nativePath": null,
    "file": null,
    "text": "<IMAGE CONTENT AS STRING>"
}