下载图像的广播接收器 [英] Broadcastreceiver for a downloaded image

查看:94
本文介绍了下载图像的广播接收器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上我想设置一个 Broadcastreceiver ,当用户从chrome,facebook,twitter..etc等将图像下载到图库/电话中时触发该

Basically I want to set a Broadcastreceiver that gets triggered when the user downloads an image into gallery/phone from chrome, facebook, twitter..etc

当照片下载完成并触发操作时,我想访问下载的图像以进行诸如编辑和填充之类的额外工作.

when the photo is finished downloading , and the actions is triggered, I want access to the downloaded image for extra work such as editing and stuff..!

我想这可以通过 Broadcastreceiver 来完成,该程序会监听图像,然后执行所需的操作.!

I'm thinking this can be accomplished by Broadcastreceiver, that listens for the image and then do the actions that needed..!

我试图搜索要添加到接收方 intent-filter 内的 Manifest 中的操作,但是我不是哪一个?

I've tried to search for action to be added in the Manifest inside the receiver intent-filter , but I don't which one?

<receiver
    android:enabled="true"
    android:exported="true"
    android:name=".MyReceiver">
    <inent-filter>
       <action android:name="??????"/>
    </inent-filter>

我已经在此处阅读了几乎所有的意图操作,但是找不到那个..!

I've read almost all the intent action here, but couldn't find the one..!

推荐答案

使用的旧Android版本

Older android versions used

<receiver
        android:name=".NewPictureReceiver"
        android:enabled="true">
        <intent-filter>
            <action android:name="android.hardware.action.NEW_PICTURE" />
            <data android:mimeType="image/jpeg" />
        </intent-filter>
</receiver>

获悉相机拍摄了新照片.我不知道是否也会由于下载的图像而触发该事件.

to get informed that the camera has shot a new photo. I do not know if this get also triggered by a downloaded image.

摘自>://github.com/M66B/FineGeotag/,它添加了GPS数据到jpg

taken from https://github.com/M66B/FineGeotag/ that adds gps data to jpg

在更新的android版本中将不再起作用.

不是一个可行的解决方案,但有些提示如何找到解决方案.

Not a working solution but some hints how to find a solution.

android媒体扫描器会更新android内部媒体数据库,您可以注册图像-告知您内容数据库 MediaStore.Images.Media.EXTERNAL_CONTENT_URI 的contentprovder-observer .您可以通过最后修改日期降序查询,然后查询媒体数据库的顺序.最上面的行应该是新图像.

The android media scanner updates the android internal media database and you can register an image-contentprovder-observer that tells your that media database MediaStore.Images.Media.EXTERNAL_CONTENT_URI has changed. you can query then the media db order by last modify date descending. The top rows should be the new images.

这篇关于下载图像的广播接收器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