cancel
Showing results for 
Search instead for 
Did you mean: 

How to Migrate HTML/Javascript files to SUP

Gairik
Participant
0 Kudos

Hi Experts

We have developed many HTML/HTML5/JavaScript applications with third party tool. We want to make them hybrid application in SUP . These HTML files are generating the data from their own , so no backend access ( or MBO ) is required to start with . What's the best possible way to migrate existing HTML applications to SUP . I didn't find any documentation on the same in the sybase website or here in SCN. Any help will be appreciated .

Regards

Gairik

Accepted Solutions (1)

Accepted Solutions (1)

david_brandow
Contributor
0 Kudos

In addition to the online documentation describing how to create hybrid app packages manually or using the packaging tool,

http://infocenter.sybase.com/help/index.jsp;jsessionid=17v6co4261s3s?docset=/com.sybase.infocenter.p...

, the following sample should help describe the use of the packaging tool:

https://cw.sdn.sap.com/cw/docs/DOC-152841

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Gairik,

It depends which framework you are using. PhoneGap is the most popular and reliable framework.

Refer following blog link

For accessing SUP through Javascript in PhoneGap application we need to use the following steps.

  • Create a class with methods you want to use:

    public class MyClass

    {

        public String getMessage(){

          return "Hello Java";

        }

    }

  • In your main activity add a Javascript interface for this class:

    public class Main extends DroidGap

    {

        private MyClass mc;

        @Override public void onCreate(Bundle savedInstanceState)

        {

          super.onCreate(savedInstanceState);

          super.init(); 

          mc = new MyClass(this, appView);

          appView.addJavascriptInterface(mc, "MyCls"); 

          super.loadUrl(getString(R.string.url));

        }

    }

  • In Javascript call window.MyCls methods:

    <script>

        $(function(){

          $("#phone").text("Message from native class: " + window.MyCls.getMessage());

        });

    </script>

MyClass is the java class where you are going to write the code for an MBO. It works like Model for your application.

Hope this helps you.

- Regards

ShashanK MarathE

Gairik
Participant
0 Kudos

Thanks Shashank for your reply . However, what I was looking for is to migrate my existing HTML applications ( developed using any third party tool, e,g., phonegap or may be simply in notepad ) to SUP as a hybrid application . David's response actually helped me to package my html application as a SUP based hybrid application . Regarding the data access , yes it is possible to access MBO after generating javascript MBO access API . So, I'm marking David's answer as the correct answer. However, thanks for your response to use phonegap . I will try it out soon.