android-sdcard

Android - How to receive the BOOT signal with an application installed on sdcard?

爱⌒轻易说出口 提交于 2019-12-22 16:45:02
问题 I need to start a notification service for an application when the device boots. I have implemented a BroadcastReceiver that listens to the boot signal in order to start the service. However, this works only if the application is not installed on sdcard (because the signal is received before the sdcard is mounted). Is there any solution to keep installing the application on sdcard and yet still receive that signal? Any hack for this? Let me know! Thanks! 回答1: You could either: Register an

Android - How to receive the BOOT signal with an application installed on sdcard?

爱⌒轻易说出口 提交于 2019-12-22 16:44:23
问题 I need to start a notification service for an application when the device boots. I have implemented a BroadcastReceiver that listens to the boot signal in order to start the service. However, this works only if the application is not installed on sdcard (because the signal is received before the sdcard is mounted). Is there any solution to keep installing the application on sdcard and yet still receive that signal? Any hack for this? Let me know! Thanks! 回答1: You could either: Register an

Android get all available storage devices

浪尽此生 提交于 2019-12-22 10:58:49
问题 Is there any function/method which allow to detect all kind of different storage to your phone with their names. I mean to detect all internal/external storage if there is more than one available on your device. And how to detect if there is available SD Card or not? Thanks in advance! 回答1: I don't know about other types of storage device, I only know Internal Storage and External Storage device for android. Now for check available external storage something like, public static boolean

Environment.getExternalStorageDirectory().getAbsolutePath() not working and giving /storage

雨燕双飞 提交于 2019-12-22 10:44:19
问题 My code myDb = openOrCreateDatabase("/sdcard/FashionGirl/ImagesDB.db", Context.MODE_PRIVATE, null); myDb = openOrCreateDatabase(dbPath, Context.MODE_PRIVATE, null); worked perfectly, but was giving warning Do not hardcode "/sdcard/"; use Environment.getExternalStorageDirectory().getPath() instead So I tried, String dbPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "FashionGirl/ImagesDB.db"; myDb = openOrCreateDatabase(dbPath, Context.MODE_PRIVATE, null); But strangely,

Fetching only first 100 rows of image from mediastore

左心房为你撑大大i 提交于 2019-12-22 07:47:11
问题 Is there a way to limit the result retrieved from mediastore using managedQuery function on Android. Since I currently have a grid that displaying all photos found on the sd card but it is too intensive of fetching it so I decide to limit the result retrieved from the media store but could not find a limit function that can reduce the resulting set of data. Please help 回答1: use order in contentresolver's query method to implement your function, such as 'columnname asc limit number' in my case

Fetching only first 100 rows of image from mediastore

筅森魡賤 提交于 2019-12-22 07:46:29
问题 Is there a way to limit the result retrieved from mediastore using managedQuery function on Android. Since I currently have a grid that displaying all photos found on the sd card but it is too intensive of fetching it so I decide to limit the result retrieved from the media store but could not find a limit function that can reduce the resulting set of data. Please help 回答1: use order in contentresolver's query method to implement your function, such as 'columnname asc limit number' in my case

How to store Android SQLite database in sdcard

廉价感情. 提交于 2019-12-22 05:35:21
问题 I have just created database,its stored in data/data/database folder by default.Now i wanna store database in sdcard,I have used following code.please suggest me where have to add code for that.Thanks Code: public class DataBaseHandler { SQLiteDatabase database; private static DataBaseHandler obj; private final String TABLE_NAME = "main_db"; private final String COLUMN_FIRST = "_id"; MovieDetails md = new MovieDetails(); private DataBaseHandler(Context context) { DataBase dbobj = new DataBase

Unsupported virtual sd card in android emulator

五迷三道 提交于 2019-12-22 05:24:17
问题 I don't know why the virtual SD card isn't working anymore. Someone got any leads or why could that happen? I'm using Android emulator with API 26 (Android O) 回答1: To solve this problem use sd card size >= 512 MB in emulator . Android studio 2.3.3 created 100 MB sd card by default. The commit on the AOSP source code for Android Oreo states that a 512-megabyte file is created and mounted as a virtual disk for the system to use as an SD card. 回答2: I faced the same problem too. Like others have

App to SD functionality on Android

会有一股神秘感。 提交于 2019-12-21 21:31:57
问题 I'm getting more and more requests about being able to use an App to SD feature that must be part of Android 2.2, but I really have no experience with it. I also don't know where to find any documentation regarding how to make my apps compatible with this feature. People have told me my apps cannot be moved to the SD card. My mind is also telling me that this is a really bad idea for paid apps that don't have license protection of any kind. Has anyone had any experience with this, know of any

How to check if a file exists in a directory in sd card

半腔热情 提交于 2019-12-21 11:31:12
问题 I want to check whether a given file exists in android sd card. I am trying it out with creating a file using the absolute path and checking with file.exists() but its not working. The URL for the file is "file:///mnt/sdcard/book1/page2.html" and the file does exist. But somehow file.exists() isn't showing the same. 回答1: File extStore = Environment.getExternalStorageDirectory(); File myFile = new File(extStore.getAbsolutePath() + "/book1/page2.html"); if(myFile.exists()){ ... } This should