Reputation: 1721
I followed How can I add my application's shortcut to the homescreen upon app installation? to have shortcut icon of my app on screen. It is working fine. But the issue is when I click on the shortcut icon to launch, it creates one more shortcut icon.
How to avoid that? In case I delete one icon, the app creates it again on opening.
Upvotes: 1
Views: 787
Reputation: 5751
I use a flag in Shared Preferences to keep track of whether I created a shortcut already or not. From what I could find, there's no way to check if the shortcut already exists on the home screen.
Upvotes: 1
Reputation: 1721
I tried with sharedpreference and saved its value first time and checking on next call before calling method to create shortcut. Working fine now.
Upvotes: 1