Android sharing files between apps - android

Hi I am trying to create an app that accepts files from other applications. I tried this tutorial, http://developer.android.com/training/secure-file-sharing/setup-sharing.html as well as this one, http://code.tutsplus.com/tutorials/android-sdk-receiving-data-from-the-send-intent--mobile-14878 and nothing seems to work.
here is my manifest,
...
<activity
android:name="com.example.activities.mainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/*" />
</intent-filter>
</activity>
...
Yet still for some reason my application won't show up if I try to share files with it from dropbox or anything else. I've tried different mime types, using SEND instead of SEND_MULTIPLE, and starting a clean application project and nothing.
Thanks
EDIT:
Essentially what I want to do is have my app show up in the share menu for all other applications. I managed to get a complete action using... pop up, but this isn't what I'm looking for. Unfortunately all google searches result in the info above.

I believe that I have solved it. for mime type rather than having "application/*" all you need is */*. For some reason, most files are opened as text/plain mime type including excel files. Odd.

Related

Android deep link and issues non clickable links or not working links

I made an Android application in which I want to implement deep linking (example: http://myApp/seeMore?id=123456)
When I send a sms via intent, I receive it, and the link is clickable, and it opens the content of the application I want to see!
What's the problem? If I send myself the link via whatsapp (or messenger), I receive it, but this same link in the whatsapp message is not clickable!
I also tried the format myApp://seeMore?id=123456 (with the Manifest xml updated as it should be), but nothing happens, the link sent is not clickable, even via SMS.
The only time I had a clickable link in whatsapp and messenger, it's with the http://myApp.com/seeMore?id=123456 format. But when I click on the link, it opens the browser saying that the page does not exist.
And I saw that in this case, I have to link my app to my website but I don't have a website... And I don't want to have one!
Questions :
Is there a way to make "myApp://seeMore?id=123456" clickable in SMS, Whatsapp, Messenger apps? By forcing in the code to say that it's a hyperlink? something else? :) )
Is it possible to make the link "http://myapp.com/seeMore?id=123456" work to point directly to my apk and not to the browser? (Did I configure my intent-filter wrong?) I saw a style attribute verifyAuto=true in the xml manifest, but when I tried, it didn't work...
Is it possible to generate a clickable link (even if it's not a url?) via intent send to messenger/whatsapp?
Does anyone have any idea whatsoever for my concern? :)
Here it is, if you have any idea, I'm interested! Thanks for reading and possibly helping me :)
Translated with www.DeepL.com/Translator (free version)
My current AndroidManifest:
<activity
android:exported="true"
android:name=".vue.activity.GraphActivity"
android:screenOrientation="landscape"
android:launchMode="singleTask"
android:parentActivityName=".vue.activity.MainActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with "http://speedchyps/course” -->
<data android:scheme="http"
android:host="speedchyps"
android:pathPrefix="/course" />
<!-- note that the leading "/" is required for pathPrefix-->
</intent-filter>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".vue.activity.MainActivity" />
</activity>
Config when i try "maJolieAppli://seeMore?id=123456":
<intent-filter android:label="#string/filter_view_example_gizmos">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with "speedchyps://course” -->
<data android:scheme="speedchyps"
android:host="course" />
</intent-filter>

Reading a custom file launched using Box

We have developed an Android app which is used for rendering files of our custom file type (.vds). I am able to launch my app for all the files (.vds file) which are stored on local storage, but if the files is stored on Box and I try to access them using the Box Android App then I am facing issues. I have created the following intent filter:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file" />
<data android:host="*" />
<data android:pathPattern=".*\\.vds" />
The problem is that in the corresponding activity I am able to get the intent, but if I try to read the URI (as our rendering logic is based upon file location) it gives me a path which doesn't exists on the SD card. What happens if we try to open a file using Box Android Native App? Where is the file downloaded and how should the downloaded file be accessed?
This may solve ur problem. Add the bellow intent filter.
<activity android:name=".Activity"
android:screenOrientation="portrait"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<action android:name="android.intent.action.EDIT"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:pathPattern="*.snowdragon"/>
<data android:mimeType="text/snowdragon"/>
</intent-filter>
</activity>
As noted above I've run into the same problem. While I've not found what I would consider to be The Right Solution(TM) I do have a couple of things to add that might be useful to others:
First, I've discovered that if I download the file in Box (not the same as mark for offline) then clicking the item in either the download result dialog or in the subsequent notification that appears at the bottom of the app works. Once you've dismissed that notification however, there does not seem to be a way to get back to the downloaded file from within Box.
Second, and let me qualify this by saying that I've not looked very closely at it yet but I think one could use the filename info in the intents for non-existent files to retrieve the file via the Box API, either directly from the cloud or possibly via API call to retrieve offline items. I'm wondering if this is actually what Box is trying to get us to do with these bogus file paths, considering that they are so blatantly bogus:
12-04 10:09:29.318: INFO/ActivityManager(607): START u0
{act=android.intent.action.VIEW dat=file:///non_existent_dummy_folder/foo.abcdef typ=application/abcdef cmp=com.foo.bar/.app.FooViewer}

Android: using intent filter to launch app doesn't work

I know this question is asked and answered many times on SO, but I just couldn't get it to work. Here is my manifest file (I have 3 activities, I'm showing the only one that I want to be displayed when associated):
<activity
android:name=".MyActivity"
android:label="#string/app_name"
android:theme="#style/HoloDarkTheme" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.ACTION_SEND" />
<action android:name="android.intent.action.EXTRA_TEXT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.action.BROWSABLE" />
<category android:name="android.intent.action.DEFAULT" />
<data android:scheme="http" />
<data android:host="example.com" />
</intent-filter>
</activity>
When I launch a browser and go to "example.com", my app isn't launched. Is there something wrong with the above XML?
Not sure if relevant, but this activity uses MediaPlayer to play videos. Also, I'm using SDK version 11.
I figured it out. It's simply a case of typo. Instead of this,
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.action.BROWSABLE" />
<category android:name="android.intent.action.DEFAULT" />
I needed to replace "android.intent.action" with "android.intent.category" in the last two lines:
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
I'm adding this answer here because this thread is one of the top hits when googling "intent filter to launch app from http not working". I suppose the root cause for me could also be considered a typo, but I'm going to call it an "Android documentation defect".
There's a line way toward the bottom of this page that breaks down a URI as:
<scheme>://<host>:<port>/<path>
This breakdown indicates that the "://", ":" and "/" will be added for me so I used the following data in my intent-filter:
<data android:scheme="http" />
<data android:host="my.school.edu" />
<data android:path="thingy" />
I then sent myself an SMS with the following text: "my.school.edu/thingy", which was recognized by my SMS client (Hangouts) as a web address, so it made it clickable. However, clicking on it just gave me a choice of browsers, my app was a no-show.
So I removed the host and the path, and my app launched for any link (or at least every one I tried). I put the host back in and it still worked. Put the path back and we're back to not working. On a whim I decided to prepend a slash to the path:
<data android:path="/thingy" />
...et voilà! There's my app in amongst the browsers! So the error in my view is Android's doc that suggests that the slash is inserted automagically. :) It apparently is not.
More Info: I'm using the HTTP scheme because that's what gets made clickable in SMS and email messages, giving me a free ride to that point.
And note that if you specify a unique host (and path), and the user selects "Always" when choosing your app from the list, future taps on your link will bypass that choice dialog and go straight to your app, which is nice.
Make sure you have the internet permission in your manifest.
I doubt that you can override the http scheme to point back to your app.

android: problem setting up intent filter to fire off activity when downloading file from web in browser

I am having a problem getting an activity to be initiated in response to a file download from a browser window.
When I click the file download button in broswer it gets downloaded to SD card, rather than firing off my MainActivity (or even prompting what I should do with it).
If I then locate the file on the SD card using a file explorer and select it then my MainActivity is initiated.
Have I misunderstood how intent filters work? I have verified the mime type for the download file using wireshark on a pc to verify that it is as expected.
[ If i remove the PathPattern and simply have the mime type in place then when pressing the download button I am prompted saying that there is nothing on the device to handle this file and do I still want to go ahead with the download.]
Any help would be appreciated.
Here is the entry from my manifest:
<activity android:name=".activity.main.MainActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:mimeType="application/xml-mydata"
android:pathPattern=".*\\.mydata" />
</intent-filter>
</activity>
Conceptually what you have seems fine, though I would dump the pathPattern. Here is a sample project demonstrating these sorts of <intent-filter> elements.
I would make sure that your MIME type has valid syntax. I forget off the top of my head if dashes are allowed.

android.intent.action.SEND; doing it wrong?

So I'm updating an app I created a while ago. In the AndroidManifest.xml I have the following (along with an <intent-filter> for android.intent.action.MAIN) inside an <activity>:
<intent-filter android:label="#string/send_label" android:icon="#drawable/icon">
<action android:name="android.intent.action.SEND" />
<data android:mimeType="text/plain" />
</intent-filter>
If I remember correctly, when I first created this app, the above (minus the android:label and android:icon bits) worked; my app would show up in the "Share" menu. A couple weeks ago I noticed a review of my app on the Market saying that it didn't show up when trying to Share stuff. I checked, and sure enough, it wasn't there.
Is the fact that I have two <intent-filter> blocks for one Activity confusing it? Did I break something between then and now, did something change in the Android API, or what's going on here?
Don't you need to specify a category?
(such as <category android:name="android.intent.category.DEFAULT" />

Categories

Resources