jberkel / sms-backup-plus

Backup Android SMS, MMS and call log to Gmail / Gcal / IMAP
https://play.google.com/store/apps/details?id=com.zegoggles.smssync
Apache License 2.0
1.79k stars 497 forks source link

Cannot choose a Calendar #963

Open Conan179 opened 5 years ago

Conan179 commented 5 years ago

Hello i have problem with the Calendar sync, i cand choose a Calendar. With this Version https://github.com/jberkel/sms-backup-plus/commit/56dde7c9b8b2756d545988b36a03f8a8f1834ca5 Ihave test it witch my Samsung Note 9 and a Pixel 2.

Conan179 commented 5 years ago

calander_sync_03072019

jezzaaa commented 4 years ago

I have the same problem as @Conan179 in that the UI element to tap for "Calendar used for call logs" is greyed out and nothing happens when I tap.

I have switched over to using an app password, and everything else seems to be working OK. Call logs are showing in my (GSuite) Gmail, so I have a good backup. But I'd just really like to have the call logs show in my calendar.

[Android 11 beta, SMS Backup+ 1.6.0 Beta 2]

phrontisteries commented 3 years ago

August of 2020 and still having this issue... I'd like to see the calls appear in my calendar but calendar selection is greyed out as specified above. Please fix. I think there is a new auth for calendar. But you could easily have users add as a sharing link to make changes to the calendar... Just a suggestion for a quick fix.

kurahaupo commented 3 years ago

@jezzaaa & @phrontisteries

These might be silly questions, but can you both confirm whether or not:

  1. Google calendar is the default calendar app on your device?
  2. You're signed into the applicable Google accounts on your devices?
  3. You've haven't blocked SMS Backup+ from accessing either the account or the Calendar?
  4. Does disconnecting and reconnecting the account make any difference? (ie, log out of Google, stop SMS Backup+, log into Google, restart SMS Backup+)
    • also try disabling saving to calendar in SMS Backup+ before stopping it.
  5. Does clearing cache and/or app data for SMS Backup+ (or uninstalling and reinstalling it) make any difference?
sshaikh commented 3 years ago

I have a slightly different issue - I can open the select calendar screen but it seems to be a very old list that isn't updating.

I can see the current calendar list in Google Calendar so I know the sync has happened on my phone, just not in SMSB+.

Let me know if this needs a new ticket?

kurahaupo commented 3 years ago

Hi @sshaikh That is indeed an odd issue. The code that populates the list for the user to choose a calendar is getCalendars, either in CalendarAccessorPost40 or in CalendarAccessorPre40. Those both fetch an updated list directly from Android each time, so it's difficult to see how these symptoms could occur.

I suspect that

  1. The Calendar app does all its own things using some other API; and
  2. The library keeps a local cache somewhere, and that's gone stale.

The pre-4.0 code uses an API URI, and the post-4.0 uses the CalendarContract library call. There's an even newer CalendarList library call that isn't used yet, but the old library call should still work even on the latest versions of Android, so it's hard to see what's going wrong.

Long shot: is there any chance your device or router has some long-held cache of HTTPS traffic?

sshaikh commented 3 years ago

I can't comment on my device (how can I check?) but I think my router is okay.

Since posting my observation, it seems to be now showing the list correctly.

I do have other non-google calendar apps so the next time I have a new calendar I'll check multiple apps to see if other third party calendar apps show the same symptoms. I'll report back here?

sshaikh commented 3 years ago

I did a quick rough test and you might be onto something:

  1. Create a new (in this case, renamed an existing) calendar on calendar.google.com
  2. See that the Google Calendar app reflects the new update
  3. Confirm that third party apps (inc SMSB) have an old calendar list
  4. Notice that in "account settings" that calendar hasn't been sync'd since 6am, 10 hours ago.
  5. Force a sync from that screen and see that the third party apps now have up to date lists.

So yes, it seems that the Google Calendar app at least doesn't use Android calendar for syncing, but that forcing a calendar sync via system settings fixes the issue anyway.

kurahaupo commented 3 years ago

Thanks, I'll add that to the FAQ.

jezzaaa commented 3 years ago

@jezzaaa & @phrontisteries

Sorry I've taken so long to respond.

These might be silly questions, but can you both confirm whether or not:

  1. Google calendar is the default calendar app on your device?

Yes; there's no other calendar app, it's a Google Pixel phone

  1. You're signed into the applicable Google accounts on your devices?

Yes, definitely signed in, and I use Google accounts for calendar and email daily

  1. You've haven't blocked SMS Backup+ from accessing either the account or the Calendar?

