Im developing a camera app that send images to a server, when user take a pic, the image is saved and send to the server. Now the custumer asked me that there must be a resend option in case of failure of whare ever reason.
How can i add a custom action in the gallery app so that when user press the menu can see a option that says: "Resend image with xxx app "?
Its like picasa, google + does. I'd like to add my own option there.
How is this possible? Some guide will be helpful.
you need to add Intent filter for that purpose. When u'll add intent filter your app will receive data of which you are listening. From gallery we have receive multiple or single option.You can see the link http://developer.android.com/training/sharing/receive.html
<activity android:name=".ui.MyActivity" >
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
Related
How can I do that my application appears in the “share” list of another application? For example, I want to choose a pdf file and send it to my application.
I can’t find the solution, any idea?
Thanks
You can add an intent filter in your AndroidManifest.xml
for example for a pdf you can indicate the mimeType application/pdf.
<activity name="package.name.MyActivity">
<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/pdf" />
</intent-filter>
</activity>
Look at the documentation at http://developer.android.com/guide/components/intents-filters.html#Receiving
I need an option say "Chat with this Contact" included in the options list when you click Contacts in Android and then select options.
Basically what I want to find out is if I can link my application feature say chat directly with the contacts menu in Android? Are there any examples for that?
I don't think we can do that. The options we see on pressing the hard option key ( or soft one on recent handsets) are generated from either xml or by programatically. They are not some kind of a global properties to be set (kind of like Blackberry apps). So, NO...
If you want to send user to your chatting/communication application, you can do that by registering the android.intent.action.SENDTO and/or android.intent.action.SEND intent filters with your activity.
Here's how I did it.
<activity
android:name=".EventCreaterActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="sms" />
<data android:scheme="smsto" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/*" />
</intent-filter>
</activity>
If you set these intent filters appropriately, on clicking any contact user will get a prompt to chose between the default messaging application and your application which, I think, fairly serves your purpose.
I'm creating a messaging app with Air for Android. I would like to enable other apps to share text to my app via the share menu option.
How do I get my app listed in there?
(This is the menu I would like to get listed in:)
Add an appropriate intent filter in your Activity tag in manifest file.
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
Your Activity will show up, when Android searches for such Share Intent handlers.
To an Activity that will handle any shared content, add an Intent Filter to your Manifest. For example:
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
<data android:mimeType="image/*" />
</intent-filter>
Using Android, when I click on an e-mail address in my default browser, a menu list pops up with Gmail, (an built-in email client), and K-9 (another e-mail application).
I would like to add my android application to appear in this list. Is this possible and how do I do this?
add this intent-filter to your activity in manifiest:
<intent-filter>
<action android:name="android.intent.action.SENDTO" />
<data android:scheme="mailto" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="*/*" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<data android:mimeType="*/*" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="mailto" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
You need to create an IntentFilter this requires both Java code, where you create an Activity that is triggered when the system notifies someone is trying to send an email, and changes to your AndroidManifest where you subscribe to the Intent action. Here is an SO Post that explains which intent filters you need: android intent-filter to listen for sent email addresses?
You add these to your Activity entry in your AndroidManifest and then when someone clicks an email it'll show your app. when someone clicks it, it'll open that specific Activity you are going to want to read about pulling data out of intents. Specifically you'll want to pull out: http://developer.android.com/reference/android/content/Intent.html#EXTRA_EMAIL from the extras.
Read about intent-filter here:
https://developer.android.com/training/sharing/receive.html
I'm writing an app that sends images and video from an Android phone to a server. My intent filter looks like this:
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<action android:name="android.intent.action.SEND_MULTIPLE"/>
<data android:mimeType="image/*"/>
<data android:mimeType="video/*"/>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
The problem is that it works perfectly for me on my Nexus S phone, but if anyone else installs it from the same release package it doesn't appear int their share menu in the gallery app. I'm at a loss here. What am I doing wrong?
this works for me (on different devices):
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
same for video, just change the mime type. Also if you can get log out from the problematic device, there is a chance you can see the intent details and perhaps get some idea of what's different