Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 9db3546

Browse files
tacticalDevCtacticalDevC
authored andcommitted
Sending back a confirmation when triggered.
1 parent 47903d0 commit 9db3546

4 files changed

Lines changed: 20 additions & 5 deletions

File tree

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/AndroidManifest.xml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
34
package="at.tacticaldevc.panictrigger">
45

56
<uses-feature
67
android:name="android.hardware.telephony"
78
android:required="false" />
9+
<uses-feature android:name="android.hardware.location.gps"/>
810

911
<uses-permission android:name="android.permission.RECEIVE_SMS" />
1012
<uses-permission android:name="android.permission.SEND_SMS" />
11-
<!--<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
12-
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />-->
13+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
1314
<uses-permission android:name="android.permission.CALL_PHONE" />
1415
<uses-permission android:name="android.permission.CALL_PRIVILEGED"/>
1516
<!--<uses-permission android:name="android.permission.READ_CONTACTS"/>-->
@@ -20,7 +21,8 @@
2021
android:label="@string/app_name"
2122
android:roundIcon="@mipmap/ic_launcher_round"
2223
android:supportsRtl="true"
23-
android:theme="@style/AppTheme">
24+
android:theme="@style/AppTheme"
25+
tools:ignore="GoogleAppIndexingWarning">
2426
<activity android:name=".TriggerActivity">
2527
<intent-filter>
2628
<action android:name="android.intent.action.MAIN" />
@@ -39,7 +41,7 @@
3941
<activity
4042
android:name=".ContactPickerActivity"
4143
android:label="@string/title_activity_contact_picker"
42-
android:theme="@style/AppTheme"></activity>
44+
android:theme="@style/AppTheme"/>
4345
</application>
4446

4547
</manifest>

app/src/main/java/at/tacticaldevc/panictrigger/SMSListener.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import android.provider.Telephony;
1111
import android.support.v4.app.NotificationCompat;
1212
import android.support.v4.app.NotificationManagerCompat;
13+
import android.telephony.SmsManager;
1314
import android.telephony.SmsMessage;
1415

1516
import java.io.IOException;
@@ -38,9 +39,12 @@ public void onReceive(Context context, Intent intent) {
3839

3940
private void triggerAlarm(Context context, String address) {
4041
AudioManager audioManager = ((AudioManager) context.getSystemService(Context.AUDIO_SERVICE));
42+
SmsManager smsManager = SmsManager.getDefault();
4143
MediaPlayer mp = new MediaPlayer();
4244
Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + address));
4345

46+
smsManager.sendTextMessage(address, null, "Panic triggered!", null, null);
47+
4448
audioManager.setStreamVolume(AudioManager.STREAM_ALARM, audioManager.getStreamMaxVolume(AudioManager.STREAM_ALARM), 0);
4549
try {
4650
mp.setDataSource(context, RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM));

app/src/main/java/at/tacticaldevc/panictrigger/TriggerActivity.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
package at.tacticaldevc.panictrigger;
22

33
import android.Manifest;
4+
import android.app.PendingIntent;
45
import android.content.DialogInterface;
56
import android.content.Intent;
67
import android.content.pm.PackageManager;
8+
import android.location.Location;
9+
import android.location.LocationManager;
710
import android.net.Uri;
811
import android.support.v7.app.AlertDialog;
912
import android.support.v7.app.AppCompatActivity;
@@ -120,4 +123,10 @@ public void onClick(View v) {
120123
break;
121124
}
122125
}
126+
127+
/*private Location getCurrentLocation()
128+
{
129+
LocationManager locManager = (LocationManager) getSystemService(LOCATION_SERVICE);
130+
locManager.requestSingleUpdate(LocationManager.NETWORK_PROVIDER, new PendingIntent());
131+
}*/
123132
}

0 commit comments

Comments
 (0)