0
votes

I need to disable/enable location service on button click (IOS & Android). I am using Worklight V6.2. hope there is solution.

2

2 Answers

1
votes

For Starting The Location Service use the API

WL.Device.StartAcquisition

For Stopping The Location Service use the API

WL.Device.StopAcquisition

More Info Regarding Start and Stop Acquisition services

Note:API are same for IOS/Android/Windows8

0
votes

Follow this excellent Tutorial for using service..

To start and stop the service create 2 buttons in your xml page,and in java

btnShowLocation = (Button) findViewById(R.id.Start);
btnStopLocation = (Button) findViewById(R.id.stop);

btnShowLocation.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View arg0)
            {
               startService(intent);
            }
        }

btnStopLocation.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View arg0)
            {
                 stopService(intent);
            }
         }

But its a very lengthy task..Hope you will get some idea on how to achieve this task.All the best..