Android Question How can i enable options of file share

Makumbi

Well-Known Member
Licensed User
Please help i wanted to always have option to chose from when iam sharing this file from my device how can that happen because right now the default share is gmail yet i wanted those options yo remain so that i can choose from them every time i try to share thanks in advance please help

below is my manifest editor

B4X:
'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="5" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:usesCleartextTraffic, "true")
SetApplicationAttribute(android:allowBackup, "false")
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
    SetActivityAttribute(SendsmschatV2, android:windowSoftInputMode, adjustPan|stateHidden)
CreateResourceFromFile(Macro, Themes.DarkTheme)
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)
CreateResourceFromFile(Macro, Core.NetworkClearText)
AddPermission(com.majeur.launcher.permission.UPDATE_BADGE)
AddPermission(com.sec.android.provider.badge.permission.READ)
AddPermission(com.sec.android.provider.badge.permission.WRITE)
AddPermission(com.htc.launcher.permission.READ_SETTINGS)
AddPermission(com.htc.launcher.permission.UPDATE_SHORTCUT)
AddPermission(com.anddoes.launcher.permission.UPDATE_COUNT)
AddPermission(com.majeur.launcher.permission.UPDATE_BADGE)
AddPermission(com.huawei.launcher3.permission.READ_SETTINGS)
AddPermission(com.huawei.launcher3.permission.WRITE_SETTINGS)
AddPermission(com.huawei.launcher2.permission.READ_SETTINGS)
AddPermission(com.huawei.launcher2.permission.READ_SETTINGS)
AddPermission(com.huawei.android.launcher.permission.WRITE_SETTINGS)
AddPermission(com.huawei.android.launcher.permission.READ_SETTINGS)
AddPermission(android.permission.READ_EXTERNAL_STORAGE)
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddPermission(com.sonyericsson.home.permission.BROADCAST_BADGE)
AddPermission(com.anddoes.launcher.permission.UPDATE_COUNT)

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" />
)

 

CreateResource(values, colors.xml,
<resources>
    <color name="actionbar">#0098FF</color>
    <color name="statusbar">#ff006db3</color>
    <color name="textColorPrimary">#ffffffff</color>
    <color name="navigationBar">#ff006db3</color>
</resources>
)
CreateResource(values-v20, theme.xml,
<resources>
    <style name="LightTheme" parent="@android:style/Theme.Material.Light">
         <item name="android:colorPrimary">@color/actionbar</item>
         <item name="android:colorPrimaryDark">@color/statusbar</item>
         <item name="android:textColorPrimary">@color/textColorPrimary</item>
         <item name="android:navigationBarColor">@color/navigationBar</item>
    </style>
</resources>
)

'End of default text.





'End of default text.

'
B4X:
Try
        Dim FileName As String = "P1WORK.PDF"
            File.Copy(File.DirInternal, FileName  , Starter.Provider.SharedFolder, FileName )
            Dim email As Email
            email.To.Add(EmailAddress.Text)
            email.Subject = "Homework"
            'email.BCC.Add("Find Attached App notes")
            email.Body="Find Attached App Homework"
            email.Attachments.Add(Starter.Provider.GetFileUri(FileName )) 'second attachment
            Dim in As Intent = email.GetIntent
            in.Flags = 1 'FLAG_GRANT_READ_URI_PERMISSION
            StartActivity(in)
    
            Return
        Catch
        MsgboxAsync("The File Not Detected Please Try Again. ","Homework Downloaded")
    
    End Try
 

MicroDrie

Well-Known Member
Licensed User
Longtime User
I don't quite understand exactly what you're asking. Do you want to choose the default email app with which you can request the email or do you want access to a specific folder or the shared folder of one or more apps or is it both?

Here is a Fileprovider example with B4A Library [class] FileProvider - share files how to compose an email message.

With SDK 28 version, Google has tightened the security rules. So I would first check whether this example still works out-of-the-box. Keep in mind that you only get one time the reqest to grant or reject the permission. After that, the approval or rejection is saved until the app is de-installed.
 
Upvote 0

Makumbi

Well-Known Member
Licensed User
I don't quite understand exactly what you're asking. Do you want to choose the default email app with which you can request the email or do you want access to a specific folder or the shared folder of one or more apps or is it both?

Here is a Fileprovider example with B4A Library [class] FileProvider - share files how to compose an email message.

With SDK 28 version, Google has tightened the security rules. So I would first check whether this example still works out-of-the-box. Keep in mind that you only get one time the reqest to grant or reject the permission. After that, the approval or rejection is saved until the app is de-installed.
No what I wanted is to always get those options where I can pick from every time iam sharing the file so that I can always choose the option I want at that time but currently those options where displayed once and they no longer come for me to choose from
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top