Skip to content

Instantly share code, notes, and snippets.

@LTroya
Last active June 6, 2016 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LTroya/fd9a89945779b44c88befdb73c6a21d6 to your computer and use it in GitHub Desktop.
Save LTroya/fd9a89945779b44c88befdb73c6a21d6 to your computer and use it in GitHub Desktop.
public class EventHandlerService extends Service implements OnIncomingCallListener {
private final String TAG = EventHandlerService.class.getSimpleName();
private AbtoPhone abtoPhone;
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
abtoPhone = ((AbtoApplication) getApplication()).getAbtoPhone();
abtoPhone.setIncomingCallListener(this);
return START_STICKY;
}
@Override
public void OnIncomingCall(String remoteContact, long arg1) {
Intent intent = new Intent(this, ScreenAV.class);
intent.putExtra(ScreenAV.CALL_ID, abtoPhone.getActiveCallId());
intent.putExtra(AbtoPhone.REMOTE_CONTACT, remoteContact);
intent.putExtra(ScreenAV.EXTRA_CALL_INCOMING, true);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Log.d(TAG, "Es video? " + abtoPhone.isVideoCall());
startActivity(intent);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment