darewreck darewreck - 1 month ago 8
Android Question

Android "send as copy" does not open a new instance of the destination App

The Google Apps like (word, drive, excel) on the android give you the ability to share the document with another app via "Send as a copy". Let's call the other or destination app as App B.

Ideally, I would imagine that when the button "Send as a copy" is triggered that the google app would first allow the user to select what app the user wants to send the copy to. Once that is clicked, the google app would create a share intent and then send it to App B which is configured to listen to any type.

However, the problem is that the google app tries to open the app within itself like it's a child of it instead of opening the copy in App B's instance whether it's already opening or if not running, it would open App B's app. If you look at the task view, you will notice that the new instance of App B is shelled like a child to the google's app with the google app's header.

This is also a cordova android app, but I don't believe this should effect it.

Any advice appreciated,
Thanks
D

Answer

I realized what the problem was. It depends on what is specified within the AndriodManifest.xml file and the intent filters defined.

"Send Copy" can trigger two types of share intents to be generated. One share intent will be treated as text/plain and the other treated as the actual type.

If the intent filter in manifest for the intent action send does not support the actual type and allows text/plain, the behavior of "Send Copy" is as describe as above which is not desirable. However, if text/plain is not allowed and you specify the actual type like word, then the receiving app (App B) will have a content Uri in the share's intent Extra_Stream.

Also be mindful that the intent filter controls what can be shared with it the app and using "/' or "text/plain" can lead to unexpected behavior.