Blackberry Widget: Where is the www folder on the device? - blackberry

Where do the files I put in the "www" directory before building a Blackberry widget end up on the device?
Background: I would like to read the content of some of the files (e.g. "www/index.html") from the www directory in the native Java part of the widget. (I already used FileConnection.list to write the name of all files on the device to System.out - neither index.html nor any other file from the www directory was part of the list.)
The widget is based on PhoneGap 0.9.4 for Blackberry but that shouldn't make a difference.

Found the answer: The files are packaged as resources. Therefore it's possible to read them with Class.getResourceAsStream.
Example:
getClass().getResourceAsStream("/index.html");

Related

native script: WebView Interface plugin unable to find local resource

I am using webViewInterface plugin in nativescript 8 with webpack v5 I am trying to launch local downloaded file ex. video, audio, HTML files
I am able to download those files but while running that file with the help of webview I am getting
file not found
chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: Cannot read property '_onNativeEvent' of undefined", source: chrome-error://chromewebdata/
In NativeScript, by default, the tilde (~) marks the app root folder (note the App and not the Project!). So if my file is located in <project-name>/app/index.html then I need to set a path like this ~/index.html.
this was working fine with natviescript v6 but after upgrading to nativescript v8 it broke.
can anyone please help???
The app folder is read-only on iOS (at least, on real devices, not necessarily on emulators). You'll need to download the files to either the temp or documents folder and then access from there.
As a reference, see my own struggle with this issue.
OK i have what seems to be the same issue. In my case when i migrated from nativescript 7 to 8 the webpack.config.ts was cleaned up.
In there was something useful that copied all my webview files.
I added some code to my webpack.config.js and now it seems to work
"src" is the folder containing my webview folder.
const webpack = require("#nativescript/webpack");
module.exports = (env) => {
webpack.init(env);
webpack.Utils.addCopyRule({
from: 'webviews/**',
context : 'src'
})
return webpack.resolveConfig();
};
The doc I used.
NS 8 : https://docs.nativescript.org/webpack.html#adding-a-copy-rule
Previous plugin used : https://webpack.js.org/plugins/copy-webpack-plugin/

ionic app assets gone after deploying [duplicate]

I have the following brand new project, created with:
$ ionic start MyIonic2Project sidemenu --v2
My question is very simple:
where do I locate a directory for application images (asset images / fixed images / icons / etc)?, inside: {resources, src, www, etc}?. I'm looking for best practices.
how the url of these images would look like?. I wanna specify the <img src="<url/to/image.jpg>" /> element within the file: src/pages/home/home.ts.
src/assets/ folder should contain all the resources. You can use any sub-folder depending on type of resource. During the build process everything in the src/assets is copied to www/assets.
how the url of these images would look like?
You have to give the path relative to your current file when it would be in www folder.
It is generally ../assets/../filename if you are setting in your scss file.(This would end up as part of main.css within build folder).
and ./assets/../filename in your html file.

How to deploy arbitrary resources for React Native with CodePush

I'm using CodePush to deploy the js bundle and a couple of resources to my react-native iOS app. Instead of using the react-native bundler to collect all the static images from my project I have a build step that just copies a folder called "static" into release/assets. But beside the "static" folder I als have other folders in release/assets that contain images and videos wich are use dynamically in the app via uri (e.g. { uri: 'assets/images/myImage.jpg' }). When building the app in XCode I just include the assets folder in the package.
From the CodePush documentation I gather that deploying the release folder should update all my assets. But it doesn't.
I downloaded the xcappdata via XCode and there you can see, that CodePush downloaded everything and stored it in /Library/Application Support/CodePush/[id]/release. But it still doesn't show up in the app.
Any ideas? Do I misunderstand the functionality of CodePush?
As you've seen, when you release a directory to the CodePush server via the CLI, it will round trip the entire contents of it to end-user's devices when they perform an update check/synchronization. That said, just because a file is in that update doesn't mean it will be useable unfortunately.
The behavior that you're seeing is actually a limitation of the way that the Image component resolves URIs in React Native. If you use the assets system to specify the "source" property (via a require("image.png") call), it will look for that file relative to the currently running JS bundle. This is how CodePush allows updating images, because as long as our plugin places the "assets" folder next to the JS bundle file on disk, the <Image> component will naturally find them.
However, when you specify an object with a URI (as you're doing) as the value of the "source" property, the Image component looks for that file relative to the binary on disk, and therefore, it will never look for it where it was placed by CodePush when you update them.
Because of this, CodePush only supports updating images which are loading via the require syntax. I'll make sure to update our docs to clarify that. Apologies for the confusion!

Bug in MonoTouch/MonoDevelop or something else?

I load up a few XML files with my app in Mono when deploying to iPhone. I edited one of those XML files in Windows through a LAN connection to the Mac on which the file resided. After editing the xml file the app seems to refuse the xml file exists anymore. THe properties are still 'copy always' and 'content' where relevant for the XML file, I know it exists and I can even open and edit it MonoDevelop. But in app isolatedstorage.fileexists("filename.xmL") ALWAYS returns false.
I deleted the file and daded it back in, I copy+pasted the file, heck, I even renamed another xml file to the same filename and that xml file stopped being recognized.
Not sure what to do now?
Did you try "File.Exists" ?
Keep in mind that IsolatedStorage's main goal is to isolate the files from outside (the application) usages. As such MonoDevelop will copy to the application folder, but not in the isolated storage. Same is true for desktop applications, MonoMac apps...
FWIW IsolatedStorage API exists in MonoTouch to help you port existing code (from the 'desktop' framework or WP7) but there's no reason (beside portability) to use it. In iOS applications are already isolated (from each other) and so are their files.

test a webworks blackberry app

I have four files (config.xml, index.html, scripts.js, and styles.css). The html has a canvas and a form for users input. I want to run on blackberry simulator (Torch version 6...). I create a zip file of all those files. Then create a bin folder. Now when I run the simulator and load the application, I have either blanc screen, either the following error: Resource does not exist.
Here is the config file code:
BlackberryTest
I had the same problem. You need to use local:/// prefix before the name of the local resource to access it.

Resources