Picasso failure in Android Native Developing - java

I have an android application coded with Java in Android Studio.
I published my Restful Api to web server.
Whenever i open my android app, the pictures uploaded to the server can not be downloaded to the app via Picasso.
Moreover I can not access these pictures under App_Data folder. Any solutions?

I want to share that answer in case someone needs it.
The accessing problem to my pictures under the App_Data folder was caused by a missing virtual directory matching.
First i created a virtual directory pointing to my pictures folder under App_Data.
Second i tested whether i can access these pictures with chrome browser. if i typed the correct path with the new created virtual directory i can access via web browser.
But the key issue is that i can not access these files again from my app.
I found the reason by deep diving and analyzing.
The actual problem is that:
When i tried to access these files by my android app, Picasso assigns some mapping in its cache. which is under my android app folder.
Because of this cache, no matter i fixed the virtual directory issue Picasso can not access them. Picasso only checks it's cache and if there is a 404 error for that file it doesn't try one more time.
So at the and i completely uninstalled from the device and i installed it again. After that everything is fine!
Edit:clearing picasso cache also works. But it must be used on similar conditions, otherwise clearing picasso cache can affect load times as well as internet usage.

Related

Dropbox Java API : Limit access for an user

I'm working on an android app, that has to get resources from a database located on dropbox for various reasons.
I created an app limited to a folder on my dropbox's app page.
I hava data stored on this folder (i know how to do that), and want my android app to get this data. I don't want the app to be able to put files on this dropbox folder.
I know that I can generate an auth token for my app, but I need to manually "activate" it on a web browser to make it usable.
Is there a way to automatically anthenticate my android app, on any device running it, and prevent users to alterate my database, only allowing them to read data from the folder, through the dropbox's java API ?
Thanks for any answers !

Do something before app removing

I've got an app that stores few files on sd card. I want my app to remove those files, if user wants to delete the application. How can I do that? Is there a method like onDelete() or something?
I've got an app that stores few files on sd card. I want my app to
remove those files,
Don't store them directly on the sdcard. Use the app's cache space or the directory pointed by getExternalFilesDir. Both are cleaned up by the system when the app is uninstalled
No, there is no way for you app to know when it is being deleted/removed from a device.
Intent.ACTION_PACKAGE_REMOVED
Broadcast Action: An existing application package has been removed from the device.
The data contains the name of the package. The package that is being installed does not receive this Intent.
This comes mostly because if a code would be executed on the app that was about to be removed some might prevent removal etc.
You should provide an option to your users to wipe sdcard data, or use another storage option (that is linked to your app), but I guess you're using the sdcard on purpose.

Application crash on SD card removal

My application has android:installLocation="preferExternal" . After the application has been installed and launched , the background services of app gets initiated. When I hard remove the SD card , the application gets crashed giving the "ClassNotFoundException" for the application class (which extend android.app.application) .
Following is the error log:
java.lang.RuntimeException: Unable to instantiate application com.sample.MyApplication: java.lang.ClassNotFoundException: com.sample.MyApplication in loader dalvik.system.PathClassLoader[/mnt/asec/com.com.sample-1/pkg.apk]
How could this be handled in such a way that the crash can be avoided?
I think the app you use that stores the data in the External Storage SD card ,that what the app crash I think.and even the app has been installed in the SD card i think and while to try to retrieve the data your app crashes...
Instead try to move the app from SD card to phone memory by going to setting of the app
If you declare "preferExternal", you request that your application be installed on the external storage, but the system does not guarantee that your application will be installed on the external storage. If the external storage is full, the system will install it on the internal storage. The user can also move your application between the two locations.
If you declare "auto", you indicate that your application may be installed on the external storage, but you don't have a preference of install location. The system will decide where to install your application based on several factors. The user can also move your application between the two locations.
Source

java.io.IOException: No space left on device Android

We have application on android market, our users getting a lot from this error:
java.io.IOException: No space left on device
From what I found out so far, I know that they got enough space left on they external storage, and it's only happen on Android 2.x .
I had a small research in Linux file system, and I found out that beyond the space limitation there are limitation on number of files in each directory and the total number of files under root directory. But it looks like our app is not hitting any of those.
Have you ever run in two some thing like that?
Any ideas about what changed in Android (2.x) and how they fix it in Android (3+)?
Edit: this is not installation problem, but when trying to save downloaded files.
adding a loging-output of the absolute filepath, that caused the exception might help.
if the file beeing written was written to local memory file-system and not to sd-card-filesystem here is a possible solution:
java.io.IOException: No space left on device my mean that there is not enought memory left on the internal storage file system of the device.
You can try to install the app on the sd-card instead by setting an entry in the manifest-file:
<manifest ..... android:installLocation="preferExternal">
Edit
if an app is installed in internal memory it-s local files are stored in local memory, too.
if an app is installed on sd-cardit it-s local files are stored on sd-card, too.
so installing the app on sd-card might solve your problem.
I believe (if I'm not correct) that it could be having trouble opening a big file or any file that goes over the max of the eternal storage after all the space is used up. For example: My android didn't have any problems opening up until after I used all of the space on my device til the very last bit. Unless I upgrade or delete all of my fav songs and movies it won't work. Tested and tried it. But then again the error could be more flexible and mean something else as well... :D

Cannot read database on actual android device

I create an application that is using SQLite in Android. I have no problem when launching it using the Android Virtual Device, everything was fine and all recorded data could be loaded.
Right now, I'm trying to install it on my phone. But, I don't know why, the data can't be loaded. Should I do any configuration on it, or should I put my database file in my project somehow?
In addition, my database name is dbtaxi, and my package name is com.syariati.finalProject.

Categories

Resources