And how is it with external classes which are not implementing the class Activity. the application on which i'm working on is a bit more complex and all nfc-related stuff is realized in an extra class "NfcManager". If i'm understanding it right:
- first i have to detect which activity (activities) really is (are) on top - then activate foregroundDispatch on every onNewIntent()... thanks ... On 14 Jun., 13:09, Mark Murphy <mmur...@commonsware.com> wrote: > You need to enableForegroundDispatch() on every activity that is > supposed to be watching for NFC tag events. From what I've read, if > Activity A enables dispatch and Activity B is in the foreground, the > dispatch doesn't happen. > > Also, to get onNewIntent() to work, make sure your Intent inside the > PendingIntent has FLAG_ACTIVITY_CLEAR_TOP|FLAG_ACTIVITY_SINGLE_TOP as > its flags. Here is a sample application demonstrating this: > > https://github.com/commonsguy/cw-advandroid/tree/master/NFC/URLTagger > > > > > > On Tue, Jun 14, 2011 at 5:52 AM, Ferit T <fokus.fe...@googlemail.com> wrote: > > Hi, > > > i'm a relatively new to the android development so there could be some > > dummy question. Sry for that. > > > My problem is that i have an android application with 3 different > > activities; first activity is more like a container, one activity is > > responsible for some browsing and the third one has more application > > logic. What i want to do is, to enable some simple NFC functionality. > > Currently if the application is created the tag is read i got the > > information about it and i can display it. > > > The problem is, if i want to activate foreground dispatch for this > > application the onNewIntent() method is not invoked. What i got in > > DDMS : > > > 06-14 11:36:56.125: INFO/NfcService(209): Dispatching to override > > intent PendingIntent{40591da0: android.os.BinderProxy@405604d8} > > 06-14 11:36:56.132: INFO/ActivityManager(109): Starting: Intent > > { act=android.nfc.action.NDEF_DISCOVERED dat=http://www.ttag.be/m/ > > 04598EBA342380 flg=0x30000000 cmp=de.fhg.fokus.fame.mwr2.android/ > > de.fhg.fokus.fame.android.nfc.NfcManagerImpl (has extras) } from pid > > -1 > > > The application is still in foreground and everything looks fine, but > > i thought that there is some problem with the right allocation of the > > PendingIntent Filter. > > > Is there any specification with the foreground dispatch system? > > Perhaps if the 2ndActivity is in foreground and the 3rdActivity is > > called from the 2ndActivity both are used at the same time and there > > could be some difficulty with the declaration of my PendingIntent. > > > My first intention is that it has something to do with the registered > > PendingIntent. Anybody some suggestions? Or what especially > > PendingIntents do? > > > kd, > > > Ferit Topcu > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to android-developers@googlegroups.com > > To unsubscribe from this group, send email to > > android-developers+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > Android Training in NYC:http://marakana.com/training/android/ -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en