I'm trying to implement an app which will show a custom popup like truecaller with caller name and number, can someone guide me to proceed with the . I have been researching for this codes/some kind of resources for last two weeks, but still nothing works for me, request you to help me!
Thanks in advance.
I would like to get a custom Dialog window even when the app is closed, for this i have implemented a foreground service that runs all the time, but the the problem is im not able to display a popup window when dialed or disconnected the call, but only getting the below toast message currently.
anything helps......
public class callReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getStringExtra(TelephonyManager.EXTRA_STATE).equals(TelephonyManager.EXTRA_STATE_OFFHOOK)) {
showToast(context, "Call Started.... FROM FORE GROUND SERVICE");
} else if (intent.getStringExtra(TelephonyManager.EXTRA_STATE).equals(TelephonyManager.EXTRA_STATE_IDLE)) {
showToast(context, "Call Ended....FROM FORE GROUND SERVICE");
}
}
public void showToast (Context context, String message){
Toast toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
}
}