I am using following:
based on code I found in the forums, under Erel's hand, to force certain files to appear in the photo gallery.
Unfortunately it seems to work too well.
Once you have run this code once - and the app has been dismissed - even uninstalled - any .jpg file that is saved in File.DirRootExternal by any means, including manually copying from the PC via USB, will appear in photo gallery.
It appears some sort of permanent connection is made that survives power down/up, battery removal etc - only thing I haven't done is a factory reset.
This is obviously not good app behaviour - anyone with an idea of how to stop it?
B4X:
'Associate file with gallery
If wrk_phn.SdkVersion < 19 Then
wrk_int.Initialize("android.intent.action.MEDIA_MOUNTED", "file://" & File.Combine(File.DirRootExternal & "/" & Gen_photo_album, wrk_str & ".jpg"))
wrk_phn.SendBroadcastIntent(wrk_int)
Else
wrk_jo = wrk_jo.InitializeStatic("anywheresoftware.b4a.BA").GetField("applicationContext")
wrk_pth = Array As String(File.Combine(File.DirRootExternal & "/" & Gen_photo_album, wrk_str & ".jpg"))
wrk_mediaScanner.InitializeStatic("android.media.MediaScannerConnection")
wrk_mediaScanner.RunMethod("scanFile", Array As Object(wrk_jo, wrk_pth, Null, Null))
End If
Unfortunately it seems to work too well.
Once you have run this code once - and the app has been dismissed - even uninstalled - any .jpg file that is saved in File.DirRootExternal by any means, including manually copying from the PC via USB, will appear in photo gallery.
It appears some sort of permanent connection is made that survives power down/up, battery removal etc - only thing I haven't done is a factory reset.
This is obviously not good app behaviour - anyone with an idea of how to stop it?