cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to perform operation in android+sup app when the device is offline ?

midhun_vp
Active Contributor
0 Kudos

Hi,

I developed one android app using sup 2.1.3 . I tried to do an operation from the device by making the device offline.

Then I got an error on mobilink. I heard like operations can be done even the app is offline and once the app comes online

it will be synced.

Following is the operation code :

  header = new Header();

                                        header.approveOperation(ponumber,relCode);

                                        header.submitPending();

  ApprovalDB.synchronize();

                                        header.save();

Is it possible to do operation or we need to check whether internet is available before operation to restrict it ?

Regards,

Midhun

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Yes.. You can do the operation as well offline.. But

ApprovalDB.synchronize(); requires the device to be online..

That means, ApprovalDB.synchronize(); it actually connects to the network and synchronizes with the CDB..

So you should do the following code when the device is offline..

header = new Header();

                                        header.approveOperation(ponumber,relCode);

                                        header.submitPending();

                                        header.save();

The following code can only be executed when the device is online..

  ApprovalDB.synchronize();

Please add reward points if helpful..


midhun_vp
Active Contributor
0 Kudos

Thanks for you information Raja. One quick question So in device am going to check whether network is available or not , If its available I will do the   ApprovalDB.synchronize(); else How can I sync once the network comes?

Regards

Midhun

Former Member
0 Kudos

1. Ideal Way:

you can use Broadcast Receivers for this purpose...

So whenever the device is connected to the network, you can start the sync by calling synchronize() method...

2. Otherway around:

You can provide the explicit button in the UI which will trigger the sync.. Here when the user taps on the button, you can check the network and start the sync according to the availability of the network..

midhun_vp
Active Contributor
0 Kudos

Thanks Bro.

midhun_vp
Active Contributor
0 Kudos

Hi Raja,

I did the following code and I tried without internet connection but after taking a long time for the process it shown the following message

com.ianywhere.ultrlitejni12.implementation.jniexception:Ultralitej Error"mobillink communicationerror code:63

Can solve this please.

Regards

Midhun

Former Member
0 Kudos

Could you please add the full stack trace and the code snippet as well

midhun_vp
Active Contributor
0 Kudos

Thanks Raja.

Its solved. I tested the app in emulator without internet connection in the laptop but I didn't turn off the data enabled option in the emulator so it shown that error.

Now its working fine.

Former Member
0 Kudos

Great Bro

Answers (0)