[Q] Getting apk file name when app is launched ? - Android Software Development

HI to every one.
Is there a way to get the apk file name when an app it was launched ?
Scenario: I want to append some additional data to the file name and when the app is launched I want somehow by application Id to locate the file name and extract that additional data to fill some fields inside my app .
Is there some methods which are in charge with that ? or even a way to do that ? or tutorial doing that ?
Also if not then what different methods exists to retrieve some additional data at downloading process, or even from file name ... etc ???
Thank you in advance .

asteroidg said:
HI to every one.
Is there a way to get the apk file name when an app it was launched ?
Scenario: I want to append some additional data to the file name and when the app is launched I want somehow by application Id to locate the file name and extract that additional data to fill some fields inside my app .
Is there some methods which are in charge with that ? or even a way to do that ? or tutorial doing that ?
Also if not then what different methods exists to retrieve some additional data at downloading process, or even from file name ... etc ???
Thank you in advance .
Click to expand...
Click to collapse
Which App Is It If You Don't Mind?
I Might Know The Exact Name?
Sent from my HERO200 using XDA App

It will be my *.apk file name downloaded from my server. I saw that every time that *.apk file went to my \sdcard\download, can I assume that that path will be for every android user ?

asteroidg said:
It will be my *.apk file name downloaded from my server. I saw that every time that *.apk file went to my \sdcard\download, can I assume that that path will be for every android user ?
Click to expand...
Click to collapse
It Usually Names The File,
At Least On My Hero!
Wait.... File Name? Or App Name?
For File Name, Try.... Root Explorer!!
Root Explorer, Allows You To Basically Dissect Apks.
For App Name, Try.... AppMonster!!
Install AppMonster, And Once It's Installed....
Reinstall The App/Apps You Want The Name Of, & Reopen AppMonster & They Should Show Up As Apps Currently Installed!
Lemme Know If That Works!!
Sent from my HERO200 using XDA App

Thanks. But I am looking doing that inside the code, by programming . I know how to get the file name from specific folder but i need to look for the file name from the whole device that't my point , if any suggestion or even line of codes will be appreciated.
File dir = new File("/data/app");
File[] fileList = dir.listFiles();
if (fileList != null)
{
for ( int i = 0;i<fileList.length;i++)
{
filename = fileList.getName();
Log.d("FN-log","file name="+filename);
if (-1 != filename.indexOf(appName.toString()))
{
break;
}
}
}
I am using the above code to retrieve the file name form specific folder, I need something from the whole device , any idea ?

asteroidg said:
Thanks. But I am looking doing that inside the code, by programming . I know how to get the file name from specific folder but i need to look for the file name from the whole device that't my point , if any suggestion or even line of codes will be appreciated.
File dir = new File("/data/app");
File[] fileList = dir.listFiles();
if (fileList != null)
{
for ( int i = 0;i<fileList.length;i++)
{
filename = fileList.getName();
Log.d("FN-log","file name="+filename);
if (-1 != filename.indexOf(appName.toString()))
{
break;
}
}
}
I am using the above code to retrieve the file name form specific folder, I need something from the whole device , any idea ?
Click to expand...
Click to collapse
Oh ok, Sorry misunderstood you!
Sent from my HERO200 using XDA App

Try searching the whole sd card folder by folder
XDA App

TheRedDrake said:
Try searching the whole sd card folder by folder
XDA App
Click to expand...
Click to collapse
It seems that I have to check first in the root folder of device which is "/", that thing will show the root list. Then I need a for in for intsructions to be called ... to check all subfolders until I will find the file, it's a solution but first I have to write this algorithm of searching which is a little bit annoying and I am afraid about that process will slow the app ... That's why I was looking for something which should be already in Android API, do not invent bicycle again ? But any help will be appreciated. (By the time I was thinking to use Linus find shell command , I tried but every time I am getting no permission access is denied ... )
Thank you.

Related

[Q] HELP !!! an error copy/paste message in android

