Codename One, Possible to access photos without using Display.getInstance().openGallery()? - codenameone

Is there are way for codenameone apps to access the images stored on the device programmatically and not using Display.getInstance().openGallery().
I want to construct my own gui for selecting images.
Thx

No. You can access these files as read only in a device specific way using native interfaces. Historically this wasn't possible technically in iOS and it was only possible to launch a picker UI to view the content of the camera roll.
For iOS the Photo's native API can be used https://developer.apple.com/documentation/photos?language=objc
It would require wrapping that with a native interface which is non-trivial https://www.codenameone.com/how-do-i---access-native-device-functionality-invoke-native-interfaces.html

Related

React native application theming

I have a question related to React Native.
I have existing application that should be themed and theming should be part of the configurable settings. There should be 3 aspects of such theming: changing colors/theme, changing logo and add custom fonts
I see this is a way that there will be settings view where:
there will be possibility to upload image, image will be stored in filesystem in ios and android and then used as a brand logo
there will be multiple settings regarding some primary, secondary, buttons colors as hash values, or maybe some color picker component
The most complicated stuff is having custom fonts that can be configured by user in setting view of application. Anybody have experience with doing such a thing?
Any thought/suggestions in above points will be helpful. Like links to native libraries for both platform or any tips from more experiences React Native developers
The best ways I see to achieve what you want are :
Use https://github.com/itinance/react-native-fs to access file system so you can easily store and access the logo that the user want. If the image has some size restrictions you could as well store your image Base64 string in AsyncStorage but this is not recommended.
You can have a kind of theming system by using a global style file that your screens use, the values requested (for example "dark", "light" etc...) can be store in AsyncStorage.
Do you want the user to be able to use his own personal font ? I don't think this is possible. If you want to have multiple fonts and the user can choose which font will be used in a list for example you can follow this tutorial to install custom fonts : https://medium.com/#kswanie21/custom-fonts-in-react-native-tutorial-for-ios-android-76ceeaa0eb78. Then all you want to do is use your theming system to select the fontFamily that your text elements will be using !
Let me know if I'm not clear enough or you need advices, I recently did what you try to achieve :)

Difference in GoogleMaps rendering

I have noticed some difference in the google maps simulator and on-device rendering of googlemaps. Going through the beatiful featured apps like Travel2gether and Paltel app, are the maps used in this apps native because I noticed they come with the + - sign and they even show more places mapped wheres on the normal GoogleMapComponent those places don't show.
Any clarifications for this?
Regards
Paltel uses native maps which you can install via the extensions menu.
You can read about using it here.
Travel2gether uses the old maps with the Google provider instead of open street maps.
Each has its advantages/limits but we are slowly gravitating towards the native maps approach which is probably a better choice.

Bootstrap 3 - Is it possible not to load assets when on mobile?

Im looking for some guidance on a responsive site design written using Bootstrap 3.
Basically I want the mobile version to be as lightweight as possible and only load JS and HTML that is necessary for the mobile view, and not load assets required for the desktop view. I would like to ignore loading specific JS files when the page is loaded via a mobile device.
Is there a simple method to do this with Bootstrap?
My guess is that I need a Javscript function to detect the device and use that as a trigger, however I was wondering if Bootstrap had this capability that I could use?
Appreciate any thoughts.
It seems there is already answer to detect mobile browser with javascript. Detecting a mobile browser
Otherwise you can detect the mobile device by using http_user_agent to decide not to load assets when the page is loading.
Here is already answer to detect mobile device with php.
Check if PHP-page is accessed from an iOS device
You can perhaps do it by user agent. There is an answer here that might help
Load a javascript file and css file depending on user agent

Yii - Using two main layouts for desktop and mobile

I'm developing a simple app that will be used by desktops and mobile.
I'm trying to use this approach:
Before rendering the main action in the main controller I'm checking if the brower belongs to a "mobile" category (Using the plugin detecmobilebrowser detecmobilebrowser) then I need to switch to another flow (The actions available will be different) and for this actions I'll use a layout developed with jquery mobile to ensure the compatibility to different devices.
Using a:
$this->layout='//layouts/mobile';
changes the layout, but renders first main.php.
Is there a way to solve this without creating a new theme?
Thanks for your support

J2ME access Default media player track running in background

Is there any way to access track being played in Music player running in background in J2ME?
or at least the path of the file
AFAIK you can't able to access the default media player using Java ME.
Search for APIBridge.jar on google. This jar file allows you to read sms from inbox, use native camera application. So there might be possibility, It allows you to use Native Media Player.

Resources