Skip to content

ionic for android device $cookies does not work! #5873

Closed

Description

@gluttonman

description of the problem:

i use ngCookies store data that store 30 days! 
it works on ios and browser,but does not work on android device!  

Which Ionic Version? Ionic, v1.2.4 and ngCookies, v1.4.3

Activity

  1. jgw96 commented on Mar 18, 2016

    @jgw96
    Contributor

    Thanks for opening an issue with us, we just need a little more info from you so that we can better help you with your issue. What version of Android are you testing on? Also would you be able to provide a plunkr, codepen or repo that we could use to repro the issue on our devices?

  2. gluttonman commented on Mar 19, 2016

    @gluttonman
    Author

    @jgw96 the version of my emulation is 4.4.4 and my device is also 4.4.4! the code is very simple. i use ngCookies module and use method $cookies.putObject("key",{id:1}) and $cookies.getObject("key"). But $cookies.getObject("key") return null on android. it is right on ios and browser.

  3. jgw96 commented on Mar 21, 2016

    @jgw96
    Contributor

    @gluttonman After doing some testing of my own on a Nexus 7 running Android 6.0.1, a Nexus 6 running the Android N dev preview and a Moto X 2014 running 5.1 ngCookies does appear to have some issues on android in Cordova apps that i will need to look further into. Is there a specific reason that you are using cookies and not something like localStorage?

  4. added
    needs: reply
    on Mar 22, 2016
  5. jgw96 commented on Mar 30, 2016

    @jgw96
    Contributor

    Hello! Thanks for opening an issue with us! Since it has been a little while since there was any activity on this issue i will be closing it, but feel free to respond back if your still having the issue! Thanks again!

  6. gluttonman commented on Apr 1, 2016

    @gluttonman
    Author

    @jgw96 Thank you for help me! the cookies can store data by expire date but localStorage can not do it . so i choose to use cookies.

  7. chen1203 commented on May 14, 2016

    @chen1203

    Hi, I also got this problem when I try to use $cookies on android version 5.1+, it's not working.
    When I run it on the browser (with ionic serve) it's working but on android it isn't.
    Do you have any ideas ?
    Tnx!

  8. gluttonman commented on May 18, 2016

    @gluttonman
    Author

    @chen1203 it is because that chrome broswer not support cookies that load local file. the app fix on device is like the broswer load local file, so the cookies is disable.

  9. chen1203 commented on May 20, 2016

    @chen1203

    @gluttonman - So what is the solution ? What is the best/recommended way to store some data when the app is close? (for example - to login)

  10. chen1203 commented on May 20, 2016

    @chen1203

    I used localStorage and it works both on browser and android.
    @gluttonman - thanks.

  11. locked and limited conversation to collaborators on Sep 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs: reply

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions