[android-developers] Re: how to read the app package under /data/app
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); ListResolveInfo 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..xxx.test.apk. 2009/10/28 vovkab vov...@gmail.com 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 gzhh...@gmail.com wrote: Can you give some example code on how to get the file name of the current wallpaper? Thanks 2009/10/27 vovkab vov...@gmail.com Yes you can. Just read it with File apkfile = new File(/data/app/com.package.name); On 27 окт, 11:43, Zhihong GUO gzhh...@gmail.com 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: how to read the app package under /data/app
Because in /data/app they added automaticaly, and to keep file names clear, they uses package name as file name. Any way you can get all files in data/app and system/app: for (int i = 0 ;i count; i++){ File f = new File(appList.get (i).activityInfo.applicationInfo.sourceDir); if (f != null){ read file binary here } } p.s you don't need INSTALL_PACKAGE permission ;) On 29 окт, 09:39, Zhihong GUO gzhh...@gmail.com wrote: 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); ListResolveInfo 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..xxx.test.apk. 2009/10/28 vovkab vov...@gmail.com 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 gzhh...@gmail.com wrote: Can you give some example code on how to get the file name of the current wallpaper? Thanks 2009/10/27 vovkab vov...@gmail.com Yes you can. Just read it with File apkfile = new File(/data/app/com.package.name); On 27 окт, 11:43, Zhihong GUO gzhh...@gmail.com 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: how to read the app package under /data/app
The contents of /data/app and /system are private implementation details of the platform and you should never touch them directly or make assumptions about what they contain. The PackageManager is the API for accessing all information about installed applications. Please don't directly access .apks. (And in the code posted previously for querying the main activities, there is absolutely no need for the INSTALL_PACKAGE permission for this. In fact, third party apps can't get that permission, period.) 2009/10/29 vovkab vov...@gmail.com Because in /data/app they added automaticaly, and to keep file names clear, they uses package name as file name. Any way you can get all files in data/app and system/app: for (int i = 0 ;i count; i++){ File f = new File(appList.get (i).activityInfo.applicationInfo.sourceDir); if (f != null){ read file binary here } } p.s you don't need INSTALL_PACKAGE permission ;) On 29 окт, 09:39, Zhihong GUO gzhh...@gmail.com wrote: 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); ListResolveInfo 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..xxx.test.apk. 2009/10/28 vovkab vov...@gmail.com 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 gzhh...@gmail.com wrote: Can you give some example code on how to get the file name of the current wallpaper? Thanks 2009/10/27 vovkab vov...@gmail.com Yes you can. Just read it with File apkfile = new File(/data/app/com.package.name); On 27 окт, 11:43, Zhihong GUO gzhh...@gmail.com 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 -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: how to read the app package under /data/app
Can you give some example code on how to get the file name of the current wallpaper? Thanks 2009/10/27 vovkab vov...@gmail.com Yes you can. Just read it with File apkfile = new File(/data/app/com.package.name); On 27 окт, 11:43, Zhihong GUO gzhh...@gmail.com 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: how to read the app package under /data/app
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 gzhh...@gmail.com wrote: Can you give some example code on how to get the file name of the current wallpaper? Thanks 2009/10/27 vovkab vov...@gmail.com Yes you can. Just read it with File apkfile = new File(/data/app/com.package.name); On 27 окт, 11:43, Zhihong GUO gzhh...@gmail.com 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: how to read the app package under /data/app
You can't -- RichardC On Oct 27, 8:43 am, Zhihong GUO gzhh...@gmail.com 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: how to read the app package under /data/app
Yes you can. Just read it with File apkfile = new File(/data/app/com.package.name); On 27 окт, 11:43, Zhihong GUO gzhh...@gmail.com 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: how to read the app package under /data/app
but how can I get the com.package.name. It seems that you can't get all of the files' name by listFile() method. 2009/10/27 vovkab vov...@gmail.com Yes you can. Just read it with File apkfile = new File(/data/app/com.package.name); On 27 окт, 11:43, Zhihong GUO gzhh...@gmail.com 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---