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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
lastone
Posts: 85
Registered: ‎02-20-2011

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.
Please use plain text.
Developer
rcmaniac25
Posts: 1,789
Registered: ‎04-28-2009
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".
------------------------------------------------------------
Three simple rules:
1. Please use the search bar before making new posts.
2. Kudo 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.

Projects:
Bing 4 BlackBerry: http://bbing.codeplex.com/
PDF Renderer 4 BlackBerry: http://pdfrend4bb.codeplex.com/
Please use plain text.
Developer
lastone
Posts: 85
Registered: ‎02-20-2011

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.
Please use plain text.
Developer
gluth
Posts: 192
Registered: ‎09-23-2009
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
Please use plain text.
Developer
lastone
Posts: 85
Registered: ‎02-20-2011

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.
Please use plain text.
Developer
Developer
CMY
Posts: 1,115
Registered: ‎02-10-2009
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.
Please use plain text.
Contributor
MarkyC
Posts: 16
Registered: ‎06-27-2012
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;
}
Please use plain text.
Developer
lastone
Posts: 85
Registered: ‎02-20-2011

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.
Please use plain text.
Developer
gluth
Posts: 192
Registered: ‎09-23-2009
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
Please use plain text.