Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
gluttonman opened this issue Mar 18, 2016 · 9 comments
Closed

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

gluttonman opened this issue Mar 18, 2016 · 9 comments
Labels
needs: reply the issue needs a response from the user

Comments

@gluttonman
Copy link

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

@jgw96
Copy link
Contributor

jgw96 commented Mar 18, 2016

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?

@gluttonman
Copy link
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.

@jgw96
Copy link
Contributor

jgw96 commented Mar 21, 2016

@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?

@jgw96 jgw96 added the needs: reply the issue needs a response from the user label Mar 22, 2016
@jgw96
Copy link
Contributor

jgw96 commented Mar 30, 2016

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!

@jgw96 jgw96 closed this as completed Mar 30, 2016
@gluttonman
Copy link
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.

@chen1203
Copy link

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!

@gluttonman
Copy link
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.

@chen1203
Copy link

@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)

@chen1203
Copy link

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

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: reply the issue needs a response from the user
Projects
None yet
Development

No branches or pull requests

4 participants