Is it possible to handle Intent ACTION_SEND outside of an Activity class?
I was to receive Intent that doesn’t open an Activity, where the class creates a Notification to show that the Intent is being processed as opposed to opening the app.
I’m sure this could be achieved with a Service that’s always running, but I only want a Service to run immediately prior to creating the Notification, above. (In other words, processing of the ACTION_SEND Intent needs to be transparent other than presenting the Notification.)
The task, as best I can figure, is establishing a Context in a non-Activity class to feed to getSystemService(), though I’m at a loss how to achieve this.
If you just want to avoid UI then in fact, extending
Activitydoes not mean you have to show any. So if you do not need to open any vUI in your class, then once youronCreate()is called just init it as usual by calingsuper.onCreate(bundle), then do what you want to do there, but do not call anysetContentView(). Then at the end of youronCreate()jump to another activity or just kill that one withfinish().