In Android 8.1 (Oppo AX5s) this supplied FilerProvider class works great. I can choose any cloud drive that is currently set up on the device to upload to. Then I have managed to write the code to download this back and all is great.
But on another phone (Samsung S8+) running Android version 9, after I click on the Backup button, all that I'm presented with is a phone vibration asking to "Bring the other device close to share the content' message - via Bluetooth I guess. That's all I get. I am not presented with the usual target directory picker like I am in Android v 8.1.
[CODE lang="b4x" title="File Provider Code - I've only changed it to upload a list"]Sub btnBackup_Click
Dim recCounter As Int = 0
Dim rowRec As String
'load the zikr file line by line into zikrList
Dim zikrList As List
'read the whole contents of the current live zikr file into list
zikrList.Initialize
zikrList = File.ReadList(File.DirInternal,"userZikr.txt")
Dim in As Intent
File.WriteList(Starter.Provider.SharedFolder, FileToSend, zikrList)
in.Initialize(in.ACTION_SEND, "")
in.SetType("text/plain")
in.PutExtra("android.intent.extra.STREAM", Starter.Provider.GetFileUri(FileToSend))
in.Flags = 1 'FLAG_GRANT_READ_URI_PERMISSION
StartActivity(in)
End Sub[/CODE]
This is the Manifest if that helps...
[CODE lang="b4x" title="Manifest Editor"]'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.DarkTheme)
'End of default text.
AddPermission(android.permission.ACCESS_NOTIFICATION_POLICY)
'this is new for backup and restore
AddManifestText(<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
)
AddApplicationText(
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="$PACKAGE$.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
)
CreateResource(xml, provider_paths,
<files-path name="name" path="shared" />
)[/CODE]
Has the maxSDKVersion="18" got anything to do with it?
Thanks,
Azhar