简体   繁体   中英

Is it possible to get sunrise/sunset in android WITHOUT location or the light sensor?

I want to know aproximately when is light and when is dark WITHOUT relying on gps, location or the light sensor of the device. Is it possible? Thanks for the help.

well, you must know at least coarse location of user, sunrise/sunset time is different in center of north pole and equator, isn't it?

on Android you can get approximate location with

Locale.getDefault().getCountry()

or

Locale.getDefault().getLanguage()

some wiki explanation how to calculate sunrise

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM