Display version on screen from config.xml in Ionic2 - ionic2

We are developing an app which has a screen named "About Us" where we want to display the app's version number which is same as in config.xml file.
<widget id="com.myApp.MyAppName" version="2.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
Is there any way to copy the version no from the mentioned xml file to my screen's ts file or vice-versa?

Check this plugin out: http://ionicframework.com/docs/native/app-version/
Github link : https://github.com/whiteoctober/cordova-plugin-app-version
Let me know if this work out for you. Can help with specifics if needed.

Related

Save a downloaded file to storage folder on android

I've made an app that sends a file from my pc to my phone but I can't figure out how to save it to Internal storage or to a folder I can access. Can someone please help?
Looks like you need to use the FileSystem API. According to the documentation here, you need to first install it:
expo install expo-file-system
And of course, import it where needed:
import * as FileSystem from 'expo-file-system';
After which you should be able to use the method FileSystem.writeAsStringAsync and save the file to the FileSystem.documentDirectory:
FileSystem.writeAsStringAsync(
FileSystem.documentDirectory + 'filename.ext',
"some file contents or variable");
Look around the documentation about FileSystem - there are many useful methods and some examples that should help you.

Dynamic image path in Ionic 2 doesn't work on device

I'm using Ionic 2.2 and normally I reference the pictures like this:
<img src="assets/images/img.svg" />
Which works fine in both browser and device.
But our app uses themes, and I need to change the image folder based on which theme the user selects.
In my html:
<img src="{{getImagePath('image1.svg')}}">
In typescript file:
getImagePath(img){
if(this.theme == 'special'){
return 'assets/images/special/' + img;
} else {
return 'assets/images/' + img;
}
}
This works in browser but, not in device.
What is the correct way to do this?
I also tried [src]="getImagePath('image1.svg')" which had the same result. And tried to play with the path like ../assets and couple other variation but couldn't find the right way.
Turns out that reinstalling the platform and plugins solved my issue.
The code in the question is correct and now working on android device.

Unable to get a custom helpfile to work from inside a Qt Application using Qt Assistant

I am trying to learn how to use Qt Assistant for displaying a custom help in an application.
I found an example on Qt site:
http://qt-project.org/doc/qt-4.7/help-simpletextviewer.html
(using Qt 4.7.3)
All the source files needed are at the site above. I created html and png files and placed them in a "help" folder inside the project folder.
Running Qt Assistant from command line works great.
Loading the help file in the Assistant also works. What I can't get to do is to load the start page in the help file, as explained in this section:
http://qt-project.org/doc/qt-4.7/assistant-custom-help-viewer.html#id-0c628592-dd04-4465-94b1-e5d4a91d7cd4
void Assistant::showDocumentation(const QString &page)
{
if (!startAssistant())
return;
QByteArray ba("SetSource ");
ba.append("qthelp://com.trolltech.examples.simpletextviewer/doc/");
proc->write(ba + page.toLocal8Bit() + '\n');
}
With the detailed explanation of SetSource showing
setSource <Url> Displays the given <Url>. The URL can be absolute or relative
to the currently displayed page. If the URL is absolute, it has to be
a valid Qt help system URL; i.e., starting with "qthelp://".
I don't have a web page... but i tried to display the index from the local set of files, and i always get
a 404 error saying "cannot load page blahblah/help/index.html"
How can I create a local path as they say, or how can I create a "valid Qt help system URL" ?``
Note: SetSource and setSource have exactly the same results... and documentation and their own examples use them both... are these options not case sensitive ?
I answered my own question with a solution that doesn't seem right though... I would appreciate a better answer.
There must be something wrong with either my solution or the documentation...
I was able to get the page to display by changing an option...
replace QByteArray ba("SetSource ");
with QByteArray ba("Set Source ");

Getting an incorrect permissions screen in the webview Blackberry 10 Cascades Beta 3 SDK in Dev Alpha Simulator

