12/25/2009, 02:04 AM
|
#1 (permalink) |
|
Member
![]() ![]() Join Date: Aug 2009
Posts: 141
Likes Received: 1
Thanks: 10
Thanked 16 Times in 11 Posts
|
Hi all,
My app have many pictures and to decrease the size of the ipk file i want to split it in 2 parts: The #1 part will be the code installed on /var/usr/applications (as palm-package do it) The #2 part will be all pictures installed on /media/internal/myapp To test if this structure works in my app, i create manually the folder myapp connecting my Pre in USB mode and put all pictures in it. It works fine, pictures are correctly displayed. This solution is efficient because the space available for apps on a Pre is very limited. My question is, how to create an ipk that creates automatically the folder myapp under /media/internal during the install process ? Or is there a way to do it without the user creates manually this folder ? The goal is to provide to user an easy solution to install my app. Thanks for your advices ?
__________________
_________________________________________________________ Ze-Palm is ZE #1 innovative software solutions for PalmOS and Palm webOS. _________________________________________________________[/COLOR] |
12/25/2009, 06:14 AM
|
#2 (permalink) | |
|
Developer
![]() ![]() Join Date: Apr 2003
Location: Adelaide, Australia - follow @webosinternals on Twitter visit www.webos-internals.org and www.facebook.com/webosinternals
Posts: 10,220
Likes Received: 546
Thanks: 90
Thanked 8,534 Times in 2,806 Posts
|
Quote:
-- Rod
__________________
WebOS Internals and Preware Founder and Developer You may wish to donate by Paypal to donations @ webos-internals.org if you find our work useful. All donations go back into development. www.webos-internals.org twitter.com/webosinternals facebook.com/webosinternals |
|
12/25/2009, 07:46 AM
|
#3 (permalink) |
|
Legend
![]() Join Date: May 2005
Location: Winnipeg, MB, Canada
Posts: 3,883
Likes Received: 496
Thanks: 801
Thanked 12,956 Times in 1,495 Posts
|
keep in mind advanced homebrew apps won't be allowed in the AppCatalog, so it might just be best to either:
- included the imaged in the ipk with the app files and wait for the alleged end of app limit, rumoured on 1.3.5 - host the images on a web server and hotlink or download them as needed. also, keep in mind images in /media/internal/ will be indexed into the photos app, and filepicker widhet |
12/25/2009, 11:25 AM
|
#4 (permalink) |
|
Member
![]() ![]() Join Date: Aug 2009
Posts: 141
Likes Received: 1
Thanks: 10
Thanked 16 Times in 11 Posts
|
Thanks Jason and rwhitby for your replies.
I read many posts (many of them are written by you) to learn myself about how it works and how to create an ipkg. ipkg seems to be the solution in my case but it needs some advanced knowledge and it's not without risks ! The other solution as Jason said is to include all images in the ipk. The version i provide to user is actually packed with this principle. The problem is that the ipk size is 25 Mo and when i sync it via WebOSQi the transfer seems correct (no errors) but there is nothing on my Pre !! If i root my Pre using WinSCP there is no folder corersponding to my app in /var/usr/palm/applications. If i root my Pre using WinSCP and if i create a folder then copy all subfolders and files corresponding to my app, all is fine. I'm able to run my app on my Pre. I conclude that there is a size limit for an app synched, maybe 10 Mo or something like that. As you are WebOS guru, what are your advices about this behaviour ? Have you encounter this kind of problems and have you solution ? Thanks for your help.
__________________
_________________________________________________________ Ze-Palm is ZE #1 innovative software solutions for PalmOS and Palm webOS. _________________________________________________________[/COLOR] |
12/25/2009, 12:44 PM
|
#5 (permalink) |
|
Developer
![]() ![]() Join Date: Apr 2003
Location: Adelaide, Australia - follow @webosinternals on Twitter visit www.webos-internals.org and www.facebook.com/webosinternals
Posts: 10,220
Likes Received: 546
Thanks: 90
Thanked 8,534 Times in 2,806 Posts
|
What risks are you referring to?
-- Rod |
12/25/2009, 05:05 PM
|
#6 (permalink) |
|
Member
![]() ![]() Join Date: Jun 2009
Location: topeka, ks
Posts: 550
Likes Received: 0
Thanks: 4
Thanked 188 Times in 90 Posts
|
let's try it a different way:
You have three choices: 1) You can write this as a "homebrew only" app, which will require a "post install" script to be run to move the picture files to /media/internal/myapp If you do that, you will not ever be able to submit it to the app catalog. Additionally, if you do that, your app's pictures will be visible in the photo viewer app, which displays every picture in /media/internal 2) you can just put the pictures in the normal place. For the app catalog, the app has a limit of 5 meg for the IPK. 3) you can download the photos AFTER you install the app. This works, and avoids the app catalog problems above, and after all, you can't INSTALL the app without downloading it, so your user HAD to have a net connection anyway. Just download the pictures using the download service on first use. |
12/26/2009, 12:55 AM
|
#7 (permalink) | ||
|
Member
![]() ![]() Join Date: Aug 2009
Posts: 141
Likes Received: 1
Thanks: 10
Thanked 16 Times in 11 Posts
|
Thanks all for your replies.
Quote:
rboatright, your 3 choices are very explicit. I confirm that Quote:
Your choice 2, my app is yet in the App Catalog !!.The limit is up to 200 Mo Your choice 3 is interesting. If i well understand, it requires a "post-install" script I hope that Palm fix it in the next WebOS version as Jason Robitaille said. So, a "post install" script could be the solution. To create this "post install" script, what are the command lines to write in this script and what is the method to create a ipkg file ? Thanks for your help.
__________________
_________________________________________________________ Ze-Palm is ZE #1 innovative software solutions for PalmOS and Palm webOS. _________________________________________________________[/COLOR] |
||
12/26/2009, 01:12 AM
|
#8 (permalink) |
|
Member
![]() ![]() Join Date: Aug 2009
Posts: 141
Likes Received: 1
Thanks: 10
Thanked 16 Times in 11 Posts
|
If I analyze my problem, it may be due to 2 reasons:
- Synchronization via WOSQI fails because it does not accept applications size exceeding a certain limit. - Either the sync is correct but the internal process of installing the ipk on the Palm fails How can i do to identify what is the real reason ? Is there any analysis tools ? if you are interested, i can provide you this large ipk. Thanks for your advices.
__________________
_________________________________________________________ Ze-Palm is ZE #1 innovative software solutions for PalmOS and Palm webOS. _________________________________________________________[/COLOR] |
12/26/2009, 11:20 AM
|
#9 (permalink) |
|
Member
![]() ![]() Join Date: Jun 2009
Location: topeka, ks
Posts: 550
Likes Received: 0
Thanks: 4
Thanked 188 Times in 90 Posts
|
you mis-understood me on option 3.
You can use the webOS download service to have YOUR APP download your pictures on first use. No post-install required. As Jason said, Palm has announced that with the release of 1.3.5, the space problem for apps will be going away. We are not at liberty to discuss the details of that yet under NDA. Sorry. |
12/26/2009, 12:14 PM
|
#10 (permalink) |
|
Developer
![]() ![]() Join Date: Jul 2009
Posts: 1,400
Likes Received: 3
Thanks: 17
Thanked 1,540 Times in 376 Posts
|
Just wanted to note that you can hide images from photo viewer by prefixing them with . or putting them in a directory prefixed by .
For example Virtual Keyboard images are stored at /media/internal/virtual-keyboard/.themes/
__________________
-Eric G WebOS Internals Developer. Follow me on Twitter for updates to my projects: | Virtual Keyboard | wIRC | SuperTux | AUPT | KeyBoss | freeTether | Donate |
12/27/2009, 12:53 AM
|
#11 (permalink) | |
|
Member
![]() ![]() Join Date: Jun 2009
Location: topeka, ks
Posts: 550
Likes Received: 0
Thanks: 4
Thanked 188 Times in 90 Posts
|
Quote:
|
|
12/27/2009, 02:40 AM
|
#12 (permalink) |
|
Member
![]() ![]() Join Date: Aug 2009
Posts: 141
Likes Received: 1
Thanks: 10
Thanked 16 Times in 11 Posts
|
Sorry for my misunderstanding rboatright ( i mixed the different options )
So, your advice to check if picts are downloaded in the first use using the DL service is the right solution. Thank you emoney_33 for your tip, it works fine. I give a try to code the webOS DL Service but it not works ! The approach i used is to check if a pict exists on the folder /media/internal/.mydir and if not the DL service download it from my server (ht*p://www.url.com/) and copy the pict on /media/internal/.mydir. Here is the code : First assistant is the first scene of my app Code:
//--- If pict Exists on /media/internal/.mydir
FirstAssistant.prototype.PictExist = function(){
......;
};
//--- If pict NOT Exists on /media/internal/.mydir
FirstAssistant.prototype.PictNotExist = function(){
this.controller.serviceRequest('palm://com.palm.downloadmanager/', {
method: 'download',
parameters: {
target: "http://www.url.com/",
"mime" : "img",
"targetDir" : "/media/internal/.mydir/",
"targetFilename" : "Pict1.png",
keepFilenameOnRedirect: false,
subscribe: true
},
onSuccess : function (resp){
Mojo.Log.info(resp.ticket)
},
onFailure : function (e){
Mojo.Log.info(Object.toJSON(e))
}
});
};
FirstAssistant.prototype.activate = function(event) {
//--- Test if a pict exists
var existpict = '/media/internal/.mydir/Pict1.png';
var request = new Ajax.Request(existpict, {
method: "get",
onSuccess: this.PictExist.bind(this),
onFailure: this.PictNotExist.bind(this)
});
}
So, my questions are : - Where i'm wrong in my code ? - How can i download all files that are in a folder and subfolder instead of download individually each file ? My app has more than 200 images !! The structure of all my picts are : images (folder) ...pict1 (file) ...pict2 (file) images/Database (Database is a subfolder of the folder images) ...........pict3 (file) ...........pict4 (file) Thanks for your suggestions.
__________________
_________________________________________________________ Ze-Palm is ZE #1 innovative software solutions for PalmOS and Palm webOS. _________________________________________________________[/COLOR] Last edited by Ze-Palm; 12/27/2009 at 11:23 AM. Reason: link in code |
12/27/2009, 11:21 AM
|
#13 (permalink) |
|
Member
![]() ![]() Join Date: Aug 2009
Posts: 141
Likes Received: 1
Thanks: 10
Thanked 16 Times in 11 Posts
|
After many hours
I fix the error in my code and i can download a file !! (thanks to PreCentral forum and Palm webOS forum to find the solution)Here is the code : Code:
new Mojo.Service.Request('palm://com.palm.downloadmanager/', {
method: 'download',
parameters: {
target: url + "Pict1.png",
"mime": "img",
"targetDir": "/media/internal/.mydir/",
"targetFilename": "Pict1.png",
subscribe: true
},
onSuccess: function(resp){
if (resp.completed == true) {
Mojo.Log.info('RESPONSE Success: ' + Object.toJSON(resp));
}
},
onFailure: function(e){
Mojo.Log.info("Failure download.")
}
})
Thanks for your help.
__________________
_________________________________________________________ Ze-Palm is ZE #1 innovative software solutions for PalmOS and Palm webOS. _________________________________________________________[/COLOR] Last edited by Ze-Palm; 12/27/2009 at 11:29 AM. |
12/28/2009, 05:29 AM
|
#14 (permalink) |
|
Member
![]() ![]() Join Date: Aug 2009
Posts: 141
Likes Received: 1
Thanks: 10
Thanked 16 Times in 11 Posts
|
up !
Anybody try to download a list of files ?
__________________
_________________________________________________________ Ze-Palm is ZE #1 innovative software solutions for PalmOS and Palm webOS. _________________________________________________________[/COLOR] |
01/02/2010, 12:25 PM
|
#15 (permalink) |
|
Member
![]() ![]() Join Date: Aug 2009
Posts: 141
Likes Received: 1
Thanks: 10
Thanked 16 Times in 11 Posts
|
Up again !!
I repeat my question: Is there a way to download all files which are in a folder stored on a server ? .
__________________
_________________________________________________________ Ze-Palm is ZE #1 innovative software solutions for PalmOS and Palm webOS. _________________________________________________________[/COLOR] |
01/02/2010, 03:15 PM
|
#16 (permalink) |
|
Member
![]() Join Date: Jun 2009
Posts: 106
Likes Received: 0
Thanks: 66
Thanked 24 Times in 15 Posts
|
I guess one way to do this would be to create a small script on the server that hands the pre a list of files to download, and then looping through the list using the downloadmanager service. I haven't tried it, but I'm fairly positive that it should work.
|
01/03/2010, 05:38 AM
|
#17 (permalink) |
|
Member
![]() ![]() Join Date: Aug 2009
Posts: 141
Likes Received: 1
Thanks: 10
Thanked 16 Times in 11 Posts
|
I tought to apply this principle to parse the list of files to be downloaded.
I create a json file which contains all the files then load and loop it but it not works. My problem is to read each element with the array (i) during the loop. here is the json file: Code:
{
"File1": "filename1",
"File2": "filename2",
"File3": "filename3",
"File4": "filename4"
}
Code:
InitAssistant.prototype.OnSuccess = function(transport) {
var r = transport.responseJSON;
for (i = 1; i < 5; i++)
{
this.filename=r.File+(i);
this.controller.get('filename').innerHTML = this.filename;
...... here is the Download Service manager code .......
}
}
How to set correctly each element during the loop ? When i=1 Then this.filename must be r.File1 When i=2 Then this.filename must be r.File2 ..... If there is another more efficient way to do it, i'm interested in Thanks for your help.
__________________
_________________________________________________________ Ze-Palm is ZE #1 innovative software solutions for PalmOS and Palm webOS. _________________________________________________________[/COLOR] |
01/03/2010, 07:53 AM
|
#18 (permalink) | |
|
Legend
![]() Join Date: May 2005
Location: Winnipeg, MB, Canada
Posts: 3,883
Likes Received: 496
Thanks: 801
Thanked 12,956 Times in 1,495 Posts
|
Quote:
__________________
If you've liked my software, please consider to towards future development.Developer of many apps such as: WebOS Quick Install, WebOS Theme Builder, Ipk Packager, Unified Diff Creator, Internalz Pro, ComicShelf HD, LED Torch, over 70 patches and more. @JayCanuck @CanuckCoding Facebook |
|
01/04/2010, 12:00 PM
|
#19 (permalink) |
|
Member
![]() ![]() Join Date: Aug 2009
Posts: 141
Likes Received: 1
Thanks: 10
Thanked 16 Times in 11 Posts
|
Thanks Jason Robitaille for your advices.
I fixed it using array and looping the list using the downloadmanager service. Here is the json file. This list contains 50 filenames Code:
{
List: [
{File: "filename1"},
{File: "filename2"},
{File: "filename3"},
{File: "filename4"},
{File: "filename5"},
{File: ".............."},
{File: "filename50"}
]
}
The number of files to download is 200 because each file has 4 different extension. So in my code i must perform 4 "Download Manager Service" in order to download each type of extension. Code:
InitAssistant.prototype.ReadSuccess = function(transport){
var r = transport.responseJSON;
var state = [];
var url1 = "http://www.mysite.com/myappdir/";
var targetdir = "/media/internal/.myappdir/";
for (i = 0; i < 50; i++) {
Type1[i] = r.List[i].File;
Type2[i] = r.List[i].File;
Type3[i] = r.List[i].File;
Type4[i] = r.List[i].File;
this.extension1 = Type1[i];
this.extension2 = Type2[i];
this.extension3 = Type3[i];
this.extension4 = Type4[i];
//--- Download file with extension1
try {
new Mojo.Service.Request('palm://com.palm.downloadmanager/', {
method: 'download',
parameters: {
target: url1 + this.extension1 + ".ext1",
targetDir: targetdir,
targetFilename: this.extension1 + ".ext1",
subscribe: true
},
onSuccess: function(response){
if (response.completed) {
$('filename').update('Extension1 downloaded.');
}
},
onFailure: function(error){}
})
}
catch (error) {}
//--- Download files with extension2
try {
new Mojo.Service.Request('palm://com.palm.downloadmanager/', {
method: 'download',
parameters: {
target: url1 + this.extension + ".ext2",
targetDir: targetdir,
targetFilename: this.extension2 + ".ext2",
subscribe: true
},
onSuccess: function(resp){
if (resp.completed) {
$('filename').update('Extension2 downloaded.');
}
},
onFailure: function(error){}
})
}
catch (error) {}
//--- Download files with extension3
....................................
...........................
//--- Download files with extension4
.........................................
onSuccess: function(respdata){
if (respdata.completed){
Mojo.Controller.stageController.pushScene("First");
}
}
I check it connecting the emulator using WinSCP. There are only 120 or 150 files ! It depends. It seems that the "First" scene is pushed when one of the 4 DM service block is completed. I try different syntax to force to finish properly each DM service block but the result is not correct. All files are not downloaded. How can i do to download correctly all the files ? Is there something wrong in my code or do I use specific syntax ? Thanks for your help.
__________________
_________________________________________________________ Ze-Palm is ZE #1 innovative software solutions for PalmOS and Palm webOS. _________________________________________________________[/COLOR] |
01/04/2010, 01:21 PM
|
#20 (permalink) |
|
Member
![]() Join Date: Jun 2009
Posts: 106
Likes Received: 0
Thanks: 66
Thanked 24 Times in 15 Posts
|
I would remove the try {} catch {} code blocks so that any errors in the code is printed out and not ignored. Also, you should use Mojo.log to print errors in the system log, which you can view by running "tail -f /var/log/messages" on the emulator.
|
![]() |
|
| Tags |
| folder, internal, ipk |
| Thread Tools | |
| Display Modes | |
|
|



