Hi all,
I just find a solution on get app package binary:
first, the manifest.xml should have permission: INSTALL_PACKAGE
then:
PackageManager pm = this.getPackageManager();
Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
List<ResolveInfo> appList = pm.queryIntentActivities(mainIntent,
0);
Collections.sort(appList, new
ResolveInfo.DisplayNameComparator(pm));
int count = appList.size();
for (int i = 0 ;i < count; i++){
new File f = new
File("/data/app/"+appList.get(i).activityInfo.applicationInfo.packageName+".apk");
if (f != null){
read file binary here....
}
}
My question now is why the application's name under system/app have
different format from the app under /data/app. For example, the app under
system folder is looks like AlarmClock.apk, while the app under /data/app
fold is com.xxxx.xxx.test.apk.
2009/10/28 vovkab <[email protected]>
>
> Seems like, you don't know what you need.
>
> Use WallpaperManager to get wallpapper. Why you need filename from
> package o_O?
>
> On 28 окт, 10:46, Zhihong GUO <[email protected]> wrote:
> > Can you give some example code on how to get the file name of the current
> > wallpaper?
> >
> > Thanks
> >
> > 2009/10/27 vovkab <[email protected]>
> >
> >
> >
> >
> >
> > > Yes you can.
> >
> > > Just read it with
> > > File apkfile = new File("/data/app/com.package.name");
> >
> > > On 27 окт, 11:43, Zhihong GUO <[email protected]> wrote:
> > > > Hi All,
> >
> > > > I want to read out the binary content of the .apk packages installed
> in
> > > > /data/app. Not only the package information, but the content of the
> > > package
> > > > itselt.
> > > > How can I do that.
> > > > Thanks a lot,
> >
> > > > James
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---