Android Question DropboxV2 and Android 12

Juan Vargas (Bioagro)

Member
Licensed User
In a device using Android 12, when getting into the page to allow dropbox to be used, I get this message:
no apps can perform this action.

I am missing something? It works in Android 11
 

zed

Active Member
Licensed User
What version of dropbox v2 are you using.
What is the dropbox SDK version.
Can you post an example
 
Upvote 0

Juan Vargas (Bioagro)

Member
Licensed User
What version of dropbox v2 are you using.
What is the dropbox SDK version.
Can you post an example
Dropbox 0.60
Can't post the example, the app has more than 50,000 lines and is huge. I have to make a small app to test.
But I think is here where happens

B4X:
    If auth.OAuth2Token <> Null Then
        If auth.OAuth2Token <> "" Then
            token = auth.OAuth2Token
            DropboxEnabled = True
            Starter.kvs.Put("token", token)
            Log("Token available. Dropbox enabled")
            configDbx.Initialize("",token,"","de-de",5)
            Dim dbxhost As DbxHost
            dbxhost.Initialize
            clientDbx.Initialize("Dropbox",configDbx,token,dbxhost)
            dbxFiles = clientDbx.files
            dbxFiles.setEventname("dbxFiles")
            dbxSharing = clientDbx.sharing
            dbxSharing.setEventname("dbxSharing")
            dbxUsers = clientDbx.users
            dbxUsers.setEventname("dbxUsers")
            
        Else
            Log($"Token = """$)
        End If
    Else
        Log("Token is NULL")
        If token <> "" Then
            Log("Try to use the know token...")
            dbxUsers.CurrentAccount ' Tested!
        End If
    End If
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
  • Like
Reactions: zed
Upvote 0

zed

Active Member
Licensed User
Version 0.60
This is the SDK developed by @DonManfred. You need to add the Dropbox SDK. Thanks DonManfred



Check the dropboxV2.xml file in the additional library.
You should have this at the end of the file.

<version>0.6</version>
<comment>The Dropbox library allows you to communicate with Dropbox</comment>
<author>DonManfred (wrapper)</author>
<dependsOn>dropbox-core-sdk-5.2.0</dependsOn> <-- Version of dropbox you are using
<dependsOn>jackson-core-2.7.4</dependsOn>

Make sure the Dropbox SDK version matches this line. Otherwise, modify it with your SDK version.

In my additional libraries folder, I have this.
dropbox-core-sdk-5.2.0.jar
DropboxV2.jar
DropboxV2.xml
jackson-core-2.7.4.jar

If you have all of this in your additional library folder, then there is another problem.
Please check your configuration
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I have a valid token
please post the token. At least the first 10 characters of it. No need to post the full token.

It may be a ShortLife token.
Note that you can no longer create longlife Token from Dropboxconsole.

To support shortlife-token the library needs a rework. It is planned but i don´t had the time to do so... I´m even not sure if that is the issue here though.
 
Upvote 0

Juan Vargas (Bioagro)

Member
Licensed User
This is the SDK developed by @DonManfred. You need to add the Dropbox SDK. Thanks DonManfred



Check the dropboxV2.xml file in the additional library.
You should have this at the end of the file.

<version>0.6</version>
<comment>The Dropbox library allows you to communicate with Dropbox</comment>
<author>DonManfred (wrapper)</author>
<dependsOn>dropbox-core-sdk-5.2.0</dependsOn> <-- Version of dropbox you are using
<dependsOn>jackson-core-2.7.4</dependsOn>

Make sure the Dropbox SDK version matches this line. Otherwise, modify it with your SDK version.

In my additional libraries folder, I have this.
dropbox-core-sdk-5.2.0.jar
DropboxV2.jar
DropboxV2.xml
jackson-core-2.7.4.jar

If you have all of this in your additional library folder, then there is another problem.
Please check your configuration
yes, I confirm that I have the same configuration as yours
 
Upvote 0

Juan Vargas (Bioagro)

Member
Licensed User
please post the token. At least the first 10 characters of it. No need to post the full token.

It may be a ShortLife token.
Note that you can no longer create longlife Token from Dropboxconsole.

To support shortlife-token the library needs a rework. It is planned but i don´t had the time to do so... I´m even not sure if that is the issue here though.
At first, there is no token, everything happens in this code segment

