android - Issue while Sending Message and making call together -
in application, need call number along sending message number. when send message , initiate call, call getting dropped instantly. if i'm not sending message before calling, calling works fine. please me solution. thanks.
for calling i'm using :
intent callintent = new intent(intent.action_call); callintent.setdata(uri.parse("tel:" + number)); context.startactivity(callintent);
for messaging :
smsmanager smsmanager = smsmanager.getdefault(); smsmanager.sendtextmessage(number, null, message, null, null);
when want call number , send message @ same time, can try this:
use public static boolean variable say: sissendmessage = false;
and
sissendmessage = true; intent callintent = new intent(intent.action_call); callintent.setdata(uri.parse("tel:" + number)); context.startactivity(callintent);
and in
public void onresume() { if(sissendmessage) { sissendmessage = false; smsmanager smsmanager = smsmanager.getdefault(); smsmanager.sendtextmessage(number, null, message, null, null); } }
since after ending call, again activity come on front , onresume()
called, can send message in method.
Comments
Post a Comment