0

This is my Service Class

public class ContactSync extends IntentService {
    private static final String TAG = "com.ric.connectme.Services.ContactSync";


    public ContactSync() {
        super(TAG);
    }

    public ContactSync(String name) {
        super(name);
    }



    @Override
    protected void onHandleIntent(@Nullable Intent intent) {
        if (intent != null) {
            Toast t = Toast.makeText(getBaseContext(), message, Toast.LENGTH_LONG);
            t.setGravity(Gravity.CENTER, 0, 0);
            t.show();
            GoForUplodeContect(intent);
        }
    }


    private void GoForUplodeContect(Intent intent){
        RsXtraUserNumbersBackupUploder.Uplode(getBaseContext(),intent);
    }


    @Override
    public void onDestroy() {
        super.onDestroy();
    }
}

This Is What I Inserted In AndroidManifest

<service android:name=".Services.ContactSync">

        </service>

And This is how I am calling this service

Intent intent = new Intent(context,ContactSync.class);
        intent.putExtra(RsXtraIntetBundelKeys.USER_ID,userId);
        context.startService(intent);

I Tried everything and system starting the service very well but the onHandleIntent is not executing.

Can any one help me on this ?

sourabh devpura
  • 605
  • 8
  • 25
  • 1
    How are you determining that it's not called? You can't rely on that `Toast`, 'cause it won't work there like that. Have you tried something else, like a log print, a breakpoint, a `Notification`, etc.? – Mike M. Jan 13 '18 at 21:48
  • Cos I checked data on the server. Nothing is inserted – sourabh devpura Jan 13 '18 at 21:50
  • 1
    How do you know it's not a problem with `RsXtraUserNumbersBackupUploder.Uplode()`? – Mike M. Jan 13 '18 at 21:51
  • 1
    Use Logs to show if it does not work! Also Context in a Service is also itself! – Xenolion Jan 13 '18 at 21:51
  • 1
    Thanks, my friends you are right I should not rely on that Toast. It's working and data not inserted because I am not calling my final function. Sorry for that but it's working now. – sourabh devpura Jan 13 '18 at 21:54

0 Answers0