Maybe the LAUNCHER stuff is causing a problem? If you have your intent filter set up ok, you should at least receive the intent.
On Apr 5, 8:45 pm, Gorka Hernando <[email protected]> wrote: > Sorry, I forgot to say that after the broadcast is catched withing the > onreceive I have this code: > > public void onReceive(Context context, Intent intent) { > // show first message > Toast toast = Toast.makeText(context, "test", Toast.LENGTH_LONG); > toast.show(); > > context.startService(serviceIntent); > > } > > Maybe you meant this line: context.startService(serviceIntent); when > you sais how to start a service. > The problem as I said is that I cannot get the intent > > On 5 abr, 14:42, Gorka Hernando <[email protected]> wrote: > > > > > Hi, > > > Thanks for your response. > > I am taking a look at it. > > > I am not sure if I am working in the rigth way. Since I want the > > service to execute when the tag is detected, I guess I have to declare > > a BroadcastReceiver within my packet so that when I receive the intent > > I can start the service. Is that correct? The thing is that I am not > > receiving the intent at all, I am sure the action.NDEF is taking place > > because I see it in the debug window. However, my receiver doesn´t get > > it. The way I have declared the receiver in the manifest and in the > > java class is above. > > > Can you please tell me if what I am doing make sense or not. Because > > it seems to me that I am wasting my time because this is not the > > correct form to work whit this things. > > > Thanks. > > > On 5 abr, 13:36, skink <[email protected]> wrote: > > > > On Apr 5, 10:45 am, Gorka Hernando <[email protected]> wrote: > > > > > Hi again, > > > > > Sorry if I am posting too much, but I really need to make this work > > > > today. > > > > Here it is my manifest file. I have created a service and a receiver > > > > to get the NDEF_DISCOVERED intent. > > > > > <?xml version="1.0" encoding="utf-8"?> > > > > <manifest xmlns:android="http://schemas.android.com/apk/res/android" > > > > package="com.android.nfcvoicereader" android:versionCode="1" > > > > android:versionName="1.0"> > > > > <uses-sdk android:minSdkVersion="10" /> > > > > > <application android:icon="@drawable/icon" android:label="@string/ > > > > app_name"> > > > > <service android:enabled="true" android:name="MyService"></ > > > > service> > > > > <receiver android:enabled="true" > > > > android:name="com.android.MyIntentReceiver"> > > > > <intent-filter> > > > > <action android:name="android.intent.action.MAIN" /> > > > > <category > > > > android:name="android.intent.category.LAUNCHER" /> > > > > </intent-filter> > > > > > <intent-filter> > > > > <action > > > > android:name="android.nfc.action.NDEF_DISCOVERED"/ > > > > > <data android:mimeType="text/plain" /> > > > > > <category > > > > android:name="android.intent.category.DEFAULT"/> > > > > </intent-filter> > > > > </receiver> > > > > > <uses-feature android:name="android.hardware.nfc" > > > > android:required="true" /> > > > > </application> > > > > </manifest> > > > > > Inside my project there is a receiver class which should get the > > > > intent so that I can start the service. > > > > > public class MyIntentReceiver extends BroadcastReceiver { > > > > static final String TAG = "BROADCAST RECEIVER"; > > > > > @Override > > > > public void onReceive(Context _context, Intent _intent) { > > > > ..... > > > > } > > > > > } > > > > > Can someone tell me what I am doing wrong ?? > > > > See Context docs to find a method that starts a service > > > > pskink- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

