|
@@ -0,0 +1,26 @@
|
|
|
|
+package com.pleasantprogrammer.mpp;
|
|
|
|
+
|
|
|
|
+import android.app.IntentService
|
|
|
|
+import android.content.Context
|
|
|
|
+import android.content.Intent
|
|
|
|
+import android.content.SharedPreferences
|
|
|
|
+import android.telephony.SmsManager
|
|
|
|
+
|
|
|
|
+class SendService : IntentService("SendService") {
|
|
|
|
+
|
|
|
|
+ companion object {
|
|
|
|
+ val ACTION_SEND = "com.pleasantprogrammer.mpp.action.SEND"
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ val sharedPreferences: SharedPreferences by lazy {
|
|
|
|
+ getSharedPreferences("store", Context.MODE_PRIVATE)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun onHandleIntent(intent: Intent) {
|
|
|
|
+ if(intent.action == ACTION_SEND) {
|
|
|
|
+ val smsManager = SmsManager.getDefault()
|
|
|
|
+ smsManager.sendTextMessage("5554", null, "GS99", null, null)
|
|
|
|
+ sharedPreferences.edit().putLong("last_requested", System.currentTimeMillis()).commit()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|