https://github.com/guidosabatini/phonegap-plugins/tree/master/Android/WaitingDialog
I found this Waitling Dialogue Plugin for Phonegap. But i don't know how to use this, i mean where to put the files?
So please help me to solve this issue.
Download and put the WaitingDialog.java inside main package in src.
Then download and include the WaitingDialog.js file in your in the html file. Something like the following:
Then call necessary functions:
// To SHOW a modal waiting dialog
window.plugins.waitingDialog.show("Your dialog text");
// To HIDE the dialog
window.plugins.waitingDialog.hide();
[I haven't tested, but hopefully it will work.]
Alternative Solution:
If you are using jQuery Mobile then another solution can be to use jquery.mobile.utils to show the loader.
Download and include the jquery.mobile.utils.js file in your html file. Then call necessary functions like below:
// Params: jqm theme swatch, and message text
$.mobile.utils.showWaitBox("a", "Hang on while I do work...");
// ... some time later...
$.mobile.utils.hideWaitBox();
[This one is tested and works fine.]
Related
Alright, here goes. I'm dealing with an ionic project. In this specific scenario we're dealing with testing the Android version of the app. I can get images from the file system just fine, they come back in the form of a string url that looks something like this,
content://com.android.providers.media.documents/document/image%3A5744
The processor that is then supposed to blob the file and pass it up the line looks like this:
return this.file.readAsArrayBuffer(urlData.url, urlData.fileName)
.then((item) => {
return new Blob([new Uint8Array(item)]);
})
.catch((err) => {
console.log(err.message)
}).then((res)=>{
return new Blob([res])
})
But then I get the error SECURITY_ERR, which the documentation doesn't really talk about.
This works just fine for the pictures I take with the camera, which all have urls that look like this
file:///storage/emulated/0/Android/data/<appname>/cache/1502211622334.jpg
The issue is, as far as i can find, there is no documentation on what causes this error. I have no idea what to change to make my code work. I have verified the URI is valid, using the checkFile method.
So it turns out you can't use content urls with file.readAsArrayBuffer instead you have to first resolve the url into something readAsArrayBuffer can understand. To do this, i used the ionic native filePath plugin.
Once it was installed and included in the page where I needed it, I used the
filePath.resolveNativePath(url)
method on my url, since this returns a promise, I chained my readAsArrayBuffer onto a then statement prepended to it. I did have to use an if statement to have branching paths for content urls (Which required resolveNativePath) and non-content urls which were already working.
This solution works as far as I can tell.
I have a problem now regarding about the json that can't be read in my android..
the json file is where my data is place..it act as an static database..
I can get it with my Desktop but when it come to my mobile it didn't show..
Here is my sample code:
Here is my Services to get my json file..
var serviceUrl = '/';
$http.get(serviceUrl + 'JSON/Books.json').success(function (results) {
$scope.New = results;
});
Please help me to solve this problem.. my idea about the problem is the serviceUrl. Any idea about it. Thank you so much..
Im definitely a beginner for this Ionic Framework.
To all who still in this problem I just find something that solve it. I don't know if it will solve in your problem but it really solve in me.. I use file:///android_asset/www/ as my serviceUrl
So this is an example:
var serviceUrl = 'file:///android_asset/www/';
$http.get(serviceUrl + 'JSON/Books.json').success(function (results) {
$scope.New = results;
});
Just try it and explore to it.. i just tried that one and it worked in me..
Maybe the reason is the all the json file in your apk installer will be placed in file:///android_asset/www/json directory in android phone so let your url point to that directory..
I hope it will help you and explore in it..that might not be the correct answer but i hope it will help you find the hint.
Thank you
Starting the serviceUrl with a '/' makes it an absolute URL. It will work in chrome since the root is the www folder. But in cordova mobile environment it will translate to file:///.
Simply add a '.' ('./') to make it a relative path and it will work in both android and ios environments.
another easy way is to turn your json file into a javascript file, (for static files if you want to update use something like pouchdb).
eg save the json document as myjsondata.js
var mynamespace = mynamespace || {};
mynamespace.data = [{"foo":"bar"}];
then reference the javascript file in you main page where you load all the other js files
<script src="js/myjsondata.js"></script>
then in your service you can just access the json with mynamespave.data
Based on #Datz Me answer, I've found it's way easier if you treat your application as a web server (which it is) and request your file as being served by it instead of trying to figure out how to manage the different file paths between the several builds.
Here is what I did.
I've placed my json file on
www/json/app.json
Inside it I've put
{
"title": "Application Title",
"icon" : "custom-icon.png"
}
And in my app controller I used the following code to read the properties:
$http.get('json/app.json').success(function (results) {
$rootScope.title = results.title;
$rootScope.icon = results.icon;
});
And in all my child controllers, I just need to add $rootScope as a dependency and I'm able to use
{{title}} //on headings
{{icon}} //to display the image path
<img src="{{icon}}"/> //to display the icon
In my case, it's an app that will be customised for several clients, so I needed a way to quickly change the app's properties and keep them in one place.
I am trying to open email activity and to display in the email's body the following:
Display a hyperlink to a web site.
Display (not attach) an image logo (.png file).
I tried using html/text/image mime type and nothing works for both things.
I even tried to copy the png file to an sdcard and displaying it from sdcard path instead of using the "Assets" location that may be restricted and private only to the application, but it did not help as well!
Can anyone give me a code which works for both things??
Waiting for you help guys!!
Have you tried :
Linkify.addLinks(yourEmailString, Linkify.WEB_URLS);
yourTextView.setMovementMethod(LinkMovementMethod.getInstance());
It will make all links in the message clickable, not sure if this is what you are searching though :)?
I am new to Sencha Touch and Phonegap. I have one html file and one js file. I want to have 3 tabs. In each tab I am putting different Twitter search result. But I don't know when to put my tweet code.
Here is my index.html file: http://pastebin.com/Nv2Jfqr4
Here is my index.js file http://pastebin.com/f9nmycBP
And here is my tweet .html file http://pastebin.com/PPpGiZ3k
You need to take a look at the Kitchen Sink and tell us what kind of user interface component you want to put your twitter search results (probably a list) and then we'll help you achieve what you want.
i have downloaded the phonegap example from its website.but it doesn't run.i can't find the reason.help me to get the solution please.when i run it shows
"The Web page at file:///andriod_asset/www/index.html could not be loaded as:
The requested file was not found.www/index.html"
I tried with three "///" instead of four, it worked for me. Give a try
super.loadUrl("file:///android_asset/www/index.html");
You've spelt android wrong here:
HERE!!!
file://>>>>>>andriod<<<<<<_asset/www/index.html could not be loaded as: The requested file was not found.www/index.html"
Try out:
file:///android_asset/www/index.html could not be loaded as: The requested file was not found.www/index.html"
Best of luck!
Just a quick comment for other's getting to this same problem, who doesn't have the spelling error. My new app using PhoneGap 0.9.4 was giving this same error box. The solution was to rename phonegap.0.9.4.js and phonegap.0.9.4.jar to just phonegap.jar and phonegap.js. After that it loads up.
You and I did the exact same thing -- flipped the i and the o in android.
Change "andriod" to "android" and it should work :)
I was using capitals for the folder WWW which was causing the same error to be thrown. I have now changed it to lowercase which works well now.