I want to launch a specific android app through a NFC card. I don't want android to ask me which app should be opened. It should instantly open my app. How could I do that?
I already tried it with MIME-Types but it did not work. Could i specify my own MIME-Type? Would it be possible to check the MIME-Type text/plain for a specific text(intent filter?)?
For example: I want my app to start when the NFC card has a specific text stored like "test" or something.
The idea is that it should work on every common mobile OS. Therefore an android application link would not work.
You can create your own application mimeType.
You could create a custom mimeType in your NDEF message and then create an intent-filter which matches it exactly. This would mean your app would be launched as it is the most specific filter.
Example:
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/vnd.com.my.app.package.customString" />
</intent-filter>
Taken from a previous example I've provided here: https://stackoverflow.com/a/27397938/3312868
Related
I don't want my app to show in share chooser of certain apps because it's causing some unexpected behaviour in my app. Or in other words, I can say that I only want certain apps to show my app in their share intent chooser. Either way, my objective would be accomplished.
My manifest includes:
<intent-filter android:label="Share with my App">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
Moreover, my app has some use cause due to which I've set my launchMode to singleTask
Example of my issue: I want only stores like Amazon, Aliexpress etc. to send share intent to myapp, while I don't want to receive any share intent from say any random notepad text, is it possible to achieve that? if yes then how?
What you want is not possible.
ACTION_SEND has no notion of accepting certain apps while filtering out the others.
It works like a whitelist rather than a blacklist, which means if your app is exposed, it can be seen by all the apps not all the apps minus 1.
I'm experimenting with android development. As an exercise I want to create an app that is able to receive images shared by other apps. I'm testing the app on my phone.
If i share an image in WhatsApp everything works as expected. My app is listed in the share dialogue and the activity is started. But if try to share an image from any other app (e.g. Photos, Album, Gallery) my app is not listed as on of the options.
I'm using a standard Android Studio project and added only the following lines to the manifest.
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="ANDROID.INTENT.CATEGORY.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
Why isn't my app listed in the other apps? What do I have to change to make it work?
Android is case-sensitive. By having ANDROID.INTENT.CATEGORY.DEFAULT, you will not match any Intent that is seeking android.intent.category.DEFAULT. Change the case to android.intent.category.DEFAULT, and you will match more activity requests.
In fact, since android.intent.category.DEFAULT is added by default to Intent objects passed to startActivity() or startActivityForResult(), I am not quite certain how your activity worked with WhatsApp...
Here is my intent-filter code...
<activity android:name="IntentReceiver">
<intent-filter>
<action android:name="android.nfc.action.TAG_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT" />
<data
android:scheme="http"
android:host="mytix.com"
android:pathPattern="/" />
<data
android:scheme="http"
android:host="www.mytix.com"
android:pathPattern="/" />
</intent-filter>
</activity>
What I want to do is intercept any NFC tags which have a url data type and the url is pointing to http://mytix.com (or http://www.mytix.com).
However the above code doesn't seem to work. Instead my NFC tags just open the browser and go the url in question (which is the right url! :) I've checked).
How do I intercept the intent? What I want to end up with is a tag that will take users to the mobile website if they don't have the app, but if they have the app installed it will take them straight to the app. I believe I am on the right lines, but the code above doesn't work for some reason.
I'm installing the app by building straight to the phone from Eclipse btw - does this make a difference?
Thanks
Tom
What I want to do is intercept any NFC tags which have a url data type and the url is pointing to http://mytix.com (or http://www.mytix.com).
Try NDEF_DISCOVERED, not TAG_DISCOVERED. Android will only support direct launches like this for NDEF-formatted NFC tags. If your NFC tag is using something else, you can't use the <intent-filter> AFAIK, but rather would have to parse the data out yourself.
Here is a book sample project that demonstrates writing a URL to an NDEF-formatted tag (triggered via the Share Page option in a browser app) and responding to NDEF-formatted tags with a specific URL written to them.
I am developing an application on Android and my application needs to be launched whenever a URI like (myscheme://mydata) is clicked on an SMS or Email.
I am using following filter for my app :
<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:scheme="secture"/>
</intent-filter>
However on emails and SMS messages, my URIs with the form of myscheme://mydata show up as
regular tests and i cannot click on them to launch my application.
Thanks for help
Edit :
I found out that Linkfy class does something similar however it modifies your own text into links. What I need is modifying other applications such as Email and SMS. So is it possible to change another applications Linkfy?
So is it possible to change another applications Linkfy?
No, sorry.
Instead of myscheme://mydata, use http://mydomain/mypath. You can create an <intent-filter> for this so that you get control instead of the browser, and the resulting URLs will be friendlier to other apps. As a bonus, you can put a real Web page at that URL, so if somebody who does not have your app winds up with your URL (e.g., forwarded email), the URL will still work..
I'm developing a small gallery application, in this application im getting images from sdcard and im displaying those images in my application and I completed this app successfully. My requirement is "When the user select some default app in the phone a chooser list is displaying, I want to add my app into that list". I have searched this in website but I couldn't get any solution for this. Please anyone help me
You must let your application respond to a type of intents. This is done by registering an Broadcast Receiver that filters a type of intent using an intent-filter. An example is shown here: http://developer.android.com/guide/topics/intents/intents-filters.html. I hope that i understood your question. If not, please elaborate on your problem.
try this it is works for me,
place this intent filter in your manifest file, and menction in which activity is support that action.
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>