diff --git a/app/src/main/java/com/ar/smshub/MainActivity.kt b/app/src/main/java/com/ar/smshub/MainActivity.kt index 3b7d1a9..7a7e799 100644 --- a/app/src/main/java/com/ar/smshub/MainActivity.kt +++ b/app/src/main/java/com/ar/smshub/MainActivity.kt @@ -52,20 +52,24 @@ class MainActivity : AppCompatActivity() { requestSMSReadPermission() // Inside OnCreate Method + try { registerReceiver(broadcastReceiver, IntentFilter(RECEIVED_SMS_FLAG)) registerReceiver(sendIntent, IntentFilter(SENT_SMS_FLAG)) registerReceiver(deliverIntent, IntentFilter(DELIVER_SMS_FLAG)) - + } catch (e: IllegalArgumentException) { + Log.d("-->", "Already subscribed") + } } override fun onStop() { + /* try { unregisterReceiver(sendIntent) unregisterReceiver(deliverIntent) unregisterReceiver(broadcastReceiver) } catch (e: IllegalArgumentException) { Log.d("-->", "No receivers") - } + }*/ super.onStop() } diff --git a/app/src/main/java/com/ar/smshub/SendTask.kt b/app/src/main/java/com/ar/smshub/SendTask.kt index 0a07281..5f6b43f 100644 --- a/app/src/main/java/com/ar/smshub/SendTask.kt +++ b/app/src/main/java/com/ar/smshub/SendTask.kt @@ -44,7 +44,7 @@ class SendTask constructor(_settings: SettingsManager, _context: Context) : Time mainActivity.runOnUiThread(Runnable { mainActivity.logMain("Error parsing response from server: " + apiResponse.text) }) - Log.d("error", "Error while parsing SMS") + Log.d("error", "Error while parsing SMS" + apiResponse.text) } } finally { // optional finally block