Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 87
Registered: ‎02-20-2011
My Device: Not specified

Detect Built-in media storage

Hi, How to detect if a device support built-in media storage or eMMC ??

------------------------------------------------------------------------------------------
1. Feel free to press the like button on the right side to thank the user that helped you.
2. Please mark posts as solved if you found a solution.
Developer
Posts: 1,806
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.2576, Z30 (STA100-5)-10.3.1.2582, Passport (SQW100-1)-10.3.1.2576, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: Detect Built-in media storage

Use javax.microedition.io.file.FileSystemRegistry.listRoots() and check to see if the desired storage medium is avaliable. Built-in will be "store" and eMMC (more commonly SD) is "SDCard".
---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Developer
Posts: 87
Registered: ‎02-20-2011
My Device: Not specified

Re: Detect Built-in media storage

eMMC is not SDCard. embedded multimedia card (eMMC). I need to determine what a device support SQLite (eMMC/SDCard) or not.
------------------------------------------------------------------------------------------
1. Feel free to press the like button on the right side to thank the user that helped you.
2. Please mark posts as solved if you found a solution.
Developer
Posts: 192
Registered: ‎09-23-2009
My Device: 9860/PlayBook/Dev Alpha
My Carrier: Plus GSM

Re: Detect Built-in media storage

SQLLite is supported on devices with OS 5.0 or better. You don't have to check it via checking of availability of SDCard.

Found my post helpfull? Like it! It solves your trouble? Help others and accept it as solution. Search before asking.
My apps: Secret Cod3s | Should my tablet be banned?
--
Jakub Nietrzeba
PGS Software S.A.
Your reliable partner in Poland - IT Outsourcing - BlackBerry, iPhone, Web and Standalone applications
Developer
Posts: 87
Registered: ‎02-20-2011
My Device: Not specified

Re: Detect Built-in media storage

Yes, but not true. SQLite cannot work on device with OS5/OS6 without SDCard.

The default location for the database file is /SDCard/databases/<application_name>/
------------------------------------------------------------------------------------------
1. Feel free to press the like button on the right side to thank the user that helped you.
2. Please mark posts as solved if you found a solution.
Developer
Developer
Posts: 1,123
Registered: ‎02-10-2009
My Device: 8130 / 8350 / 9530 / 9550 / 9850 / PlayBook
My Carrier: Verizon

Re: Detect Built-in media storage

Rcmaniac25 is still correct. You can use the FileSystemRegistry.listRoots() or just check for file:///store/home/user/ directory.
Contributor
Posts: 16
Registered: ‎06-27-2012
My Device: Bold 9900
My Carrier: Bell

Re: Detect Built-in media storage

There is actually an example right in the listRoots() api, but this is what you're looking for:

 

public boolean hasSD() {
	Enumeration e = FileSystemRegistry.listRoots();
	while (e.hasMoreElements()) {
		String root = (String) e.nextElement();
		if (root.equals("SDCard/"))
		{	// the user has an SD card installed (we didn't check for free space though)
			return true;
		}
	} 
	// we went through all the roots, and found no SD card, it's safe to assume there isn't one in the device
	return false;
}
Developer
Posts: 87
Registered: ‎02-20-2011
My Device: Not specified

Re: Detect Built-in media storage

I think u cannot create sqlite db in device like Gemini 8520 (OS 5) although Gemini has file:///store/home/user/ directory
------------------------------------------------------------------------------------------
1. Feel free to press the like button on the right side to thank the user that helped you.
2. Please mark posts as solved if you found a solution.
Developer
Posts: 192
Registered: ‎09-23-2009
My Device: 9860/PlayBook/Dev Alpha
My Carrier: Plus GSM

Re: Detect Built-in media storage

You can attach any location for database with use of DatabaseFactory.create. You can put there internal storage URL as location, path defaults to sdcard, but you can override it with your own path.

Found my post helpfull? Like it! It solves your trouble? Help others and accept it as solution. Search before asking.
My apps: Secret Cod3s | Should my tablet be banned?
--
Jakub Nietrzeba
PGS Software S.A.
Your reliable partner in Poland - IT Outsourcing - BlackBerry, iPhone, Web and Standalone applications