android how to auto install applications on SD card - android

Is that possible for android to install all the apps on SD card once the SD card insert in the phone.
Is that possible to build something like the auto run application in flash disk on windows,
here in android the apps are all stored in sd card , i am finding a way to install them once the card insert into phone.

No. Android wisely won't do that.
If you want you can write an application which will scan the sdcard (perhaps even automatically on insertion) for apks and use an intent to bring up the install dialog. But the user will first have to install your application, and confirm the installation of each new app from the sdcard. Also the device will have to be set to allow non-market sources.

Related

android studio keeps forcing emulated sd card when running on device, cannot stop it

I'm just try to transfer over data from my app to my new cell phone but all the basic apps only lets me transfer the app and none of its data.
I have created a app that lets me store information on my phone in a txt file, but I need to move it to my new phone. I would like to have an export/import function instead of just hardcoding the data into a new version of the app.
Only problem, I cannot access the SD card when I run 'app' from android studio (To the device thru USB). It does not matter if the SD card is installed or not, It just keeps defaulting to an emulated SD card. Tried switching SD's between phones (file not found). I have mostly installed the app thru running in android studio to my phone. Maybe that is why I cannot access the SD card, because a setting is wrong somewhere?
Is there a way to make android studio stop using emulated drives and make it use only physical drives?
if(Environment.MEDIA_MOUNTED.equals(state))
Is always true
Found the files here, but not on my SD card
Tons of variations of:
File myFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "dbimport.txt");
All give the same-
Device Manager:
shell/emulated/0/filename
from app:
Storage/emulated/0/filename

Android app on Chromebook to access USB devices?

I am taking an Android app and making it run on Chrome using the ARC Welder. For best results we're only targeting the Chromebook / Chrome OS, not Windows or OSX.
The app is running with some minor glitches, but I need to enumerate photos on an inserted SD card.
The problem is that the /mnt folder accessible within Android Runtime only contains the virual sdcard folder, and does not reflect the real SD Card or USB Flash Drives attached to the Chromebook.
How can these photos be automatically loaded from the SD Card into the Android App in the Android Runtime.
I know that I could use a CRX (Chrome Extension) to read the SD Card photos, but how could they be passed to the Android app? And can this be in the same CRX as the ARC Welder creates or must it be a separate CRX?
I found a workaround which is to use the Additional Metadata section and add
{ "enableExternalDirectory": true }.
When the app first launches, it prompts the user for the folder. One must select the SD card.
Then my app works as expected, as the 'emulated sd card' becomes the 'real sd card'. This is not the most user-friendly approach, but it works.
I'd still prefer if we could load the files from a CRX into the Android Runtime...

What happens while moving app to SD Card in Android

I want to know,
What happens to app data/database files/ etc while moving app from internal storage to SD card and vice versa?
Also I have an app which is installed in external storage. Im upgrading the app. The latest version of the app has flag to restrict install only in internal storage.
Will this latest app get installed in internal storage? Will the system automatically move the app data from external to internal or the data from previous installation is lost?
Actually this does not seem a programatic question is more an Android OS question.
First. As developer you don't choose HOW your app is installed, but since Android 2.2 you can choose WHERE:
Existing applications that were built prior to API Level 8 will always install on the internal storage and cannot be moved to the external storage
Since android API 8:
android:installLocation
internalOnly: Install the application on internal storage only. This will result in storage errors if the device runs low on internal storage.
preferExternal: The android system tries to install the application on external storage. If that is full, the application is installed on internal storage.
auto: Let the Android system decide the best install location for the application. The default system policy is to install the application on internal storage first. If the system is running low on storage, the application is then installed on external storage.
As long as you programatically don't define the installation / moving process, Android operating system will take care of moving (if possible) from internal to external and viceversa. But as programmer you must be carefull with the type of app you are developing to know if you should or not allow this option
Warning: When the user enables USB mass storage to share files with a computer or unmounts the SD card via the system settings, the external storage is unmounted from the device and all applications running on the external storage are immediately killed.
What happens: As long as you don't decide, let's explain in a simple way.
All files of the app are moved to sd card except one little pointer in the internal storage that tells the system where the app is located. (imagine if you format your SD card manually, then your phone won't know app has dissapeared) but if you unmount it phone won allow you to access.
Second Application updates will by default try to retain their install location, but application developers may change the installLocation field in an update. Installing an application with this new attribute on older devices will not break compatibility and these applications will be installed on internal storage only. That means, older data will be moved as long as the app remains with same identifier (and signature if market app).
Source / Source
ADVANTAGES / DISAVANTAGES
To keep / update your database files / configuration when upgrading your app check here and here

USB driver for android

Is there a way to write a driver for android phone, so that when i plug it in the computer it's going to install it with the default usb drivers? I want to make a application that needs a driver to be installed on the computer to use it.
You could have your Android App download or contain the installer for your driver and then copy it to the SD card storage area. There is no way to get the installer to autorun because Android connects either with MPT or PTP. These can be used to access a file from the SD card, but it does not mount as an ordinary storage device. You will need to have instructions in the app to tell the user how to access it.
Honestly, it will probably be easier to have them download it separately and install it.

Android file transfer without SD card

I'm trying to copy my app to an Android phone without an SD card. I've tried bluetooth and I've tried email attachment, but both of them seem to require an SD card for the download to take place. Is there any other way to do this without having an SD card at hand?
I frequently deploy to my phone using the eclipse IDE. Assuming the drivers for your phone are installed on your PC you can connect your phone with a USB cable and simply run the application in debug mode and it will deploy to your phone.
I've also emailed an app to my phone and then install it from my email. Are you certain you have allowed apps to be installed from unknown sources? If you have not you will need to do so.
Here is a procedure if this is from eclipse.
In your project>Bin>file.apk assuming eclipse
send the file.apk file to your phone.
Use an app installer to install the file.apk to your phone.
There you go a copy of your program
In my experience neither the mail client app or anything that imply a download from a website from the browser have being able to install the APKs without compying it on an SDCard before.
The only solution I got working so far would be to open the APK from the Google Drive app.
I suppose other network drive services could works as well but never had occasion to try them out.

Categories

Resources