hello,i am trying to copy a file that i got from another build and overwrite the same file found in this directory " system/lib " but i keep getting an error message saying " there was not enough free disk space to complete the paste operation ", i tried to delete the original file then paste the new one but i get the same error message, i am using Root explorer to do this, it shows (216.45MB used, 1.07MB free, r/w ) on the " system/lib " folder, is there anyway for me to copy that file to this directory because i really need to, thank you
p.s: i used to do the same thing with other android builds but after switching to darkstone froyo v2 i started having this problem, and i need this file to get the arabic letters on my device to appear connected and not separated, any help is appreciated, thanks again
Use the new builds with built in 1gb.
mini_robot said:
Use the new builds with built in 1gb.
Click to expand...
Click to collapse
i am already using a build with 1gb
I only assume ur pushing them through adb or terminal??
Sent from my HTC HD2 using XDA App
squish099 said:
I only assume ur pushing them through adb or terminal??
Sent from my HTC HD2 using XDA App
Click to expand...
Click to collapse
i tried adb and terminal, i also tried doing it with ET FILE EXPLORER and Root Explorer but nothing works, now i am getting a message that the file i am trying to replace is READ-ONLY and cant be changed, also everytime i try to open ET FILE EXPLORER or ROOT EXPLORER i get a pop up from superuser permissions, weird !!!!

How to host an .apk file?

