Check blackberry is connected via USB - blackberry

I am doing an application which access the SD/Media card to display its images. But when device is connected via USB I cant access the media card. If thats the case, I want to show a message to user asking him to disconnect device form computer.
How can I programatically check that SDCard is accessible or not ?
How can I check whether the device is connected to computer via USB?
Thanks.

I am not sure about your second question about checking whether the device filesystem is mounted via USB on a computer, but as for the first question, to check the available filesystems, call FilesystemRegistry.listRoots(), which will return an Enumeration of String objects. If "SDCard/" is in the enumeration, then the SDCard is available.
Some devices can also store images on the device storage as well, which is distinct from the SDCard. In that case, check for "store/" as the filesystem root.

Related

Usb disk availability notification

How do I detect usb disk availability? When I connect my Android phone to pc, it appears as USB disk but it's not accessible until I tap "Turn on USB storage" on the phone's screen. Is there an event I should use? I know there is a proper way to do so, please advise.
Update: It seems I need to explain: in a case like with my Android phone Windows doesn't send WM_DEVICECHANGE when i turn the phone storage on. Perhaps, it similar to card readers or cdrom - a letter assigned to the drive, but you can't access it until memory card or cd inserted. I want to be notified somehow when this happens. I could use polling of course but it doesn't seem to me
very efficient. I'm sure this should be possible because the Windows Explorer does somehow detect the changes.

Can you communicate with nearby devices using a website?

Can a website help a user communicate with nearby devices via bluetooth/WLAN without downloading software?
User requests that something be done on their device (which could be, for example a wirelessly connected printer or a bluetooth keyboard).
The site, which contains a repository of relevant actions, sends specific instructions for that device to the user's own machine.
Those instructions are then relayed to the correct device (with the user's permission) via the user's device's WLAN or existing bluetooth connection.
Part 3 is what I'm not sure of - is there a mechanism by which a website can contribute to a wireless/bluetooth connection held locally?
It is not possible. User browser can't interact with hardware for wireless networking.
You should force user to install some custom software to do this.
You would have to submit the "commands" first, then have the device make requests to the website server, i.e., check for any pending "commands" for the device, and then process them locally. A website is not "thing" that can directly interface with a hardware device.

Finding the list of saved WIFI SSIDs on an iPhone

I understand you can get the current connected Wi-Fi network using the CaptiveNetwork interface. I also understand that Apple has cracked down on scanning for networks. What I need is to be able to read the list of 'stored' SSIDs that the phone connects automatically to.
I am attempting to use the Wi-Fi network as a sort of location trigger, that changes functionality when the user connects to his 'home' network. Using CaptiveNetwork I can get the current network and allow them to save that name, but can I get the list of saved networks so the user can set locations without having to be at each one during setup?

How to access external memory while device is connected with data cable in blackberry

I am trying to debug my app while connected to the system through USB data cable .
my data are downloaded and should store in sd card specific memory , but i am not able to access sd card in this situation.
So any body help me how do i access external memory while connected to the data cable .
Thanks
When usb-cable is connected, SD-card cannot be accessed. This is implemented on device operating system level. The only way to make sd-card accessible is detaching usb-cable connected to computer.
There is option in device setting about mounting SD card. You could set it to "never" or to "promt".

Connecting to a special wi-fi network via iPhone App

I have to build an App that connects to a special Wi-Fi network and the opens an Ip address that is only available withing the network.
Is it possible to connect to a special wi-fi network (say "Network XYZ") via iPhone App. If so, please let know, so that I have an idea how to solve this.
Sadly no. Not from within the app.
All you can do is instruct user to go to settings and connect to that network.
If iPhone was not registered to any WiFi network before entering your app and your app has usesWiFi key set to YES then user will get a list of available networks to choose from.
One more big problem is: there are no AdHoc networks on this list - only infrastructure networks. AdHoc networks are available only trough settings.
What you could do is to instruct your user to set the auto-join feature on for desired network.
I'm afraid the only way to change the network is via the Settings application. Otherwise, rogue apps might be able to move users to their own proxies without the user's knowing.
It may be possible on jailbroken devices, however, as you would no longer be confined to working within the usual app restrictions on accessing system-level settings.
You can have your app launch once the user connects to the SSID you specify using the CaptiveNetwork API.

Resources