Skip to content

Commit

Permalink
fixes to broadcast receivers
Browse files Browse the repository at this point in the history
  • Loading branch information
juan authored and juan committed May 3, 2019
1 parent ae1c74f commit 933894c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions app/src/main/java/com/ar/smshub/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/ar/smshub/SendTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 933894c

Please sign in to comment.