我正在尝试将我的应用程序显示在Google的共享列表选项中。关于在共享列表选项中列出应用程序已经有很多创建的帖子,但我找不到答案。根据我的理解,Google将使用不同的意图,仅列出具有该特定意图的应用程序?
这就是我想要做的。
我添加的代码是
<activity android:name=".ui.MyActivity" >
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
但该应用并未出现在Google的共享列表选项中。甚至在我下载图像并尝试通过库共享时也是如此。该应用程序没有显示出来。
答案 0 :(得分:0)
除了添加从其他应用获取内容的功能之外,还需要添加以下内容:
<intent-filter>
<action android:name="android.intent.action.GET_CONTENT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
答案 1 :(得分:0)
我没有对它进行测试,但是在MainActivity中你可以在课前声明之前添加它吗
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var topicLabel: UILabel!
var dictionary1:[Int:String] = [0:"Whether you have experienced Pricking-pain, Desquamation,itching or dry skin sensation during seasonal alternate.",
1:"Whether your skin apt to flush( Redness) in hot humid environment ",
2:"Whether your skin has multiple disernible dilated capillaries.",
3:"whether you have once been diagnosed atopic dermatitis or seborrheic dermatitis."]
var dictionary2:[Int:Array<String>] = [0:["Never","Seldom","Usually","Always"],
1:["Never","Seldom","Usually","Always"],
2:["Never","Seldom","Usually","Always"],
3:["Yes", "No"]]
override func viewDidLoad() {
super.viewDidLoad()
titleLabel.text = "Fill Skin Type Survey Form "
titleLabel.textColor = UIColor.black
topicLabel.text = "Are You with sensitive skin type ?"
topicLabel.font = UIFont.boldSystemFont(ofSize: 18)
}
//TableView
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return dictionary1.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell:TableViewCell = tableView.dequeueReusableCell(withIdentifier: "cell") as! TableViewCell
//cell.questionLabel.text = NSObject.dictionaryWithValues(forKeys: [indexPath.row])
cell.questionLabel.text = dictionary1[indexPath.row]
cell.questionLabel.textColor = UIColor.black
//cell.optionsLabel.text = dictionary2[indexPath.row]
let arr = dictionary2[indexPath.row]
var strr = String()
for str in arr! {
strr = strr + str
}
cell.optionsLabel.text = strr
cell.optionsLabel.textColor = UIColor.black
return cell
}
并在OnCreate方法中添加
[IntentFilter(new[] { Intent.ActionSend }, Categories = new[] {
Android.Content.Intent.CategoryDefault,
Android.Content.Intent.CategoryBrowsable
}, DataMimeType = "text/plain")]
这可用于文本和测试目的,您可以调试以验证应用程序是否可以访问此代码,然后您可以根据需要进行更改