I don't think so. Although I'm not sure how I would do that.

  1. Does disconnecting and reconnecting the account make any difference? (ie, log out of Google, stop SMS Backup+, log into Google, restart SMS Backup+)
    • also try disabling saving to calendar in SMS Backup+ before stopping it.

Is this the same as "removing" the account from the phone? Settings > Accounts > [Google A/c] > Remove account

Or do you mean disconnect the account from SMS Backup +?

I've tried disconnecting and reconnecting the account in SMS Backup + several times.

  1. Does clearing cache and/or app data for SMS Backup+ (or uninstalling and reinstalling it) make any difference?

No

And now. An interesting development. I noticed that my call log is now being synchronised with my calendar. This is not the default calendar for the Google account, but is another one. It's also not the "Call Logs" calendar that I originally setup for this purpose. So now, unfortunately, the synchronisation is polluting another calendar. And even though the sync is working, I still have the same problem with the UI option greyed out and showing "None" as the calendar name.

kurahaupo commented 3 years ago

Sorry I've taken so long to respond.

me likewise.

  1. Does disconnecting and reconnecting the account make any difference? (ie, log out of Google, stop SMS Backup+, log into Google, restart SMS Backup+)
    • also try disabling saving to calendar in SMS Backup+ before stopping it.

Is this the same as "removing" the account from the phone? Settings > Accounts > [Google A/c] > Remove account

Or do you mean disconnect the account from SMS Backup +?

I've tried disconnecting and reconnecting the account in SMS Backup + several times.

As other comments have mentioned, there seems to be some OS-level cache of 'available calendars', which the Google calendar app does not use, and in your particular case, the cache appears to say that there are no calendars at all.

Quite how the cache gets into that state is something of a mystery, and figuring out how to fix it is going to take a fair bit of experimentation.

(Yes, this is a bug in the Android OS , not a bug in SMS Backup+.)

My working hypothesis is that signing out of Chrome causes that cache to be flushed, as Chrome seems to have some fairly deep hooks into the OS.

If that's not sufficient then "clear app data" on Chrome might do the trick, but note (a) this is speculative in my part, and (b) doing so would purge all cookies, sessions, saved passwords etc, so that's pretty much a last resort.

jezzaaa commented 3 years ago

On Sat, 28 Nov 2020, 19:23 Martin Kealey, notifications@github.com wrote:

As other comments have mentioned, there seems to be some OS-level cache of 'available calendars', which the Google calendar app does not use, and in your particular case, the cache appears to say that there are no calendars at all.

Quite how the cache gets into that state is something of a mystery, and figuring out how to fix it is going to take a fair bit of experimentation.

(Yes, this is a bug in the Android OS , not a bug in SMS Backup+.)

Understood

My working hypothesis is that signing out of Chrome causes that cache to be flushed, as Chrome seems to have some fairly deep hooks into the OS.

If that's not sufficient then "clear app data" on Chrome might do the trick, but note (a) this is speculative in my part, and (b) doing so would purge all cookies, sessions, saved passwords etc, so that's pretty much a last resort.

I'm happy to try last resort. Unfortunately, this didn't work.

Any other suggestions?

hubono commented 3 years ago

Hi Any update on this. I formatted my phone last week and now cannot select the calendar to which i want my calls to be synced to. It was working before they format since i can see the entries in my calendar which are until dec 14 ( last day before formatting my phone)

Please assist

kurahaupo commented 3 years ago

