Note that there are some explanatory texts on larger screens.

plurals
  1. POStarts new activity after previous automatically
    primarykey
    data
    text
    <p>Hello! I have an application which reads call logs, incoming sms, and outgoing sms. </p> <p>When the application is first launched, it shows call logs and then listens for incoming and outgoing sms. I have three classes: Main Activity, IncomingSms.Java and outgoingSms.java.</p> <p>The main activity starts normally and shows everything fine, but the incoming and outgoing sms functions are not triggered. My incoming and outgoing sms classes are 100% correct and works fine if I create and run as new project but they don't work together. </p> <p>All I want is to trigger all these processes simultaneously here is my code. </p> <p>MainActivity.java</p> <pre><code>public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); getCallDetails(); } @SuppressWarnings("deprecation") private void getCallDetails() { //rest of code here } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.activity_main, menu); return true; } } </code></pre> <p>my IncmingSms.java</p> <pre><code>public class IncomingSms extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { final Bundle bundle = intent.getExtras(); final SmsManager sms = SmsManager.getDefault(); // REST OF CODE HERE } } </code></pre> <p>OutgoingSms.java</p> <pre><code>public class OutgoingSms extends Activity { final SmsManager sms = SmsManager.getDefault(); ContentResolver contentResolver; ContentObserver smsContentObserver; @Override public void onResume() { super.onResume(); smsContentObserver = new ContentObserver(new Handler()) { @Override public void onChange(boolean selfChange) { Uri smsURI = Uri.parse("content://sms/sent"); Cursor c = getContentResolver().query(smsURI, new String[] { "address", "date", "body", "type" }, null, null, null); String[] columns = new String[] { "address", "date", "body", "type" }; c.moveToNext(); Rest of Code here@ Override public boolean deliverSelfNotifications() { return true; } }; contentResolver.registerContentObserver(Uri.parse("content://sms"), true, smsContentObserver); } @Override public void onDestroy() { super.onDestroy(); contentResolver.unregisterContentObserver(smsContentObserver); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload