Page 1 of 1

How to hide application listing on Android

Posted: June 29th, 2017, 7:22 am
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

Re: How to hide application listing on Android

Posted: June 29th, 2017, 10:52 am
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;

Re: How to hide application listing on Android

Posted: June 30th, 2017, 3:16 pm
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.

Re: How to hide application listing on Android

Posted: June 30th, 2017, 3:18 pm
by Yana
The error messages in picture

Re: How to hide application listing on Android

Posted: June 30th, 2017, 5:37 pm
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.

Re: How to hide application listing on Android

Posted: July 2nd, 2017, 3:35 pm
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;

Re: How to hide application listing on Android

Posted: July 4th, 2017, 11:26 am
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.