How to hide application listing on Android

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
Yana
Posts: 51
Joined: October 6th, 2016, 6:57 am

How to hide application listing on Android

Post by Yana »

Dear cspro team and userforum,
I have two questions
1. I have already developed application with menu, one Listing and other the main questionnaire.
I have edited the PFF file in the editor ShowApplicationListing=Never for Listing and main questionnaire.
After that I copy the file to the device first time it didn't come but after one case completed for listing or main questionnaire it apprease listing and main questionnaire Health_Extension2017 applications so how to hide them?
2. I want to copy the file to the external memory I write the code like this as Josh earlier posted

Function Buckup()
string backupFolder = pathname(CSEntryExternal) + maketext("Backup%d",timestamp());
dircreate(backupFolder);
filecopy(pathname(Application) + "HealthExtension2017.csdb",backupFolder);
End;
When I run this code do nothing. Please comment my app That I attached below.

Best regards
Attachments
Cspro_yana.rar
(1.86 MiB) Downloaded 349 times
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: How to hide application listing on Android

Post by josh »

1. In your menu program you are writing out new versions of the listing and household .pff files each time you run those applications from the menu. In the .pff files that you write out you also have to add ShowApplicationListing=Never. So in your launchHouseholdDataEntry() and launchHouseholdListing() functions you need to add the following logic to add those to the pff file that is being written out.

filewrite(pffFile,"[DataEntryInit]");
filewrite(pffFile,"ShowInApplicationListing=Never");

2. You need to use the correct location of the data file in the call to filecopy. You data file is not in the same directory as the menu application. It is in the Data folder one level up. pathname(Application) + "HealthExtension2017.csdb" is going to look in the same folder as the menu program. You need to go when level back ("..") and then into the Data folder i.e. pathname(Application) + "../Data/HealthExtension2017.csdb". Alternatively since you have the HEALTH_EXTENSION2017_DICT in your menu application already associated with that data file you can simply use: pathname(HEALTH_EXTENSION2017_DICT) which will give you path of the data file associated with that dictionary.

Also you should check the return codes of dircreate and filecopy to make sure it is working. Had you done that you would have gotten an error that the file was not copied:
function Backup()
    
string backupFolder = pathname(CSEntryExternal)+ maketext ("Backup%d",timestamp());
    
if dircreate (backupFolder) = 0 then
        
errmsg("Failed to create directory %s", backupFolder);
    
else
         
string dataFile = pathname(HEALTH_EXTENSION2017_DICT);
         
if filecopy(dataFile, backupFolder) <> 1 then
            
errmsg("Failed to copy file %s to %s", dataFile,  backupFolder);
        
endif;
    
endif;
end;
Yana
Posts: 51
Joined: October 6th, 2016, 6:57 am

Re: How to hide application listing on Android

Post by Yana »

Dear Josh and used forum
I have write out the code as the above logic but still the problem isn't solved. I attached the errors message and the applications.
Attachments
Cspro_yana.zip
(1.88 MiB) Downloaded 378 times
Yana
Posts: 51
Joined: October 6th, 2016, 6:57 am

Re: How to hide application listing on Android

Post by Yana »

The error messages in picture
Attachments
Pop up csentry message after written the hiding code
Pop up csentry message after written the hiding code
1498848289868.png (42.53 KiB) Viewed 7189 times
Back up error message
Back up error message
IMG_20170630_215739_591.jpg (26.26 KiB) Viewed 7189 times
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: How to hide application listing on Android

Post by josh »

Your code has "ShowApplicationListing=Never". My code has "ShowInApplicationListing=Never". See the difference?

If you are getting "invalid path" then your Android device does not have a removable SD card that can be accessed by CSPro. Not all Android devices have removable storage and not all of them are accessible to Android programs. It is up to the manufacturer to make the removable SD cards work with the standard Android APIs but not all of them do. Bottom line is with the device you are using there is not much you can do.
Yana
Posts: 51
Joined: October 6th, 2016, 6:57 am

Re: How to hide application listing on Android

Post by Yana »

Dear Josh
I have rewrite the listing and the household questionnaire like this, the household app already hide in the Android csentry but the listing app couldn't yet. As you explained the code is like this for listing app to hide.
Thanks for your consideration.
// Launch listing program
function launchHouseholdListing()
string pffFilename = pathname(Application) + "../Listing/Listing.pff";
if setfile(pffFile,pffFilename,create) = 0 then
errmsg("Failed to open file %s", pffFilename);
endif;
filewrite(pffFile,"[Run Information]");
filewrite(pffFile,"Version=CSPro 7.0");
filewrite(pffFile,"AppType=Entry");
filewrite(pffFile,"[DataEntryInit]");
filewrite(pffFile, "ShowInApplicationListing=Never");

filewrite(pffFile,"[Files]");
filewrite(pffFile,"Application=" + pathname(Application) + "../Listing/Listing.ent");
filewrite(pffFile,"InputData=" + pathname(Application) + "../Data/Listing.csdb");
filewrite(pffFile,"[ExternalFiles]");
filewrite(pffFile,"ZONE_DICT=" + pathname(Application) + "../Household/Resources/Zone.dat");
filewrite(pffFile,"ZONEPERWEREDA_DICT=" + pathname(Application) +
"../Household/Resources/ZonePerRegione.dat");
filewrite(pffFile,"WEREDA_DICT=" + pathname(Application) +
"../Household/Resources/Wereda.dat");
filewrite(pffFile,"WEREDAPERZONE_DICT=" + pathname(Application) +
"../Household/Resources/WeredaPerZone.dat");
filewrite(pffFile,"KEBELE_DICT=" + pathname(Application) +
"../Household/Resources/Kebele.dat");
filewrite(pffFile,"KEBELEPERWEREDA_DICT=" + pathname(Application) +
"../Household/Resources/KebelePerWereda.dat");
filewrite(pffFile,"ENUMERATIONAREAS_DICTT=" + pathname(Application) +
"../Household/Resources/EnumerationAreas.dat");
filewrite(pffFile,"[UserFiles]");
filewrite(pffFile,"TEMPFILE=%s","");
filewrite(pffFile,"[Parameters]");
filewrite(pffFile,"REGION=%d", STAFF_REGION);
filewrite(pffFile,"ZONE=%d", STAFF_ZONE);
filewrite(pffFile,"WEREDA=%d", STAFF_WEREDA);
filewrite(pffFile,"KEBELE=%d", STAFF_KEBELE);
filewrite(pffFile,"ENUMERATION_AREA=%d", STAFF_ENUMERATION_AREA);
close(pffFile);

execpff(pffFilename, stop);
end;
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: How to hide application listing on Android

Post by Gregory Martin »

Your code seems fine. Is it possible that you have a PFF file from previous testing still in the csentry folder and that that is what is showing?

Try deleting everything from the csentry folder and putting everything back on. Does it still show up?

Is so, send the PFF file to cspro@lists.census.gov.
Post Reply