Reputation: 829
I have an application in Android that has a button in the MAIN activity that performs an action.
Is there a way to execute that action without opening the application?
I don't know if I can say it is like a widget, because it does not wait for updates.
The user should be able to execute that action just clicking on the icon of the application without opening. Is it possible?
Upvotes: 1
Views: 358
Reputation: 10586
Try this question Android - How to execute main functionality of project only by clicking on the icon of application?
Upvotes: 0
Reputation: 8639
Yes and no. What I had to do for a similar problem was have a transparent view in my main activity, and then self-terminate:
In your activity...
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Do whatever you need here...
finish();
}
And in AndroidManifest.xml:
<activity android:name=".whatever" android:theme="@android:
style/Theme.NoDisplay">
Hope this helps,
Phil Lello
Upvotes: 4