titanium : how to get file located inside /res-long-port-ldpi - titanium

I'm trying to acces a file located in /assets/android/images/res-long-port-ldpi at runtime
without success... I tried many path different, but exists() always return false any ideas how to do it ?
var path = "/images/res-long-port-ldpi/default.png";
var splashScreenOld = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, path);
Ti.API.info("screen: file exist = "+splashScreenOld.exists());

Android natively switches between the density folders based on device density. This file will be accessible at /images on a low density device. It is not directly accessible on other density devices.
If you are having trouble switching the splash screens make sure you have deleted the build folder and the app from the test device before re-running.
If you have a different use case please explain a little bit further.

I tried with the path set at :/images but no success for opening the file.
My goal is to have random splash screen images when the app is started. It seems that only 1 image named default.png located in one of the directory
-res-long-port-ldpi
-res-long-port-hdpi
- etc....
will be loaded and used as splash screen. It seems that appcelerator does not provide a way to have different splash screen. So if i have 4 images in the directory lets say
default.png, default1.png, default3.png, default2.png
i want to open file and rename it at runtime to default.png making the trick of changing the file for having a different splashscreen every time the app is launched.

Related

How to play embedded video, by prevention of producing new video file in directory path?

I am developing vb.net Windows application for playing the video file.
I have added a video files in embedded resource in this way:
Project->Properties. Then select the "Resources" tab. Next Select
"Add Resource"->"From Existing File".
I am able to play the one video,with following code
Dim FilePath = Path.Combine(Application.StartupPath, "My video.mp4")
If (Not File.Exists(FilePath)) Then
File.WriteAllBytes(FilePath, My.Resources.video1)
End If
AxWindowsMediaPlayer1.URL = FilePath
AxWindowsMediaPlayer1.Ctlcontrols.play()
The video is working fine , but problem is, application creates the video file in the bin folder every time.
You can see here...
My application's Current exe size in 200 MB, as I have added many videos into the resources.
What the use of adding video into resources, if it going to produce new video file every time ?
I have did same thing with images, I have added images in resources
which used in the app,
but I don't req. to carry these images as well , it dont produce the image after running the app.
I can put the exe on any machine and app gets run with those images perfectly...
Is there any way to play the embedded video , from resource itself
without creating the video file ?
Some thoughts, then a possible solution:
I wouldn't recommend embedding large videos in your .exe as it creates a huge executable.
There's only so much you can do to prevent piracy. Even if you
prevent them from copying the local video file, they could still use
software to record their screen.
Having said that, what you'd ideally want to do is play from a memory stream instead of a file. But AxWindowsMediaPlayer can't play from a stream.
What you might be able to do is play it from a virtual file system which mimics a local file but in memory. Here's an SDK that allows you to do that: http://boxedapp.com/encrypted_video_streaming.html
From the documentation: Why and when is it useful? "When an application uses DLL and files, which are to be kept secure, and because of that you can't save them to disk"
They have examples for VB.Net including using the AxWindowsMediaPlayer.
Also, it does require purchasing a developer's license.

Binary is not optimized for iPhone 5 error message for Xcode 6.3

I've read a number of similar Q&As regarding this subject but none have provided me with a working solution.
All my images are PNG.
My deployment target is 8.3 for iPhone.
I'm using Xcode 6.3
I am using an image catalog.
I've tried using -568h in the image name and tried not using it. I tried changing the filename to "Default-568h#2x.png".
I've deleted all images from the image catalog and dragged them back in again.
I've created a new launch images catalog.
No mater what I've done, the same error message appears when I attempt to upload to the App Store:
EDIT:
On the off chance that lacking iPad launch images might have triggered this issue, I also added all launch images for iPad. I also renamed all the image file names, created a new launch image catalog (again) and imported all images. Still getting the same error message.
Resolved the issue but not sure on the exact reason behind it.
The Launch Screen File field had LaunchScreen selected.
The correct selection should have been Main.
This solved the issue and I was able to submit the app without the error message.

How can I use code-generated images on my WinRT live tile?

