NFC Intent in Service

h0Oray

New Member
Licensed User
Longtime User
Hi everybody,

i want to write a service which logs my nfc activies. By scanning a NFC i want to jump into my service and write a file on sd-card. But I don´t want to see anything of it (no window with open NFC with ... and no Activity). Simply a notification "NFC scanned".


The programming part is not the problem. I´m not able to start a service when i scanned a NFC.


This is a part of my Manifest. (Made in the Manifest Editor)
B4X:
AddServiceText (serviceListen, <Intent-filter>
    <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
    <category android:name="android.intent.category.DEFAULT"/>
</Intent-filter>)

Maybe somebody has an idea?

Thank You.
 
Last edited:

manios

Active Member
Licensed User
Longtime User
Looks like I have the same problem!
 
Upvote 0

h0Oray

New Member
Licensed User
Longtime User
I have a solution, but a bad one

Mhhhh i have a solution, but i don´t like it -.-


I wrote an applikation with an empty activity. In "Activity_Create" i start a service (with intent of activity). After it I finish the Activity.

Inside the Service i do all my stuff.

My manifest
B4X:
AddActivityText(main, <intent-filter>
    <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <data android:mimeType="text/plain" />
</intent-filter>)


I don´t like this solution because i see the activity for a few millisecounds. It´s like a black blink.


Maybe somebody know a better solution.
 
Upvote 0

henrisin

New Member
Licensed User
Longtime User
I have a solution, but a bad one

Mhhhh i have a solution, but i don´t like it -.-


I wrote an applikation with an empty activity. In "Activity_Create" i start a service (with intent of activity). After it I finish the Activity.

Inside the Service i do all my stuff.

My manifest
B4X:
AddActivityText(main, <intent-filter>
    <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <data android:mimeType="text/plain" />
</intent-filter>)


I don´t like this solution because i see the activity for a few millisecounds. It´s like a black blink.


Maybe somebody know a better solution.

hi h00ray, i search for this solution, but i dont undertand qhen you said "In "Activity_Create" i start a service (with intent of activity)", couldo you give me a example. Thanks in advantage
 
Upvote 0
Top