I need to synchronize the deletion of files in system album with my app, but on Android, the deletion event does not contain the ID of the deleted file.
The methodCall looks like the code below.
{mediaType: 1, type: delete, uri: content://media/, platform: android}
the MethodCall when photo inserted
{mediaType: 1, id: 20492, type: insert, uri: content://media/external/images/media/20492, platform: android, galleryId: -1739773001}
My question is , How to get the id of deletion of photos?
Thank you very much
My code
void _onChangeNotified(MethodCall call) {
if (defaultTargetPlatform == TargetPlatform.iOS) {
final delete = List<dynamic>.from(call.arguments['delete']);
if (delete.isNotEmpty == true) {
_onPhotosDeleted(delete.map((e) => e['id'].toString()).toList());
}
final create = List<dynamic>.from(call.arguments['create']);
if (create.isNotEmpty == true) {
_onPhotosCreated(create.map((e) => e['id'].toString()).toList());
}
} else if (defaultTargetPlatform == TargetPlatform.android) {
if (call.arguments['type'] == 'delete') {
// no id returned ???
}
if (call.arguments['type'] == 'insert') {
final assetId = call.arguments['id'].toString();
_onPhotosCreated([assetId]);
}
} else {
throw UnsupportedError('Unsupported platform');
}
}
Platforms
Android
Description
Hello
I need to synchronize the deletion of files in system album with my app, but on Android, the deletion event does not contain the ID of the deleted file.
The methodCall looks like the code below.
{mediaType: 1, type: delete, uri: content://media/, platform: android}
the MethodCall when photo inserted
{mediaType: 1, id: 20492, type: insert, uri: content://media/external/images/media/20492, platform: android, galleryId: -1739773001}
My question is , How to get the id of deletion of photos?
Thank you very much
My code
Try do it
No response