android - Querying a DownloadManager's content URI for a finished download gives status 200? -
i'm using android's downloadmanager start downloads, , retrieving uris when finished. have scheme content://
, figure using contentresolver should give me info need.
after running query:
val query = contentresolver.query(uri, null, null, null, null)
i cursor containing bunch of correct info download, such mimetype, filepath, etc. i'm interested in checking status of download (mainly see if it's been deleted), i'm reading status
column.
however, returns 200. first thought it's http success response, , maybe downloadmanager modeled statuses after those, that's not case downloadmanager.status_successful has constant value of 8. and, according downloadmanager.column_status, status should 1 of constants (none of 200). i've gotten on emulators api 26 , 23.
am misunderstanding how use contentprovider in conjuction downloadmanager? or, there better way can ensure previous download hasn't been deleted?
edit: here's output of databaseutils.dumpcursor(query)
contentresolver:
0 { _id=3 entity=null _data=/storage/emulated/0/download/*removed* mimetype=text/plain visibility=1 destination=4 control=null status=200 lastmod=1505066595033 notificationpackage=*removed* notificationclass=null total_bytes=213 current_bytes=213 title=*removed* description=*removed* uri=https://*removed* is_visible_in_downloads_ui=1 hint=file:///storage/emulated/0/download/*removed* mediaprovider_uri=content://media/external/file/35 deleted=0 _display_name=*removed* _size=213 }
and downloadmanager:
0 { _id=3 local_filename=/storage/emulated/0/download/*removed* mediaprovider_uri=content://media/external/file/35 destination=4 title=*removed* description=*removed* uri=https://*removed* status=200 hint=file:///storage/emulated/0/download/*removed* media_type=text/plain total_size=213 last_modified_timestamp=1505066595033 bytes_so_far=213 allow_write=0 local_uri=file:///storage/emulated/0/download/*removed* reason=placeholder }
Comments
Post a Comment