Skip to content
This repository has been archived by the owner on Mar 9, 2024. It is now read-only.

Not possible to share image from Android Instant app #157

Open
aronsommer opened this issue Jan 2, 2023 · 3 comments
Open

Not possible to share image from Android Instant app #157

aronsommer opened this issue Jan 2, 2023 · 3 comments
Labels

Comments

@aronsommer
Copy link

aronsommer commented Jan 2, 2023

In my Android Instant app its not possible to share the screenshot which was generated with the example code. Only the text gets shared without the image. In the standard Android app its working without problem.

I have built the Android Instant app with Unity version 2021.3.12f1 on macOS 12.6.2 and used the Google Play Instant plugin com.google.play.instant-1.8.0.unitypackage.

I have tested it on my Samsung S10e and its not possible to share the image over the Gmail or the Samsung Messages app.

I have seen following error in Logcat in com.google.android.gm.
And I will attach a screenshot with the error message in the Samsung Messages app.

2023/01/02 22:10:53.247 24467 24467 Error ActivityThread Failed to find provider info for com.aronsommer.selfieskater.NativeShareContentProvider
2023/01/02 22:10:53.247 24467 24467 Warn irk AttachmentInfoUtils: ContentResolver returned null when querying attachment content URI
2023/01/02 22:10:53.248 24467 24467 Error ActivityThread Failed to find provider info for com.aronsommer.selfieskater.NativeShareContentProvider
2023/01/02 22:10:53.248 24467 24467 Error irk ComposeActivity: Error adding attachment [CONTEXT android_log_tag="ComposeActivity" ]
2023/01/02 22:10:53.248 24467 24467 Error irk gel: FileNotFoundException when openAssetFileDescriptor.
2023/01/02 22:10:53.248 24467 24467 Error irk 	at fyr.f(PG:28)
2023/01/02 22:10:53.248 24467 24467 Error irk 	at gmg.H(PG:4)
2023/01/02 22:10:53.248 24467 24467 Error irk 	at ggr.run(PG:53)
2023/01/02 22:10:53.248 24467 24467 Error irk 	at gmg.at(PG:31)
2023/01/02 22:10:53.248 24467 24467 Error irk 	at gmg.as(Unknown Source:6)
2023/01/02 22:10:53.248 24467 24467 Error irk 	at fyt.a(PG:85)
2023/01/02 22:10:53.248 24467 24467 Error irk 	at ascx.c(PG:2)
2023/01/02 22:10:53.248 24467 24467 Error irk 	at ascz.run(PG:9)
2023/01/02 22:10:53.248 24467 24467 Error irk 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
2023/01/02 22:10:53.248 24467 24467 Error irk 	at apra.run(PG:3)
2023/01/02 22:10:53.248 24467 24467 Error irk 	at ahxd.run(PG:78)
2023/01/02 22:10:53.248 24467 24467 Error irk 	at aood.run(PG:13)
2023/01/02 22:10:53.248 24467 24467 Error irk 	at android.os.Handler.handleCallback(Handler.java:938)
2023/01/02 22:10:53.248 24467 24467 Error irk 	at android.os.Handler.dispatchMessage(Handler.java:99)
2023/01/02 22:10:53.248 24467 24467 Error irk 	at android.os.Looper.loopOnce(Looper.java:226)
2023/01/02 22:10:53.248 24467 24467 Error irk 	at android.os.Looper.loop(Looper.java:313)
2023/01/02 22:10:53.248 24467 24467 Error irk 	at android.app.ActivityThread.main(ActivityThread.java:8751)
2023/01/02 22:10:53.248 24467 24467 Error irk 	at java.lang.reflect.Method.invoke(Native Method)
2023/01/02 22:10:53.248 24467 24467 Error irk 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
2023/01/02 22:10:53.248 24467 24467 Error irk 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
2023/01/02 22:10:53.248 24467 24467 Error irk Caused by: java.io.FileNotFoundException: No content provider: content://com.aronsommer.selfieskater.NativeShareContentProvider/devroot/data/data/com.aronsommer.selfieskater/cache/shared%20img.png
2023/01/02 22:10:53.248 24467 24467 Error irk 	at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:2020)
2023/01/02 22:10:53.248 24467 24467 Error irk 	at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1849)
2023/01/02 22:10:53.248 24467 24467 Error irk 	at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1765)
2023/01/02 22:10:53.248 24467 24467 Error irk 	at fyr.f(PG:23)
2023/01/02 22:10:53.248 24467 24467 Error irk 	... 19 more
2023/01/02 22:10:53.249 24467 24467 Error Toast setGravity() shouldn't be called on text toasts, the values won't be used