Hi!
I've been trying to upload an .apk to my webhost (through ftp) and when I try to download it through the given url, the file doesn't download. Instead I only get text, just as if my host don't understand the file.
Any idea how I can fix this? Is it though .htaccess or what? /:
(I've tried to search this but with no luck)
First off I don't know too much about ftp but from what I do know I would imagine what you want to do would involve the .htaccess file in the apk's directory
My guess would be in the .htaccess file you'd have to edit/add the FilesMatch line
(if that doesn't work it may me just "Files" instead of "FilesMatch" - not sure)
Code:
<FilesMatch "\.(apk)$">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
Other alternatives I can think of are either:
Change the link from [B]ftp[/B]://your.ftp.org/blah/android.apk to [B]http[/B]://your.ftp.org/blah/android.apk when you give it out - but I realize this kinda defeats the purpose of using a FTP in the first place
Upload the .apk into a zip. That should force the 'save as' dialog
Hopefully this does the trick for you
**I hope this post looks correct - adding the html myself I may have messed up somewhere along the line, if it you see /LIST] or anything like that I'll fix it when I have access to a computer **
Sent from my Android using Tapatalk
kyouko said:
First off I don't know too much about ftp but from what I do know I would imagine what you want to do would involve the .htaccess file in the apk's directory
My guess would be in the .htaccess file you'd have to edit/add the FilesMatch line
(if that doesn't work it may me just "Files" instead of "FilesMatch" - not sure)
Code:
<FilesMatch "\.(apk)$">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
Other alternatives I can think of are either:
Change the link from [B]ftp[/B]://your.ftp.org/blah/android.apk to [B]http[/B]://your.ftp.org/blah/android.apk when you give it out - but I realize this kinda defeats the purpose of using a FTP in the first place
Upload the .apk into a zip. That should force the 'save as' dialog
Hopefully this does the trick for you
**I hope this post looks correct - adding the html myself I may have messed up somewhere along the line, if it you see /LIST] or anything like that I'll fix it when I have access to a computer **
Sent from my Android using Tapatalk
Click to expand...
Click to collapse
Geniuous! Worked like clockwork!
(I used the http://-link from the start, that's where it failed.. but the .htaccess content did it's job!)
1+Thanks! ^^

[Q] getting Application Name from APK file

Hi
I have a folder with +2000 apk files and they named like 'app.apk' , 'app1.apk' , and many more like this. so I want to make a software that rename these files like this
app.apk ---> <ApplicationName> <version> .apk
so I need a way to get the application name from the package
I already tried decompiling xml file but there is only package name
I searched xda and google for this matter and no luck....
can you help me to get the application name?
Run "aapt d badging some.apk" and search for "application: label=". aapt is a part of SDK.
Brut.all said:
Run "aapt d badging some.apk"
Click to expand...
Click to collapse
Thanx for this very useful.
There is a script by phsorx that automates this
If you're really in a pickle you can put the apk on your device's sd card and run it. It will show you the app name and permissions before actually installing.
This method would be tedious and painful, but effective.
Comin' at you from Dead Space. 2, that is.
apkspy
or run this:
http://forum.xda-developers.com/showthread.php?p=14523375
it does exactly what you want.
I'm the author btw.
I use aapt.exe from latest SDK. Some apk doesn't show a label or a valid english label.
(Android Asset Packaging Tool, v0.2-3303571)
Your have to use the old version of aapt.exe that work great!
(Android Asset Packaging Tool, v0.2)

Help with Gallery App

I have found a gallery app that I have integrated into my own app.
http://manishkpr.webheavens.com/android-viewpager-as-image-slide-gallery-swipe-gallery/
Currently the gallery displays images that are founded in drawable i want to modify it to show image from sd card (i.e. /sd/images/)
I tried different approach but without luck, unfortunately.
Thanks in advance!​
heahmad said:
I have found a gallery app that I have integrated into my own app.
http://manishkpr.webheavens.com/android-viewpager-as-image-slide-gallery-swipe-gallery/
Currently the gallery displays images that are founded in drawable i want to modify it to show image from sd card (i.e. /sd/images/)
I tried different approach but without luck, unfortunately.
Thanks in advance!​
Click to expand...
Click to collapse
You have to use BitmapFactory.decodeFile() on each File in that directory. You can then set the returned bitmap to your imageView in the instantiateItem() method of your PagerAdapter with setImageBitmap(). Though you might want to cache thing first for better performance...
ok i know that, but the problem is that the app itself generate photos with different number and name (Timestamp) so i want it to read an entire folder not a single file each time
heahmad said:
ok i know that, but the problem is that the app itself generate photos with different number and name (Timestamp) so i want it to read an entire folder not a single file each time
Click to expand...
Click to collapse
you can get all images from diretory
PHP:
File file= new File(android.os.Environment.getExternalStorageDirectory(),"MyFolder");
if (file.isDirectory())
{
listFile = file.listFiles();
for (int i = 0; i < listFile.length; i++)
{
f.add(listFile[i].getAbsolutePath());
}
}
zipzip27 said:
you can get all images from diretory
PHP:
File file= new File(android.os.Environment.getExternalStorageDirectory(),"MyFolder");
if (file.isDirectory())
{
listFile = file.listFiles();
for (int i = 0; i < listFile.length; i++)
{
f.add(listFile[i].getAbsolutePath());
}
}
Click to expand...
Click to collapse
i do not get it can you explain more, there is no return function with data

Addings app to multiwindow [Root]

adding apps to mw is very easy
you will need
- A Rooted huawei device *i'm using mate 7*
- File explorer with Fx root addon
- This https://goo.gl/fFSIgZ
just type in playstore FX and see.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
and this add-on
Open Fx and open System[Root] & Give root permissions.
now to /data/cust/xml
and add the file above .. replace if needed.
now to add an app
open in your device or sd card with fx
Android/data
if u don't know your app package name, fx shows the app icon in android/data right on the folder just copy the name.
add these lines in the file.
<mw_app package_name="com.facebook.katana"
default_visibility="1"/>
don't forget, that file shoud be in /data/cust/xml .. so u must mount read-write in FX
change the value between the quotes in the code above to the package name of the app you want.
the above one is that of facebook.
///mw_app = multiwindow app.
add the line under any line like this
default_visibility="1"/>
now after you are done adding your apps
go to settings > manage apps > all > chose Hwdualwindowlauncher
and clear its data.
Now try multiwindow and see
It wi work if u do it from the homescreen , if u open the app and try it won't. that's because you should reboot
NOTE :
- Don't add your mw_app under any line contaning *nonsystem*.
there's no way to brick your phone while doing ,u r safe.
working perfectly
thank you ahmed hambozo
great work :fingers-crossed:
---------- Post added at 02:45 AM ---------- Previous post was at 02:44 AM ----------
A7mdXpii said:
adding apps to mw is very easy
you will need
- A Rooted huawei device *i'm using mate 7*
- File explorer with Fx root addon
- This https://goo.gl/fFSIgZ
just type in playstore FX and see.
and this add-on
Open Fx and open System[Root] & Give root permissions.
now to /data/cust/xml
and add the file above .. replace if needed.
now to add an app
open in your device or sd card with fx
Android/data
if u don't know your app package name, fx shows the app icon in android/data right on the folder just copy the name.
add these lines in the file.
<mw_app package_name="com.facebook.katana"
default_visibility="1"/>
don't forget, that file shoud be in /data/cust/xml .. so u must mount read-write in FX
change the value between the quotes in the code above to the package name of the app you want.
the above one is that of facebook.
///mw_app = multiwindow app.
add the line under any line like this
default_visibility="1"/>
now after you are done adding your apps
go to settings > manage apps > all > chose Hwdualwindowlauncher
and clear its data.
Now try multiwindow and see
It wi work if u do it from the homescreen , if u open the app and try it won't. that's because you should reboot
NOTE :
- Don't add your mw_app under any line contaning *nonsystem*.
there's no way to brick your phone while doing ,u r safe.
working perfectly
Click to expand...
Click to collapse
thank you ahmed hambozo :laugh:
great work:victory:
A7mdXpii said:
adding apps to mw is very easy
you will need
- A Rooted huawei device *i'm using mate 7*
- File explorer with Fx root addon
- This https://goo.gl/fFSIgZ
just type in playstore FX and see.
and this add-on
Open Fx and open System[Root] & Give root permissions.
now to /data/cust/xml
and add the file above .. replace if needed.
now to add an app
open in your device or sd card with fx
Android/data
if u don't know your app package name, fx shows the app icon in android/data right on the folder just copy the name.
add these lines in the file.
<mw_app package_name="com.facebook.katana"
default_visibility="1"/>
don't forget, that file shoud be in /data/cust/xml .. so u must mount read-write in FX
change the value between the quotes in the code above to the package name of the app you want.
the above one is that of facebook.
///mw_app = multiwindow app.
add the line under any line like this
default_visibility="1"/>
now after you are done adding your apps
go to settings > manage apps > all > chose Hwdualwindowlauncher
and clear its data.
Now try multiwindow and see
It wi work if u do it from the homescreen , if u open the app and try it won't. that's because you should reboot
NOTE :
- Don't add your mw_app under any line contaning *nonsystem*.
there's no way to brick your phone while doing ,u r safe.
working perfectly
Click to expand...
Click to collapse
Followed all the steps, but it's not working. I'm on MT7-L09 with Lollipop B331.
Now I have nothing no apps whatsoever showing in multiwindow
just reboot, nothing less nothing more
Sent from my HUAWEI MT7-TL10 using Tapatalk
Thanks Bro. This worked had to create the folder manually.
glad it worked
Sent from my HUAWEI MT7-TL10 using Tapatalk
Works like a treat!
Multi Window is a feature that I've had deactivated since purchase because of the fact that basically only system apps were compatible, though now it works as it should (with a little manual input)!
Thanks for the post! :highfive:
Scruffykid said:
Works like a treat!
Multi Window is a feature that I've had deactivated since purchase because of the fact that basically only system apps were compatible, though now it works as it should (with a little manual input)!
Thanks for the post! :highfive:
Click to expand...
Click to collapse
glad
Sent from my HUAWEI MT7-TL10 using Tapatalk
Anyone know if this works on B331 MT7-TL10? I've tried the instruction but /data/cust/xml does not exist and can't be created.
MuPp3t33r said:
Anyone know if this works on B331 MT7-TL10? I've tried the instruction but /data/cust/xml does not exist and can't be created.
Click to expand...
Click to collapse
Hey, do you have root access? This a required part...
If you are rooted and cannot create a folder try a different root explorer. I've had it with a couple of these apps where you are unable to add / edit folders or files in root (most surprisingly I got this with ES File Explorer, which was my go-to app for years) I just recently discovered FX (just search those two letters in the Play Store) and it works like an absolute charm, and looks great at the same time! You'll have to install a root plugin, though it is linked in the app and it's free as well. :good:
[EDIT]: I see you are already using FX, sorry about that. I don't think you have the root plugin installed. Search for "File Explorer (root add-on)" on the Play Store and install it, you should then be able to create the folders once you granted the app access in SuperSU.
But besides that, yes, the cust folder in /data does not exist by default (at least it didn't on my device either), but once you create it it works a treat.
Scruffykid said:
But besides that, yes, the cust folder in /data does not exist by default (at least it didn't on my device either), but once you create it it works a treat.
Click to expand...
Click to collapse
I just happened to notice that in /data was a symlink named cust, I don't know what it was supposed to link to because it can't be opened. I renamed it to free the name and was then able to create the path and move the xml file there. Added my apps to the xml like chrome and whatsapp, cleared the data for hwdualwindow app and rebooted, still not working for dual window though, either I've done something stupid or those 2 apps don't support dual window. Ah well....
MuPp3t33r said:
Anyone know if this works on B331 MT7-TL10? I've tried the instruction but /data/cust/xml does not exist and can't be created.
Click to expand...
Click to collapse
- Root acess plugin
- click above then mount Read-Write
it will work.
and please give me a screenshot of the folder u are creating *xml* in it.
Sent from my HUAWEI MT7-TL10 using Tapatalk
A7mdXpii said:
- Root acess plugin
- click above then mount Read-Write
it will work.
and please give me a screenshot of the folder u are creating *xml* in it.
Sent from my HUAWEI MT7-TL10 using Tapatalk
Click to expand...
Click to collapse
Screenshot attached. Note I managed to get the file into the right path, just can't seem to get the feature to work.
MuPp3t33r said:
I just happened to notice that in /data was a symlink named cust, I don't know what it was supposed to link to because it can't be opened. I renamed it to free the name and was then able to create the path and move the xml file there. Added my apps to the xml like chrome and whatsapp, cleared the data for hwdualwindow app and rebooted, still not working for dual window though, either I've done something stupid or those 2 apps don't support dual window. Ah well....
Click to expand...
Click to collapse
Not sure on that synlink, it's nowhere to be found on my device. Just make sure that you create or have the following directory: /data/cust/xml. There is a cust folder in the root folder, however putting the xml files in there does not work.
I can confirm that Whatsapp and Chrome are both functioning well in MW on my device.
MuPp3t33r said:
Screenshot attached. Note I managed to get the file into the right path, just can't seem to get the feature to work.
Click to expand...
Click to collapse
Hold
permission
R , r, W
Sent from my HUAWEI MT7-TL10 using Tapatalk
Do we know if any other launcher is compatible with multi window? I'm just not a fan of the stock launcher
A7mdXpii said:
Hold permission R , r, W
Click to expand...
Click to collapse
After rolling back to B326 it seems to finally be working! Maybe something wrong with my previous install. Looks good now. Attached screenshot with Chrome and ES File Explorer running split screen.
Tried adding my launcher (Nova) to the list and it shows up on the dual screen selection menu but sadly just minimizes all apps and goes to home screen. Guess it's not ideal for 3rd party launchers.
Anyways, thanks for the tutorial mate!
A7mdXpii said:
Hold
permission
R , r, W
Sent from my HUAWEI MT7-TL10 using Tapatalk
Click to expand...
Click to collapse
so basically, create 3 folders which are data( if not already there) then create cust inside it and then create XML folder inside cust. inside XML folder, you will create a file and name it whatever you want and end it with .xml and write inside it. then go to setting and clear data and reboot.
I did this and its not working at all. I can open the multiwindow but I cant add the chrome app.
nassersa said:
so basically, create 3 folders which are data( if not already there) then create cust inside it and then create XML folder inside cust. inside XML folder, you will create a file and name it whatever you want and end it with .xml and write inside it. then go to setting and clear data and reboot.
I did this and its not working at all. I can open the multiwindow but I cant add the chrome app.
Click to expand...
Click to collapse
Which firmware are you running? I got mine to work in the path /data/cust/xml/multiwindow_whitelist_apps.xml
I have a feeling that the path may be different on some firmwares as I could not get this to work on B331, but works perfect on B326.
I see you don't have the complete xml file, download the one I've attached here and try with that, its the one I'm using on my phone.
By the way, I use ES File Explorer with the root access setting enabled. Found it better than the explorer suggested by the OP (personal preference though, use what you like)
MuPp3t33r said:
Which firmware are you running? I got mine to work in the path /data/cust/xml/multiwindow_whitelist_apps.xml
I have a feeling that the path may be different on some firmwares as I could not get this to work on B331, but works perfect on B326.
I see you don't have the complete xml file, download the one I've attached here and try with that, its the one I'm using on my phone.
By the way, I use ES File Explorer with the root access setting enabled. Found it better than the explorer suggested by the OP (personal preference though, use what you like)
Click to expand...
Click to collapse
okay I did this and it didnt work. first question,
I must name the file the same name you have ? " multiwindow_whitelist_apps.xml"
my phone info:
model: MT7-TL10
Android Version: 5.1.1
EMUI version: 3.1
I attached a pic showing the folders and there is a cust folder and a data folder when I access the #system (root) folder and when I make a file inside the XML folder
I will write this inside it:
(<mw_app package_name="com.facebook.katana"
default_visibility="1"/>
///mw_app = multiwindow app.)
right ?
I downlouded ES explorer and I founded two local and there is two data folders, which folder you guys talking about. ?

Categories

Resources