Android Asset folder image automatically copying to gallary - android

Greetings dear readers,
I have this query which the team is facing. We are developing a hybrid app for android platform and ran into one issue that seems to get complicated.
Here it goes.
Team is calling static HTML pages(no control on html content modification) in a web view, the html page content involves images which are taken from asset folder. Now when we are debugging the application on android device, asset folder images are getting copied automatically in gallery.
I am not a native coder but it seems asset folder images will be copied automatically. Please correct me if I am wrong. Is there any way, When I debug my app on device I could restrict this automatically copying of asset images to device gallery.
As I am not from Android, this might be the silly question but any help in this scenario would be highly appreciated.
I have researched on google to find out possible fix but unable to find one.
Guys, please suggest.....Any leads on this....

If you don't want your photos being accessible from gallery, add .nomedia file to the folder copied onto the device. This will prevent photos from appearing into gallery.

Related

how to use android_asset

I try to make Webview from to display application/x-shockwave-flash embed element in my app, but i have blank gray screen on emulator and white on device. There are many topics about this problem but any1 really solved.
I explore log of simillar app and see: file//android_asset/index.html. So question... this static file or i can get it from web or modify it.
I trying get my data video.loadDataWithBaseURL() from web, but can i have that data from local storage?
Maybe I said something wron but it's look for me like 'convert web data to local'?? Can some one help my in my problem or explain in this question.
Thank you.
file://android_asset/ is a way that allows android apps access assets by a network-based URI. But assets represent neither local nor online files, they are packed into your apk. Put any files in assets folder in a android project and they will be packed into the apk file by the builder.

What are the file formats in Android WebView cache directory (data_1, f_000001 etc.)?

I created a rudimentary browser with help of a WebView.
When I visit a website (containing some text and a few images), the cache directory in /data/data/com.mayexample/cache/webViewCacheChromium gets filled with a few files called index, data_0, data_1, data_2, f_00001, f_00002 etc.
I was wondering, what's the format of these files, what do they contain? I thought about "so, a few of these files surely have to be the website's images then" and tried opening them in a file manager (open as image). But whatever file I pick, the process says "Failed loading!". Even if I rename some of them to .jpg, still I can't open anything.
I have read on the internet that this worked for some people though (look at Android WebView - Load Images from cache, it's exactly what I want to do), but I can't do anything with the cache's files.
Do you know a way to open webview cache files? Doesn't one file represent a corresponding cached image for example?
What I really want to achieve (once I understand the structure of the cache files) is to programmatically fetch images of the webview from it's cache, like the author of the link posted above (unfortunately this posting's answers don't help much)
Thanks!
The cached files might be one of the CSS, or JS/image/html types. On earlier Android releases, one cached file maps exactly one CSS or JS/image/html file.
As far as I know the Browser engine (actually the HTTP module) maintains such cached files in a URL-to-HashKey manner. So what you found (such as "4f42185de3a3a461_1") may be associated with any web resource files such as JS/CSS/images/HTML, etc.
I remember WebView used to store such URL-to-HashKey mapping data in sqlite3 tables in earlier Android versions.
The problem here is you have no idea about the mapping relations so you can hardly retrieve the file you want. A tricky way is to read the AOSP source code then you may be able to know how the generate the HashKey by an unique URL, or you can manipulate the sqlite3 tables, if there are still any on Android 4.4.
I was able to view files in the webViewCacheChromium folder using this tool designed for the Chrome desktop browser:
http://www.nirsoft.net/utils/chrome_cache_view.html
The contents are basically what you'd expect for web cache - images, javascript, css, html.

PhoneGap (1.9): How to use Filesystem to delete content of a Folder?

I'm working with Sencha Touch 2.0 and PhoneGap 1.9 to create an Android Application. I'm already saving all images (by taking a camera-shot) on the SD-Card using the Filesystem-access provided by PhoneGap.
Now I also wanna be able to delete the whole content of the Folder on the SD-Card whenever the user uninstalls the app.
In the API Doc I couldnt find a fitting delete operation, so I hope you can help me with this.
You would want to use DirectoryEntry.removeRecursively.

How to package wallpapers into an apk?

I don't have any programming knowledge, but I have installed Eclipse, and android SDK. I want to package some wallpapers into an apk and publish them in the android market. Can someone show me a tutorial or explain how to do it?
Thanks
Files placed in your res folder when you build your application are placed inside the apk.
Though they will not be avaliable for external use other than your own application. Aka, you will not be able select them via the built in wallpaper picker options.
You would have to have the apk copy the resource files to the SDCard when it is run.
Actually here is another question asking the same thing:
How to put a wallpaper inside an apk file?
Its relatively straight forward but requires some basic android and programming skills.
Store all your wallpapers in your res folder (apk).
WHen the application launches, one by one, save the resource file to the SDCard. (Check if they already exist first).
The user can now navigate his/her photos and see your wallpapers. - And hence able to set them as wallpapers.
If you don't have any programming knowledge, it doesn't matter. Here is an android wallpaper app example code, you can easily replace your image url (which should be on internet) inside.
Android Wallpaper App Tutorial (1-4)

Separating images from the apk file in android

I am writing an android application which has a lot of images in it.
I do not want to keep these images as a part of my apk file because that will make the size of the apk file very huge.
I have written the application in a way that it loads these images at runtime from the sdcard from some predefined location. Now my problem is that how do i provide these images to the user who wants to install my application. Since the images are not a part of the project (i.e. not present in any of the drawable folders) so they will not be a part of the APK file that i provide.
Is it even possible to do such a thing in Android? Or can someone suggest a better solution that i have right now. Any help is greatly appreciated.
There is an official way to achieve what you want: APK Expansion Files

Categories

Resources