Bhanu Sharma
Bhanu Sharma

Reputation: 5145

How can i get which application launch by user programatically?

Is there any way to get user launching app information like package name or any information about that application.

i make one service which get all running process and then i just compare with my deserving package name but i want Broadcast intent.

Is there any broadcast intent receiver which revive user launching app info ?

Upvotes: 2

Views: 111

Answers (1)

Sagar Thakarar
Sagar Thakarar

Reputation: 271

This code works for me, Hope it help you too.

IntentFilter addFilter = new IntentFilter();
addFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
addFilter.addAction(Intent.ACTION_PACKAGE_INSTALL);
addFilter.addDataScheme("package");
registerReceiver(yourReceiverName, addFilter);

Upvotes: 1

Related Questions