B4X:
Sub BtnRestoreDropBox_Click
    Lbl_DropBoxHacerBackup.Text = f.GetLg("Restaurando Backup")
    StateManager.SaveState(Activity, "Main")
  
    If ENPROCESO = True Then
        Return
    End If
    ENPROCESO = True
    Dim dummy As String
    dummy = Starter.kvs.GetDefault("tokendb", "")
    If dummy <> "" Then
        token = dummy
        'lblToken.Text = token
        Log("Token available (Activity Create. Try to enable Dropbox with this token")
        configDbx.Initialize("",token,"","de-de",5)
        Dim dbxhost As DbxHost
        dbxhost.Initialize
        clientDbx.Initialize("Dropbox",configDbx,token,dbxhost)
        dbxFiles = clientDbx.files
        dbxFiles.setEventname("dbxFiles")
        dbxSharing = clientDbx.sharing
        dbxSharing.setEventname("dbxSharing")
        dbxUsers = clientDbx.users
        dbxUsers.setEventname("dbxUsers")
      
    End If
    DropboxEnabled = False

    auth.Initialize("mifkq3tp0ieeubm")
    downloadrunning = False
    If dummy <> "" Then
        SetDropboxToken("aaa")
    Else
        auth.startOAuth2Authentication
    End If
  
End Sub

Then, the line auth.startOAuth2Authentication open the browser, when I click 'Allow', I get the message.

I was trying to run the sample posted by you in the DropboxV2, I changed the targetsdk to 33 and changed the filedirrootexternal to internal, but the B4A bridge after trying to install I get this message

There was a problem parsing the package

*The allow from unknown sources is enabled.

That sample worked for me in another device using Android 11.
This Android 12 and 13 are giving me a big headache. It was some time since I didnt touch my apps, the were running fine, until a little change had to be done and I upgraded my b4a compiler, Android files and got phones with Android 12 and 13. Bluethooth problems, dropbox problems etc....I cant imagine with Android 14.
 
Last edited:
Upvote 0

zed

Active Member
Licensed User
If you have the same configuration, you must put in the minifest android:targetSdkVersion="30"/> maximum 30

Here is my manifest

Manifest:
AddManifestText(
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30"/>
<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.LightTheme)
'End of default text.

AddApplicationText(<activity
 android:name="com.dropbox.core.android.AuthActivity"
 android:configChanges="orientation|keyboard"
 android:launchMode="singleTask" >
<intent-filter>
  <data android:scheme="db-xxxxTOKENxxxx" />
<action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.BROWSABLE" />
  <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

</activity>)

Higher than SDK 30, I couldn't get it to work
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Higher than SDK 30, I couldn't get it to work
try the new Version 0.65 together with the new additional files.
Note the new Manifestchanges

I tried it with targetSDK 31 on my Samsung device running Android 12. Even 33
 
Last edited:
Upvote 0

Juan Vargas (Bioagro)

Member
Licensed User
try the new Version 0.65 together with the new additional files.
Note the new Manifestchanges

I tried it with targetSDK 31 on my Samsung device running Android 12. Even 33
Thanks. I followed the steps, still getting

no apps can perform this action.

in the 'Allow' page from dropbox. Android Version 12, Works well in 11.
 
Upvote 0

Juan Vargas (Bioagro)

Member
Licensed User
Sorry, in Android 11 Im getting this
B4X:
Error occurred on line: 0 (Main)
java.lang.Exception: Sub dbxfiles_createfolder signature does not match expected signature.
public static anywheresoftware.b4a.pc.RemoteObject com.tropic.invoice.main_subs_0._dbxfiles_createfolder(anywheresoftware.b4a.pc.RemoteObject,anywheresoftware.b4a.pc.RemoteObject,anywheresoftware.b4a.pc.RemoteObject) throws java.lang.Exception
class anywheresoftware.b4a.pc.RemoteObject, class anywheresoftware.b4a.pc.RemoteObject,
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Sorry, in Android 11 Im getting this
change the sub to
B4X:
Sub dbxFiles_CreateFolder(success As Boolean, metaobj As Object)
    Dim meta  As FolderMetadata = metaobj
    Log($"dbxFiles_CreateFolder(${success}, ${meta})"$)
End Sub

For any new question start a new thread.
 
Upvote 0
Top