Using implicit intent to launch activity? - android

I have a problem using implicit intent to launch activity within my application.
I have created activities RecordList (lists all the albums), RecordEditor (used to add/edit tracks of record) and TrackEditor. I've managed to get the RecordEditor to launch when user selects new or edit from the RecordList. Problem occurs when I try to add new track to the the record (launch the TrackEditor activity).
Here is how I have defined the activities in manifest:
RecordList
<activity android:name="RecordList">
<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" />
<action android:name="android.intent.action.PICK" />
<data android:mimeType="vnd.android.cursor.item/vnd.example.record" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.GET_CONTENT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/vnd.example.record" />
</intent-filter>
</activity>
RecordEditor
<intent-filter>
<action android:name="android.intent.action.GET_CONTENT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/vnd.example.track" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
<action android:name="com.example.records.action.EDIT_RECORD" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/vnd.example.record" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.INSERT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.dir/vnd.example.record" />
</intent-filter>
TrackEditor
<activity android:name="TrackEditor">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
<action android:name="com.example.records.action.EDIT_TRACK" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/vnd.example.track" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.INSERT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.dir/vnd.example.track" />
</intent-filter>
</activity>
And here is the exception I keep getting when trying to add new track to Record:
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.INSERT dat=content://com.example.provider.Track/tracks }
I've used the NotePad example as base for this but I am unable to figure out where I am doing wrong. Any help would be appreciated. :)

It is unclear what you think you are gaining from these "implicit Intents".
That being said, your problem is with your content provider. It is not indicating that the MIME type for content://com.example.provider.Track/tracks is any of those for which you support the INSERT action.

Related

What is the IntentFilter that do my app be recognized like having audio to share?

What is the IntentFilter that I have to use in order to my app be recognized as like having audio to share? WhatsApp do not list my app anyway...
Like this:
I already tried:
<intent-filter>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="audio/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:mimeType="audio/*" />
</intent-filter>
and too
<activity
android:name=".activities.MyActivity"
android:exported="true">
<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.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="audio/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.GET_CONTENT" />
<category android:name="android.intent.category.OPENABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="audio/*" />
</intent-filter>
</activity>
But nothing seems to work...
Anyone knows?
Thx
I don't know if you are looking for this, but try to use the mimeType audio:
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="audio/*" />
</intent-filter>
For more info visit Android Intent-Filter Doc
Add this in manifest:-
<intent-filter . . . >
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="com.example.project.SHOW_CURRENT" />
<action android:name="com.example.project.SHOW_RECENT" />
<action android:name="com.example.project.SHOW_PENDING" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="audio/*" />
. . .
</intent-filter>
Combine all <intent-filter . . . >
I hope this should work, besides you can follow this guide Guide link

Intent ACTION_CALL is not being intercepted by my application

There's an application with a button that when pressed is using the startActivity method with the ACTION_CALL intent.
This is how its called:
public void call(String number)
{
Intent myIntent = new Intent(Intent.ACTION_CALL);
myIntent.setData(Uri.parse("tel:" + number);
startActivity(myIntent);
}
I have made a dialer app with the permission:
<uses-permission android:name="android.permission.CALL_PHONE" />
And my manifest looks like this:
<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.DIAL" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="tel" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.CALL_BUTTON" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
Every other question I've seen is suggesting this exact declarations to be made in the manifest.
I've checked and there are no defaults set on the Google dialer app which comes with the phone.
So why won't a pop up dialog show with an option to choose my application as the dialer to catch that intent?
I have finally got it to work.
After adding a bunch of intent filters it started working:
<intent-filter>
<action android:name="android.intent.action.NEW_OUTGOING_CALL" />
<action android:name="android.intent.action.CALL" />
<action android:name="android.intent.action.CALL_BUTTON" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="tel" />
</intent-filter>
<intent-filter android:priority="100" >
<action android:name="android.intent.action.DIAL" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="tel" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.CALL_BUTTON" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.CALL_PRIVILEGED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="tel" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.DIAL" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="tel" />
</intent-filter>
I think the first one did the magic.

Android <intent-filter> works for <activity /> but not for <receiver />

I have an Activity with multiple <intent-filter> tags:
<activity
android:name=".NFCActivity"
android:label="#string/title_activity_nfc" >
<intent-filter>
<action android:name="android.nfc.action.TRANSACTION_DETECTED" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="secure"
android:pathPrefix="/a000000004"
android:port="0"
android:scheme="nfc" />
</intent-filter>
<intent-filter>
<action android:name="com.gsma.services.nfc.action.TRANSACTION_EVENT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="nfc" />
</intent-filter>
<intent-filter>
<action android:name="com.gsma.services.nfc.action.TRANSACTION_EVENT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
This works as expected, the activity launches as a transaction is detected.
The same thing can't be said when working with a BroadcastReceiver, the onReceive method is not invoked:
<receiver
android:name="carta.NfcReceiver"
android:enabled="true" >
<intent-filter>
<action android:name="android.nfc.action.TRANSACTION_DETECTED" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="secure"
android:pathPrefix="/a000000004"
android:port="0"
android:scheme="nfc" />
</intent-filter>
<intent-filter>
<action android:name="com.gsma.services.nfc.action.TRANSACTION_EVENT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="nfc" />
</intent-filter>
<intent-filter>
<action android:name="com.gsma.services.nfc.action.TRANSACTION_EVENT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
am I missing something ?
Thanks
The same thing can't be said when working with a BroadcastReceiver, the onReceive method is not invoked:
That is because those actions are being used by some other process in startActivity() or startActivityForResult(). You cannot respond to startActivity() or startActivityForResult() with a BroadcastReceiver.

Application not visible in menu

I am working on an android Dialer My MainActivity's intent-filter is given bellow
<intent-filter>
<action android:name="android.intent.action.DIAL" />
<action android:name="android.intent.action.CALL_PRIVILEGED" />
<data android:scheme="tel" />
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
after adding these filters my application is not seeing in phone menu.
<action android:name="android.intent.action.DIAL" />
<action android:name="android.intent.action.CALL_PRIVILEGED" />
<data android:scheme="tel" />
please tell me why??
Try to separate your intent-filters in two:
<intent-filter>
<action android:name="android.intent.action.DIAL" />
<action android:name="android.intent.action.CALL_PRIVILEGED" />
<data android:scheme="tel" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
It seems Android considers your filters as one.

need a customised dialer layout in android

I need to develop a dialer for my android application. i need to develop an activity which uses the customised dialer.Can anybody help me out??
put this as intent filter of your activity
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.CALL_BUTTON" />
<action android:name="android.intent.action.DIAL" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.DIAL" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="tel" />
</intent-filter>

Categories

Resources