Skip to Content
0
Nov 08, 2013 at 11:09 AM

How to clear Application data in mobile programatically ?

1272 Views

Hi,

I have done mobile application with SAPUI5 and Odata in phonegap. In that when I run that application the first Screen is Login screen.

First time when I run that application with wrong Credentials, it goes to error function and gives error message that "Authentication Failed'. Second time when I run that application with valid credentials it goes to success function and I am getting data from back end.

But the Problem is when I run that application third time with wrong credentials it's not showing any error message. Directly it goes to success function and I am getting that data.

I am guessing that the data is stored in Local history.That's why when I run that application it directly goes to success function without checking Headers .

To clear the data in mobile I followed below URLs .

http://stackoverflow.com/questions/11159280/programmatically-clear-phonegap-cordova-apps-cache-on-android-to-simulate-a-fre

http://scn.sap.com/thread/3440350

and I also I used Local storage, window.localStorage.clear();

But I can't remove that data.

But in mobile I can remove that Data manually like below.

settings----->Apps---->App Name---->Clear Data.

When I am doing like this it clears all data , and when I am entering wrong Credentials it goes to Error function and giving Error message.

Following is the code applied when click on Login Button for Authentication.

Can I clear that mobile data Programmatically when click on log out button?

Please help me to solve this Issue.

Thanks&Regards

Sridevi

Attachments

Authentication.jpg (43.7 kB)