(Closing issue #1044 as a duplicate of this one. It has entries being put in the wrong calendar with the calendar selection screen greyed out.)

luxmj commented 3 years ago

Hi Any update on this. I formatted my phone last week and now cannot select the calendar to which i want my calls to be synced to. It was working before they format since i can see the entries in my calendar which are until dec 14 ( last day before formatting my phone)

Please assist

me too. Pixel 4a 5G SMS Backup+ 1.6.0 beta2 it works for sms and call log, but call log can't back to calendar, call log show in the gmail. my pixel 1 is working normally for sms and call log.

kurahaupo commented 3 years ago

Sorry, I've been busy with Life™ for a few months.

This all boils down to "there's a stale cache somewhere". Our task is to find it, and figure out how to purge it.

I've been assuming that since it's an OS-level cache, that it's across the whole device, but perhaps it's a per-app cache. This seems a bit unlikely as several people have reported problems even when they've started from a clean installation, but clearing the cache for SMS Backup+ is simple enough that it's still worth trying.

That's long-press on the SMS Backup+ icon to get to Settings or Info, then Memory (or a similar device-dependent step), then Clear Cache.

(Note that if you tap Clear Data instead of Clear Cache, that will inter alia reset the "timestamp of the most recently backed up SMS", so that if you then do a backup, it will back up all the messages that are in your SIM, causing duplicates of any that were previously backed up.

jezzaaa commented 3 years ago

This all boils down to "there's a stale cache somewhere". Our task is to find it, and figure out how to purge it.

I'm not sure this can be the case. I've uninstalled and reinstalled the app, which would have cleared any cache/data for the app. I've also (many times) cleared the cache for the app with no change to the behaviour - still won't let me select the calendar, and still saves to the same (wrong) calendar.

kurahaupo commented 3 years ago

By now it's obvious that the cache in question exists outside the app, presumably somewhere in the Android OS, or maybe server-side in Google somewhere, so clearing the app's cache (or other data) won't help.

The list of available calendars is obtained by issuing an Android library call (actually two different calls, depending on whether the version of Android is before or after 6.0). One would naïvely assume that this library function simply connects directly to the Google Calendar servers, but since that's lying to us, there must be something else happening. Where the the library call is getting the (wrong) data from - a local cache on the phone, or from broken Google Calendar servers - is hard to say.

It's not impossible that Google could deprecate the old API on the server, and leave it in a broken state, with a new API that works, but as the problem exists very persistently for a few people, it seems more likely to be a client-side problem.

I've personally run SMS Backup+ on 4 types of phones, and might have transiently encountered this just once; I certainly can't replicate it on any of them now.

If anyone has plenty of time to research this, and has a phone exhibiting this issue, doing a factory reset on the phone could prove (but not disprove) my "OS-level cache" hypothesis. (That is, if wiping the phone fixes the problem, that means it's cleared whatever broken cache was on the device, whereas if it doesn't fix it, then maybe it's a server-side problem, or maybe there's a problem with the out-of-the-box software on the device.)

This anomaly could account for several types of errors that have been reported in relation to calendars:

  1. If that Android library call returns no calendars, then the "choose" button is greyed out; or
  2. If that Android library call returns a list that includes a calendar that doesn't exist, and you select it, then either:
    • you get a weird error when you hit "choose"; or
    • your choice is ignored, and some other calendar is silently selected, so your call logs wind up somewhere you don't want or expect, or
    • your choice is ignored, and "no calendar" is silently selected, so you don't get anything recorded.

... so I would really like to get to the bottom of it.

sshaikh commented 3 years ago

FWIW as noted in my previous comment, there seems to be two Google calendar syncs/caches. I see:

Sync Calendar Sync Google Calendar

These appear to update at different times, and for different reasons.

For me the issue is fixed after noticing SMSB+ sees a current list as long as the first vanilla "Sync Calendar" is up to date (if Google Calendar is up to date instead, then it makes no difference to SMSB+)

kurahaupo commented 3 years ago

@sshaikh That's most helpful, thankyou.

(I'm still not sure if I can track down the issue, but at least those labels help fine-tune my research.)

hubono commented 3 years ago

Hi Any update on this. I formatted my phone last week and now cannot select the calendar to which i want my calls to be synced to. It was working before they format since i can see the entries in my calendar which are until dec 14 ( last day before formatting my phone)

Please assist

Hi again I found a way to fix this issue. Goto ur smsb+ app settings Clear data Goto permissions Grant all permissions to smsb+ Goto the app Input ur email, password, Goto backup settings Call log settings Tick calendar sync Now it should work

I think when freshly installing and clicking on the calendar sync, gives a pop up asking you to grant calendar permission but for some reason it doesnt populate. Doing it the way i mentioned above and launching the app with the permission already granted, it pulls all the calendars that you have approved in you android calendar app.

I hope this helps At least it worked for me

Cheers

jezzaaa commented 3 years ago

I found a way to fix this issue.

Thanks hubono. Some progress, I think? I cleared the cache but didn't login to by Google account. Having calendar access enabled, yet not yet being logged into IMAP, seems to have allowed the full list of calendars to show up.

Unfortunately, I can't seem to login again. I've tried the hack using Edge for OAUTH, and tried creating a new app password for IMAP (in case what I have in my LastPass vault is wrong) but neither are working for me.

I realised that the calendar I was using is from a different Gmail account to the one I was logged in via IMAP. Could this have been the cause of the problem in the first place?

kurahaupo commented 3 years ago

@hubono thankyou SO much! That's really helpful