Blog Directory logo  Blog Directory
  •  Login
  • Register
  •            Submit a Blog
    Submit a Blog in Featured for only $10 with PaypalFeatured BlogsBlog Listing
    Member - { Blog Details }

    hero image

    blog address: http://blogs.shephertz.com/2013/12/13/applying-caching-and-offline-storage-in-app42-android-sdk/

    keywords: Android caching, App42 Android sdk, Caching and offline, Caching and offline storage, caching in android app, Caching in app42, Offline appdata, Offline storage

    member since: Jan 1, 2021 | Viewed: 558

    Applying Caching and Offline Storage in App42 Android SDK

    Category: Technology

    We are excited to announce a new feature of offline caching and storage in our App42 Android SDK. This will enable your application to be responsive even if the network is not available and user can use your application flawlessly without any trouble. Using this feature is quite straightforward and requires a single line of code to enable it. Below mentioned are the different policies and mechanisms of this feature:Offline Caching Offline caching enables your application to read data from local cache if network is not available. There are different cache levels that can be set using API and have been explained below:Cache Policies :1). Policy.CACHE_FIRST – Setting this policy will enable all read data to be first looked in to cache if data is available and not expired then it will return from cache otherwise network request will be made and cache will be updated for the same. You can set cache expiry time by using API as explained below. By default cache expiry is set to an hour. // Setup caching policy import com.shephertz.app42.paas.sdk.android.App42CacheManager; import com.shephertz.app42.paas.sdk.android.App42CacheManager.Policy; App42API.initialize(this, "", ""); App42CacheManager.setPolicy(Policy.CACHE_FIRST); ; //Same can be done for network policy //Set Cache Expiry time. Applicable only for CACHE_FIRST App42CacheManager.setExpiryInMinutes(""); 2). Policy.NETWORK_FIRST – This policy enables data to be fetched from network and then update cache. If network is not available, data is fetched from cache.3). Policy.NOCACHE – By default App42 SDK uses this policy and does not use any cache and always reads data from network only.Offline storageOffline storage allows you to post data locally in case network is not available and syncs it with server later when network is available. This is useful in many scenarios e.g. if your user is playing a game and has scored something on completion of a specific level. However, at the time of posting of score if network is not available his score might get lost and his efforts will go waste. This can be avoided using offline caching where his score will be saved locally in case of network unavailability and will be later synced with server when network availability resumes.How it works : To use this feature, you just have to set offline storage true as shown below. App42API.setofflineStorage(true) // just set offline storage true scoreBoardService.saveUserScore(gameName, userName, gameScore,new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; if(game.isOfflineSync()) { System.out.println("Information is Stored in cache, will send to App42 when network is available"); } else { System.out.println("Game Name is : "+game.getName()); for(int i = 0;i



    { More Related Blogs }
    © 2025, Blog Directory
     | 
    Google Pagerank: 
    PRchecker.info
     | 
    Support
               Submit a Blog
    Lava Magnum X604- Shop online for best mobiles in India - Poorvikamobile.com

    Technology

    Lava Magnum X604- Shop online ...


    Jan 21, 2015
    hard drive recovery Toronto

    Technology

    hard drive recovery Toronto...


    Jul 12, 2015
    hard drive recovery Toronto

    Technology

    hard drive recovery Toronto...


    Jun 1, 2015
    Lenovo Laptop IdeaPad 3, Intel Celeron N4020, 15.6 Inch, 1TB HDD, 4GB RAM, Intel UHD Graphics 600, D

    Technology

    Lenovo Laptop IdeaPad 3, Intel...


    Mar 13, 2022
    HTC Desire 526G Plus Review

    Technology

    HTC Desire 526G Plus Review...


    Oct 2, 2015
    How ChatGPT Solves Modern-World Problems?

    Technology

    How ChatGPT Solves Modern-Worl...


    Jan 27, 2023