Android Question [Solved] Error using intent to share file in Google Drive (Android 13)

asales

Expert
Licensed User
Longtime User
I'm testing this code to share a file directly in Google Drive.
B4X:
File.Copy(File.DirAssets, "1.pdf", Starter.Provider.SharedFolder, "1.pdf")

Dim sendIntent As Intent
sendIntent.Initialize(sendIntent.ACTION_SEND,"")
sendIntent.SetComponent("com.google.android.apps.docs/.common.shareitem.UploadMenuActivity")
sendIntent.PutExtra("android.intent.extra.STREAM", Starter.Provider.GetFileUri("1.pdf"))
StartActivity(sendIntent)

It works fine in Android 10, but in Android 13 I get this error message:
B4X:
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.google.android.apps.docs/com.google.android.apps.docs.common.shareitem.UploadMenuActivity}; have you declared this activity in your AndroidManifest.xml, or does your intent not match its declared <intent-filter>?
Do I need declare something in manifest in Android 13 to use the intent?

Google Drive is up to date in both devices and I can see the component string with QueryIntentActivities.

How can I fix it in Android 13?

Thanks in advance for any help.
 

agraham

Expert
Licensed User
Longtime User
Do I need declare something in manifest in Android 13 to use the intent?
Yes. You need to declare any other apps you want to interact with. See this thread and especially post #7 and see if that solves your problem

 
Upvote 0

asales

Expert
Licensed User
Longtime User
Yes. You need to declare any other apps you want to interact with. See this thread and especially post #7 and see if that solves your problem

I have this permission in manifest:
B4X:
AddPermission(android.permission.QUERY_ALL_PACKAGES)
and this query too:
B4X:
<package android:name="com.google.android.apps.docs" />
but works only in Android 10.
In Android 13 I get the error.
Edit: I'm still testing. I can't use the QUERY_ALL_PACKAGES because the app is in Play Store.
 
Upvote 0

asales

Expert
Licensed User
Longtime User
Here an example to demonstrated the problem.
Need to be use in Android 13+.

In Android 10 I see this screen when I click in the button, in Android 13 I get the error.
1695064192587.png
 

Attachments

  • ProjectIntentGDrive.zip
    23.7 KB · Views: 79
Upvote 0

asales

Expert
Licensed User
Longtime User
Very strange.
I tested in 2 different devices with Android 13 and get the same error.
Thanks.
 
Upvote 0

asales

Expert
Licensed User
Longtime User
Thanks both!
Anyone with a Samsung device with Android 13 to test the code?
The devices which I tested the code - and got the error - was a Samsung A71 and M32.
 
Upvote 0

MicroDrie

Well-Known Member
Licensed User
Android version 13 on Galaxy A13 buildnumber TP1A220624.014.A135FXXS5CWG1 and after software update to current release TP1A220624.014.A135FXXS5CWH1 both working correctly in release mode compiled with jdk-1.8.3_81.
 
Upvote 0

asales

Expert
Licensed User
Longtime User
Just to close this topic.
After a software update in the Galaxy A71, released by Samsung last week, the problem was solved.
 
Upvote 0
Top