开发者

how do you get the name of a package that dispatched an intent in android?

I have a service setup to receive a PACKAGE_ADDED and a PACKAGE_REMOVED intent from all <data android:scheme="package" />

I receive the intent correctly, but I need to know how to use the Intent and Context classes from onReceive to get the name and label of the application that was added or removed.开发者_如何学C

I have been able to use Intent.getDataString() to get the uri string of the package, but don't really know where to go from there.

Thanks.


I don't know what the Uri looks like. I would assume it contains the package name (e.g., com.commonsware.my.really.awesome.app). If so, you can use PackageManager to get the rest of the details regarding that application.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