I have a project where use a custom Android launcher (android 4.2.2). The launcher shows games which are made in Adobe Air. Now we want to expand the list of games with Unity games.
To show the games we use the PackageManager and filter on name e.g.: air.Bimii. Namespace of both technologies are kept the same: air.BimiiMath, air.BimiiABC and so on.
The problem is that the games made in Unity are not listed when using:
private ArrayList<LocalAppDetail> initAppList(){
ArrayList<LocalAppDetail> res = new ArrayList<LocalAppDetail>();
PackageManager main_package_manager = main_activity.getPackageManager();
List<PackageInfo> packs = main_package_manager.getInstalledPackages(0);
for (int i = 0; i < packs.size(); i++) {
PackageInfo p = packs.get(i);
if ((p.versionName == null)) {
continue;
}
//Store Local Appdetail
LocalAppDetail newInfo = new LocalAppDetail();
newInfo.name = p.applicationInfo.loadLabel(main_package_manager).toString();
newInfo.pname = p.packageName;
newInfo.versionName = p.versionName;
newInfo.versionCode = p.versionCode;
newInfo.icon = p.applicationInfo.loadIcon(main_package_manager);
//Parse if the app meets requirements
if (newInfo.name.toLowerCase().contains(MiscData.apk_filter_text)) {
if(!newInfo.name.toLowerCase().contains("launcher")) {
if(!newInfo.name.toLowerCase().contains("rfid")){
res.add(newInfo);
}
}
}
}
//Store The Collection
return res;
}
but when i try using ADB: adb shell pm list packages -f air this is the result:
package:/data/app/air.BimiiFarm-1.apk=air.BimiiFarm
package:/data/app/air.BimiiFood-1.apk=air.BimiiFood
package:/data/app/air.nl.mediaheads.klassewinkel-1.apk=air.nl.mediaheads.klassewinkel
package:/system/app/Air.apk=com.adobe.air
package:/mnt/asec/nl.mediaheadsair.bimiiRekenen-1/pkg.apk=nl.mediaheadsair.bimiiRekenen
So the game is there (last in the list). The name is pkg.apk and the location is different. Do you guys have an idea about how to catch all the games in a list show we can launch them?
Help would be great! Thanks in advance
Update Sigh, it was an option in Unity Player settings. Install Location should be put on "Force Internal". What a world, what a world.
Related
I'm doing some android analysis and need to find all the android app that have targetSdkversion over 23, right now I'm reverse engineering all the apk packages to see this...Wondering if there's more easy way to get this information given an app name?
Thanks :)
you can do that by this code:
int sdkVersion = 0;
IPackageManager packageManager = AppGlobals.getPackageManager();
try {
ApplicationInfo appInfo = packageManager.getApplicationInfo(yourAppName, 0);
if (applInfo != null) {
sdkVersion = applicationInfo.targetSdkVersion;
}
}
I am new to android. I want to hide other app icons from their package names. I get apps package name using this code
final PackageManager pm = getPackageManager();
List<ApplicationInfo> PackList = pm
.getInstalledApplications(PackageManager.GET_META_DATA);
for (int i = 0; i < PackList.size(); i++) {
ApplicationInfo PackInfo = PackList.get(i);
// if (((PackInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) !=
// true) {
appsList.add(new AppPojo(PackInfo
.loadLabel(getPackageManager()).toString(),
PackInfo.packageName.toString(), "0"));
// }
}
Give package name of a particular app, is it possible to hide its icon??
Give package name of a particular app, is it possible to hide its icon?
No. You are welcome to write your own home screen which filters out apps, but you cannot force other home screens, or anything else, from showing whatever they want.
I am using Eclipse for Android SDK on Linux, and searching for a way to add the date and starttime of the compilation to one of the xml files. I like to see on the device which build version I am using, without updating this information before every compile step manually.
So far by searching the net I only found hints like "use ant".
I guess I have to use /proc/driver/rtc which is a dynamic "file" provided by the linux kernel that contains real time updated lines with colon separated text named for example "rtc_date" and "rtc_time". Including it and use the app on the device to get the information extracted.
Is there a better way? Like having eclipse either by knowing the time or stripping the information from proc and putting it at compile time in the xml file?
Its my first time using eclipse, so please excuse if I asked something obvious or impossible.
Regards
ct
I am using this code to get application build time. I know this is not outputting to an XML, but if you are trying to get when the app was build, this should work.
private long getAppBuildTime() {
if(cachedAppBuildTime == null) {
try{
ApplicationInfo ai = appContext.getPackageManager().getApplicationInfo(appContext.getPackageName(), 0);
ZipFile zf = new ZipFile(ai.sourceDir);
ZipEntry ze = zf.getEntry("classes.dex");
cachedAppBuildTime = ze.getTime();
log("app build time " + cachedAppBuildTime);
}catch(Throwable t){
return 1;
}
}
return cachedAppBuildTime;
}
The appContext variable in the code is obtained via context.getApplicationContext()
I use the same strategy as yigit except I prefer the MANIFEST.MF file.
This one is regenerated even if a layout is modified (which is not the case for classes.dex).
It result in the following code:
private long mAppBuildTime = -1;
public long getAppBuildTime() {
if (mAppBuildTime == -1) {
try{
ApplicationInfo ai = getPackageManager().getApplicationInfo(getPackageName(), 0);
ZipFile zf = new ZipFile(ai.sourceDir);
ZipEntry ze = zf.getEntry("META-INF/MANIFEST.MF");
mAppBuildTime = ze.getTime();
zf.close();
}catch(Exception e){
}
}
return mAppBuildTime;
}
I am trying to develop an android application where i have the following requirement. Is there any way through code, i can get the list of apps installed on devices in debug mode.
Thanks in advance.
EDIT - I tried the following code.
PackageManager pm = getPackageManager();
List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);
for (int i=0; i < packages.size(); i++)
{
if ((packages.get(i).flags & ApplicationInfo.FLAG_SYSTEM) == 1)
{
//This is for System applications
}
else
{
boolean isDebuggable = (0 != ( getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE ) );
if((pm.getLaunchIntentForPackage(packages.get(i).packageName)!=null) && (isDebuggable = true) )
{
// Only For Apps with debug mode set true, this line should get executed
// But this does not happens
}
}
}
Here you go,
Intent main = new Intent(Intent.ACTION_MAIN, null);
main.addCategory(Intent.CATEGORY_LAUNCHER);
List pkgAppsList = context.getPackageManager().queryIntentActivities( main, 0);
This should give you enough information in order to kick off an application.
I tried various methods but as per my understanding, we cannot get the list of apps in debug mode seperately.
By using the flags, we can only get for the app which has this code and not other apps running on device.
Thanks anyways. If anybody has a different thought, please let me know.
From Justin's answer
Kotlin
val allIntent = Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER)
val allApps = packageManager.queryIntentActivities(allIntent, 0)
val debugApps = arrayListOf<ActivityInfo>()
allApps.forEach {
val appInfo = (packageManager.getApplicationInfo(
it.activityInfo.packageName,
0
))
if (0 != appInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE) {
debugApps.add(it.activityInfo)
}
}
debugApps.forEach {
Log.d("debugApps", it.packageName)
}
It is possible to get all the apps that are in debug mode.
In my device, I get all the apps that I've installed using Android studio.
Hi i used the following code from this tutorial to list all of the installed applications in an app i'm working on.
http://impressive-artworx.de/2011/list-all-installed-apps-in-style/
I changed the onClick to my own dialog and what i now need to do is be able to get the location of the app. That is if it's in /system/app or /data/app i'd like to be able to toast the entire path to the pressed app but can't figure out how to do this. I can get the packagename by doing app.getPackageName() in the onClick but how can i get the apks path with this? Thank you for any suggestions or help it is much appreciated!
After a bit more googling i got what i was looking for
PackageManager m = getPackageManager();
String s = getPackageName();
PackageInfo p = m.getPackageInfo(s, 0);
s = p.applicationInfo.sourceDir;
worked very well found it here
Get Application Directory
thanks for the help it helped with my googling as to what to look for
Take a look at this . In particular the snippet with publicSourceDir .
List<PackageInfo> packs = packageManager.getInstalledPackages(0); //PackageManager.GET_META_DATA
for(int i=0; i < packs.size(); i++) {
PackageInfo p = packs.get(i);
ApplicationInfo a = p.applicationInfo;
// skip system apps if they shall not be included
if ((!includeSysApps) && ((a.flags & ApplicationInfo.FLAG_SYSTEM) == 1)) {
continue;
}
App app = new App();
app.setTitle(p.applicationInfo.loadLabel(packageManager).toString());
app.setPackageName(p.packageName);
app.setVersionName(p.versionName);
app.setVersionCode(p.versionCode);
CharSequence description = p.applicationInfo.loadDescription(packageManager);
app.setDescription(description != null ? description.toString() : "");
apps.add(app);
}
u can use this code to get the information of installed Applications.