I am trying to make dynamically generated html 5 graphs show up in a webview in Blackberry 10 Cascades. I have confirmed the html5 that I have generated, draws the correct graphs. My problem is that when I try to implement this in the Blackberry 10 Cascades Beta 3 SDK (using the Blackberry 10 Dev Alpha Simulator), the webview that is supposed to show the graph, just looks like this:
Here is the code that leads to this error:
//html_ already contains the html-5 code to make the graph at this point in the code
//This is the file path to a local file that is actually accessable in the emulator
//and not just from Windows
//
QFile *chartFile = new QFile("app/native/assets/data/chart.html");
if (chartFile->open(QIODevice::WriteOnly)) {
chartFile->write(html_.toUtf8());
chartFile->flush();
chartFile->close();
}
if (chartFile) delete chartFile;
if (graphView_) {
graphView_->setHtml("");
graphView_->setUrl(QUrl::fromLocalFile("app/native/assets/data/chart.html"));
}
I checked the permissions of that file, put they are all Allow (777 permissions for those who know Unix style permissions).
I added access_internet to the bar-descriptor.xml, eventhough my app was already able to access remote sites, just to see if that would fix it, but it did not.
I've been searching around trying to find a solution to this problem, but I have not.
If anyone could help me out with this, it would be greatly appreciated.
-------------------------------------------------------
Update:
I changed the code to set the html directly, now I have this:
if (graphView_) {
graphView_->setHtml(html_, QUrl("app/native/assets/data/chart.html"));
}
But nothing shows. It seems I have the wrong relative path relative to my base url.
My base url is this: QUrl("app/native/assets/data/chart.html")
My relative paths all begin with: ./Highcharts/js/...
My relative paths are located under: app/native/assets/data/Highcharts/js
It seems to me that I this should work, but when I do this, I just a blank screen, as if it can not find my relative paths. So I don't know what's going on here either.
I found a solution that works. I'm using the first approach, not the updated approach, but instead of
graphView_->setUrl(QUrl("app/native/assets/data/chart.html"));
I'm using:
graphView_->setUrl(QUrl("local:///assets/data/chart.html"));
And I have left the rest of the code the same, and it works.

Joomla(1.5) templates wont appear on the interface when i add add the folder in the /teplates directory

I tried installing via the interface but it said that the package i waas trying to install wasnt found.
I also tried puting the extracted folder in the templates/ folder but still nothing.
I tried reinstalling Joomla all over again but with no luck.
I am suspecting that the problem has something to do with mysql but i cannot confirm that...
Note that the server is running on my laptop
thank you
The custom template you are setting up requires a correct .xml file. and also the correct naming. you can always copy the xml file from an existing template and update it with your template name. update the files and folders that are included.
Here is a basic xml file i use and update all the data in to (name is templateDetails.xml and make sure you have the cap D and all the rest in lowercase) Other than the xml file the rest isnt required. you could have nothing but the xml file and you should still see it in the joomla template interface.
<?xml version="1.0" encoding="utf-8"?>
<install version="1.5" type="template">
<name>GDW Template</name>
<creationDate>Juin 2010</creationDate>
<author>Geant du Web</author>
<copyright>Geant du Web</copyright>
<authorEmail>info#geantduweb.ca</authorEmail>
<authorUrl>www.geantduweb.ca</authorUrl>
<version>1.2</version>
<description>Ne pas copier sans autorisation ecrite du Geant du Web</description>
<files>
<filename>component.php</filename>
<filename>favicon.ico</filename>
<filename>index.html</filename>
<filename>index.php</filename>
<filename>templatetools_1.5.php</filename>
<filename>vars_1.5.php</filename>
<filename>params.ini</filename>
<filename>template_thumbnail.png</filename>
<folder>html</folder>
<folder>images</folder>
<folder>css</folder>
<folder>js</folder>
</files>
<languages>
</languages>
<administration>
<languages>
</languages>
</administration>
<positions>
<position>breadcrumbs</position>
<position>banner</position>
<position>left</position>
<position>right</position>
<position>top</position>
<position>bottom</position>
<position>slideshow</position>
<position>language</position>
<position>topmenu</position>
<position>mc-right</position>
<position>mc-left</position>
<position>o-comp</position>
<position>u-comp</position>
<position>footer</position>
<position>footm</position>
<position>user1</position>
<position>user2</position>
<position>user3</position>
<position>user4</position>
<position>user5</position>
<position>user6</position>
<position>user7</position>
<position>user8</position>
<position>user9</position>
</positions>
</install>