Screenshot_Samsung_Messages

@aronsommer aronsommer added the bug label Jan 2, 2023
@yasirkula
Copy link
Owner

I've changed the following value to true in the NativeShare.aar file located within this zip file:

Can you replace NativeShare.aar with that one and try again?

@aronsommer
Copy link
Author

Thanks for your quick reply.

I have now built it with the NativeShare.aar file from your zip file.
Both the instant and the standard version are crashing at startup.
Here is the Logcat:

2023/01/03 10:24:29.141 29496 29496 Error AndroidRuntime FATAL EXCEPTION: main
2023/01/03 10:24:29.141 29496 29496 Error AndroidRuntime Process: com.aronsommer.selfieskater, PID: 29496
2023/01/03 10:24:29.141 29496 29496 Error AndroidRuntime java.lang.RuntimeException: Unable to get provider com.yasirkula.unity.NativeShareContentProvider: java.lang.SecurityException: Provider must not be exported
2023/01/03 10:24:29.141 29496 29496 Error AndroidRuntime 	at android.app.ActivityThread.installProvider(ActivityThread.java:8313)
2023/01/03 10:24:29.141 29496 29496 Error AndroidRuntime 	at android.app.ActivityThread.installContentProviders(ActivityThread.java:7810)
2023/01/03 10:24:29.141 29496 29496 Error AndroidRuntime 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7564)
2023/01/03 10:24:29.141 29496 29496 Error AndroidRuntime 	at android.app.ActivityThread.access$1700(ActivityThread.java:315)
2023/01/03 10:24:29.141 29496 29496 Error AndroidRuntime 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2286)
2023/01/03 10:24:29.141 29496 29496 Error AndroidRuntime 	at android.os.Handler.dispatchMessage(Handler.java:106)
2023/01/03 10:24:29.141 29496 29496 Error AndroidRuntime 	at android.os.Looper.loopOnce(Looper.java:226)
2023/01/03 10:24:29.141 29496 29496 Error AndroidRuntime 	at android.os.Looper.loop(Looper.java:313)
2023/01/03 10:24:29.141 29496 29496 Error AndroidRuntime 	at android.app.ActivityThread.main(ActivityThread.java:8751)
2023/01/03 10:24:29.141 29496 29496 Error AndroidRuntime 	at java.lang.reflect.Method.invoke(Native Method)
2023/01/03 10:24:29.141 29496 29496 Error AndroidRuntime 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
2023/01/03 10:24:29.141 29496 29496 Error AndroidRuntime 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
2023/01/03 10:24:29.141 29496 29496 Error AndroidRuntime Caused by: java.lang.SecurityException: Provider must not be exported
2023/01/03 10:24:29.141 29496 29496 Error AndroidRuntime 	at com.yasirkula.unity.NativeShareContentProvider.attachInfo(NativeShareContentProvider.java:80)
2023/01/03 10:24:29.141 29496 29496 Error AndroidRuntime 	at android.app.ActivityThread.installProvider(ActivityThread.java:8308)
2023/01/03 10:24:29.141 29496 29496 Error AndroidRuntime 	... 11 more

@yasirkula
Copy link
Owner

I've learnt that there are some restrictions in instant apps but couldn't find a definitive answer as to whether or not these exceptions are part of the restrictions. The most related pages I've found are:

I think that this issue will remain open for quite some time, unfortunately.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants