PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, September 13, 2022

[FIXED] How to get a Kony application's name at runtime

 September 13, 2022     cross-platform, debugging, mobile, temenos-quantum     No comments   

Issue

I'm writing a logger module for a Kony app to print out debugging statements. The Kony SDK already has a kony.print function but I'd like this logger to print out the application's name as a prefix to each statement, to get something like:

FooApp: x is 1
FooApp: a is ["hello", "world"]

The point here is to make it easier for me to filter/find my debug statements in the Xcode or Android Studio logs while debugging.

So I'm aiming to write something like:

var Logger = (function(){

    var prefix = ""; //kony.getAppId()?

    return{
        print: function(message){
            kony.print(`${prefix}: ${message}`);
        }
    };
})();

So the question is whether there is anything like a kony.getAppId() function, a constant or equivalent I can query to get the appropriate value for prefix in order to make the module reusable, rather than hard-code it for every project.


Solution

I've found that there's an appConfig variable built into every Kony app that includes useful information about the application like its name and version. So now I can initialise the prefix variable in my module like this:

var prefix = appConfig.appId || appConfig.appName;

I hope this is useful to others.



Answered By - Mig82
Answer Checked By - Terry (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing