Re initate Sync adapter in android -
i'm able create sync adapter in phone, i'm not able handle particular scenario.
my task sync app, requires tasks permission fetch tasks or applicable getting permission service google server. scenario occurs first time, if user moves google account without launching application.
1) go settings --> accounts , sync --> choose google account,
2) there tasks sync content provider present.
3) once press on sync, since first time sync provider not have access tasks or google services etc.. accounts raises userrecoverableexception
4) of notification provider raise push notification in catch block.
here how i'm doing, e userrecoverableexception intent.
pendingintent pendingnotificationintent = pendingintent.getactivity( mcontext, constants.request_authorization, e.getintent(), pendingintent.flag_update_current | pendingintent.flag_one_shot);
4) once user click on notification open authentication window, user approves permission app fetch calender, contacts, task etc service.
5) how re initiate sync once user completes authentication part?. notice app shows red color exclamatory icon next sync icon, saying "sync experiencing problems shortly". once permission automatically resume , sync.
here how notification restart sync or resume user authenticate permission
here solution,
we need use syncresult.stats.numauthexceptions tell exception, throws message automatically. syncresult.delayuntil wait , restart sync after elapsing time
Comments
Post a Comment