【发布时间】:2014-05-07 19:21:59
【问题描述】:
我可以将我的 cordova 应用程序添加到共享界面中,但我不知道如何将共享图片带入我的 cordova 应用程序。
我使用了 com.borismus.webintent 插件
我正在设备中调用下面的代码,但没有运气。
function startActivity() {
alert('start');
window.plugins.webintent.startActivity({
action: window.plugins.webintent.ACTION_VIEW,
url: theFile.toURL(),
type: 'application/vnd.android.package-archive'
},
function () { alert('success');},
function () {
alert('Failed to open URL via Android Intent.');
console.log("Failed to open URL via Android Intent. URL: " + theFile.fullPath)
}
);
}
function broadcast() {
window.plugins.webintent.sendBroadcast({
action: 'com.dummybroadcast.action.triggerthing',
extras: {
'option': true
}
}, function (args) {
alert(args);
}, function (args) {
alert(args);
});
}
function getURI() {
window.plugins.webintent.getUri(function (url) {
if (url !== "") {
// url is the url the intent was launched with
alert(url);
}
else {
alert('ddfsdf');
}
});
}
如果我点击 sahre 图标,我的要求是在图库中,我的应用程序应该出现在那里,一旦我选择我的应用程序,我应该能够在我的 cordova 应用程序中获取该图像。
我使用的是cordova 3.4.0,android
我的 AndroidManifest.xml 是
<application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:name="Share" android:theme="@android:style/Theme.Black.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.SEND_MULTIPLE" />
<data android:mimeType="application/vnd.google.panorama360+jpg" />
<data android:mimeType="image/*" />
<data android:mimeType="video/*" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="com.creative.share.UNIQUESTRING" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name="IntentTest" android:label="@string/app_name" android:configChanges="orientation|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:host="www.youtube.com" android:scheme="http"></data>
</intent-filter>
</activity>
<activity android:name=".BrowserActivity" android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http" />
</intent-filter>
</activity>
<provider android:authorities="com.creative.share.plugin.emailcomposer.attachmentprovider" android:name="de.appplant.cordova.plugin.emailcomposer.AttachmentProvider" />
</application>
【问题讨论】:
标签: android ios android-intent cordova cordova-plugins