EHS. How to reload the config XML file?

Hi. I have a customer who wants to modify the Wallpaper or the Title shown by EHS v1.6 on the fly by his business application. I was searching for an intent to do that but it seems to be not possible except rebooting the device.

Is it possible to have an intent to update the title with a custom string (maybe the IP address) or the wallpaper? Or even to reload the whole XML without restarting?

 

Thanks!

Anonymous (not verified)
After programmatically

After programmatically modifying enterprisehomescreen.xml, try calling the "home" screen intent. This should force EHS to reread it's config xml.

Intent startMain = new Intent(Intent.ACTION_MAIN);

startMain.addCategory(Intent.CATEGORY_HOME);

startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

startActivity(startMain);

You could also copy a file that exists in the devices file system to enterprisehomescreen.xml, then call the homescreen intent.

Add this to a method, or button call back:

        InputStream in = null;

        OutputStream out = null;

        try {

            //in = assetManager.open(filename);

           in = new FileInputStream("/enterprise/usr/enterprisehomescreen_new.xml");

            out = new FileOutputStream("/enterprise/usr/enterprisehomescreen.xml");

            copyFile(in, out);

            in.close();

            in = null;

            out.flush();

            out.close();

            out = null;

            Intent startMain = new Intent(Intent.ACTION_MAIN);

            startMain.addCategory(Intent.CATEGORY_HOME);

            startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

            startActivity(startMain);

        } catch (Exception e) {

            Log.d(this.getPackageName().toString(), e.getMessage());

        }

Add this method in your class:

private void copyFile(InputStream in, OutputStream out) throws IOException {

        byte[] buffer = new byte[1024];

        int read;

        while ((read = in.read(buffer)) != -1) {

            out.write(buffer, 0, read);

        }

    }

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments