Dropbox Java API : Limit access for an user - java

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 !

Related

Upload files from android to google drive folder

I have created an android application that allows the users to do a test and save the results in a local .xlsl file. This app will run on around 30 devices. Since it is part of a scientific research I need it to automatically save the xlsl file in a specific folder on google drive which I do not own (but which they gave me access permissions and I can write/read). I'm reading the tutorial on the google docs, but from what I understood I need to sign up on all the devices with the account I used for the authentication. Are there ways to avoid it? The devices will probably be without any account on it and since I don't need to know who's uploading it and would be fine to pre-insert my credential in the code so it will automatically upload it with them. Is it possible?

Picasso failure in Android Native Developing

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.

Do I need a server to send PDFs created in my app to the same app (different account) on another device?

Beginner here.
I'm creating an app in Android Studio (Java) where the user can create and store PDFs on the app and send these to another account on the same app, on a different device.
The user will have a list of contacts stored in a database.
Do I need a server to do this? Are there any tutorials online showing one how to code this? (I've been searching for hours but can't find anything specific to my problem. Maybe I'm wording it wrong...)
I was looking into Firebase but I'm completely lost on where to start.
Thanks!
For simple use cases you don't need a server, you can use firebase instead. Currently, they have a storage feature that lets you store files on their servers and retrieve them later.
Here is the official documentation firebase cloud storage
One thing you could do is upload the file from android device and download from another one.

Store files on server and download them automatically when Android app is installed

I am making a Educational app for students of different classes from 9-12. Right now all the study materials are stored in the app itself so the size of the app is increased. Here is the screenshot:-
All the data is stored in html format inside 'assets' folder
These are the notes for all the students for each subject
I want to store these the whole assets folder on server and when the app is installed I want to automatically download the 'assets' folder to user's mobile so that the size of the apk file is reduced. Currently the size of the app is 11 MB, in which about 5 MB is for the assets folder and till now I have just added materials for class 10 and still I have to add content for class 9,11,12. And also i have to add more contents for class 10 so later on my app size will increase.This is the link to the app:-
1Learn NCERT App
The app I am developing is kind of offline app where the user need not to be connected to internet so for the first time when the app is installed I want to sync the files from server to user's mobile but from next time the app will use the downloaded files and no need of Internet connection.
I don't want to use obb files, Is there any other method to do it?
Try expansion files. More info here https://developer.android.com/google/play/expansion-files. It solves a lot of the problems with hosting large files by using Google Play. I am not sure if your main app must be >100 MB for extension files to be allow. Give it a shot let me know.

How to read database of another application

I am working on a rooted device.
I have connected with the adb shell from my pc and I can verify that the other database exists and I can query its tables.
However in the my java code when I try to open the database I get error
android.database.sqlite.SQLiteException: unable to open database file
I am trying to open the database like this:
SQLiteDatabase.openDatabase(PATH, null, SQLiteDatabase.OPEN_READONLY);
The path is something like /data/data/com.xxx.xxx/databases/xx.db
Am I supposed to read the databases of other applications like this or there is another way?
UPDATE:
I also tried making the system app as adviced in this thread Push my apk to /system/app
I think it works because the app cannot be uninstalled after that from the applications manager like the ordinary apps so I think it is a system app. But still I cannot access the database though I am sure the paths and permissions are ok.
Android OS by default does not allow applications to access each others private folders. To be able to read files that are in another applications folder either:
1) you need to have both applications installed using same user id. Add this to both manifests:
android:sharedUserId="com.xx.xx"
2) If other app is a 3rd party app then your only choice is to install your app as system application. To do that you need a rooted phone and you need to mount the system folder. And then you need to put your application into /system/app/ folder and reboot the phone. It should be installed automatically during the boot.
I would assume that the permissions on the database files are set such that your application has no acess. Even if your device is rooted it doesn't mean that your application is running as root.
This is because the app needs root, and needs to change the permissions of the database you are trying to access so that you can actually access it. What you will need to do is, as root, change the permissions of the database so that everyone can access it, do what you would like on the database, close the database and change the permissions back.
This does circumvent security of android, so proceed at your own risk. You can find a code sample at:
http://rratmansky.wordpress.com/?p=259&preview=true

Categories

Resources