Search code examples
androidsynchronizationcontactsaccountmanager

Sync Contacts with Android Application


I want to add my application in sync option in Android -> Setting.

I have created Sync Adapter and it works perfect..

But my contacts are not added under my account.. I got my account under "Contact to display" but when i select my account, there is no contacts in that account. Can anyone please help me out...

I have referred a lot like this and this.

But my issue is not discussed in any of them.. Thank you in advance...


Solution

  • You can try this link to handle your apps idle time

    Application idle time

    and in (taken from that answer)

    public class ControlApplication extends Application{
    
        private static final String TAG=ControlApplication.class.getName();
        private Waiter waiter;  //Thread which controls idle time
    
        // only lazy initializations here!
        @Override
        public void onCreate(){
            super.onCreate();
            Log.d(TAG, "Starting application"+this.toString());
            waiter=new Waiter(15*60*1000); //15 mins
            waiter.start();
            setContentView(R.layout.blackscreen);
        }
    
        public void touch(){
            waiter.touch();
        }
    }
    

    you can call an xml file which has background as black using

    EDIT

    blackscreen.xml

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#000000"
        tools:context=".MainActivity">