I'm trying to create live tiles in my app by using BitmapRender (in Windows 8.1) to create an image from a user control, which I then want to add as my live tile image.
Creating the image works perfectly, and I store it in the app's roaming folder. However, I can't get the image to add to the live tile when created this way. The odd thing is that if I copy my generated file into the project and then try to attach it to the live tile it works (so the image must be correctly formatted/size, etc.); and if I copy a random image into my roaming folder and set that as the live tile image it also works (meaning I am able to use a file in the roaming folder to set the tile image)...so that means I am referencing the file location correctly, and the image itself is capable of being used on a live tile...so why doesn't it work?
I have created a sample project (link below) that illustrates that my live tile creating code works (with an image stored in the project), and also that I can successfully create an image from a UI control and store it in the roaming folder (FWIW I've tried using different folders with no change in behaviour).
Is there something I'm missing? Any insight or help would be greatly appreciated.
Project is in VB.net, but I can figure out answers in C# if that's easier.
Sample project to illustrate the issue
The trouble is that you're attempting to use an absolute file path to reference the image, which is not supported. If you look in the tile schema, specifically at the page for the element, you'll see that the src must be an URI using http[s]://, ms-appx:///, or ms-appdata:///local for Windows Store apps. The fact that you can use a relative in-package path of /livetile.png is a bit of a fluke, as that's defaulting to ms-appx:///livetile.png.
What you need to do, then, is just use this for a filepath:
filepath = "ms-appdata:///local/livetile.png"
I tried this in your sample and it worked fine. Do note that only the local folder is supported here, not roaming. This is primarily because roaming appdata is limited to 100K to begin with, and dropping tile images in there would often quickly fill your quota. You'll want to then generate the image locally on each device (which would make sense also because you can then take the current scaling into account).

IBM Worklight - how to rename an application and change its icon, splash image

We've used an existing example application to start a proof of concept with Worklight, we've made a lot of changes to the original code and we would like to change the application name and customize its icons and splash image. We've managed to make the aforementioned changes (Name, icons and splash) inside xCode, however this doesn't serve the future purpose of an automated build from Worklight to ipa.
Could you please let us know what steps are involved to:
How to rename an existing application in Worklight (changing only the application-descriptor.xml doesn't change the generated binaries though).
How to change icons and splash screens for app.
When you create a new application for a Worklight project, the application name is used throughout several files, so you will need to find all occurrences of the given application name and change them. These are:
main HTML filename
main CSS filename
main JavaScript filename
inside main HTML filename (references to the main CSS and JavaScript files, title)
Inside application-descriptor.xml (the elements: displayName, description, mainFile)
Note, the filenames should not matter to you. In the future they will, hopefully, always get a generic name (like index.html or main.css. ...).
The app icon title in the device is controlled by the displayName element in application-descriptor.xml.
As for the icons and splash images, you can simply place thme (regular icon, retina icon, splash image, retina splash image) with the appropriate filenames in the "nativeResources" folder (sits next to the "native" folder) and they will be copied during build time to the native project (which you will eventually open in Xcode).
You can find out the correct filenames inside the native >> Resources folder.
quote:
however this doesn't serve the future purpose of an automated build
from Worklight to ipa.
Worklight will, of course, never create an .ipa file for you... that's the role of Xcode.

How to load an image with unique names from a private folder?

I am working on an app for iPad where I want to have lets say 100 jpg's in a folder.
They could be named like 01.jpg, 02.jpg etc.
In my app I like to browse those images and when clicking on one of them I need the name of the image to be able to send some data over the network (the data part works fine).
I tried to use UIImagePicker but I found out there are no name connected to the actual image.
Then I made another approach where I have a number of pages where I have buttons and here I load in the images which works fine as long the are a part of the recourse of the project...
But here comes the real problem.
The user of the app should be able to change those images over time without recompiling the app.
So I do look for a way to have a folder where the user can place/replace images with the names 01.jpg etc and the app to use those updated images.
Ideas are very welcome.
Wiljan
I am not sure that I understand what you mean, but You can save images in your application documents folder. You can find more details at:
http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/StandardBehaviors/StandardBehaviors.html#//apple_ref/doc/uid/TP40007072-CH4-SW6
You can also use NSFileManager to copy files.
what I suggest to do is :
put default images on project resources.
At first start, copy files to documents folder.
always use images from documents folder.