├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── ic_launcher-web.png
│ │ ├── res
│ │ │ ├── drawable
│ │ │ │ ├── help.png
│ │ │ │ ├── save.png
│ │ │ │ ├── test.png
│ │ │ │ ├── newicon.png
│ │ │ │ ├── settings.png
│ │ │ │ ├── customsave.png
│ │ │ │ ├── contactsback.png
│ │ │ │ ├── settingsback.png
│ │ │ │ └── ic_launcher_background.xml
│ │ │ ├── drawable-v24
│ │ │ │ ├── back.jpg
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── im.png
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_launcher_foreground.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_launcher_foreground.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_launcher_foreground.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_launcher_foreground.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_launcher_foreground.png
│ │ │ ├── drawable-nodpi
│ │ │ │ └── example_picture.png
│ │ │ ├── drawable-hdpi
│ │ │ │ ├── ic_action_stat_reply.png
│ │ │ │ ├── ic_action_stat_share.png
│ │ │ │ └── ic_stat_new_message.png
│ │ │ ├── drawable-mdpi
│ │ │ │ ├── ic_action_stat_reply.png
│ │ │ │ ├── ic_action_stat_share.png
│ │ │ │ └── ic_stat_new_message.png
│ │ │ ├── drawable-xhdpi
│ │ │ │ ├── ic_stat_new_message.png
│ │ │ │ ├── ic_action_stat_reply.png
│ │ │ │ └── ic_action_stat_share.png
│ │ │ ├── drawable-xxhdpi
│ │ │ │ └── ic_stat_new_message.png
│ │ │ ├── drawable-xxxhdpi
│ │ │ │ └── ic_stat_new_message.png
│ │ │ ├── values
│ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ ├── colors.xml
│ │ │ │ ├── styles.xml
│ │ │ │ └── strings.xml
│ │ │ └── layout
│ │ │ │ ├── activity_settings.xml
│ │ │ │ ├── activity_main.xml
│ │ │ │ └── activity_contacts.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── asterisklab
│ │ │ └── com
│ │ │ └── friendinneedproduction
│ │ │ ├── SettingsActivity.java
│ │ │ ├── contactsActivity.java
│ │ │ └── MainActivity.java
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── asterisklab
│ │ │ └── com
│ │ │ └── friendinneedproduction
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── asterisklab
│ │ └── com
│ │ └── friendinneedproduction
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── .idea
├── caches
│ └── gradle_models.ser
├── vcs.xml
├── runConfigurations.xml
├── gradle.xml
├── codeStyles
│ └── Project.xml
├── misc.xml
└── assetWizardSettings.xml
├── Screenshot_20190322-130809.png
├── Screenshot_20190322-130814.png
├── Screenshot_20190322-130818.png
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── 64725064_430461314402365_9155770076249456640_n.png
├── .gitignore
├── gradle.properties
├── README.md
├── gradlew.bat
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/.idea/caches/gradle_models.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/.idea/caches/gradle_models.ser
--------------------------------------------------------------------------------
/Screenshot_20190322-130809.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/Screenshot_20190322-130809.png
--------------------------------------------------------------------------------
/Screenshot_20190322-130814.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/Screenshot_20190322-130814.png
--------------------------------------------------------------------------------
/Screenshot_20190322-130818.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/Screenshot_20190322-130818.png
--------------------------------------------------------------------------------
/app/src/main/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/ic_launcher-web.png
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/drawable/help.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/drawable/help.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/save.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/drawable/save.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/test.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/drawable/test.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/back.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/drawable-v24/back.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/newicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/drawable/newicon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/drawable/settings.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/customsave.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/drawable/customsave.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/contactsback.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/drawable/contactsback.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/settingsback.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/drawable/settingsback.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/im.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/mipmap-anydpi-v26/im.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/64725064_430461314402365_9155770076249456640_n.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/64725064_430461314402365_9155770076249456640_n.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/example_picture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/drawable-nodpi/example_picture.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_stat_reply.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/drawable-hdpi/ic_action_stat_reply.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_stat_share.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/drawable-hdpi/ic_action_stat_share.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_stat_new_message.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/drawable-hdpi/ic_stat_new_message.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_stat_reply.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/drawable-mdpi/ic_action_stat_reply.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_stat_share.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/drawable-mdpi/ic_action_stat_share.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_stat_new_message.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/drawable-mdpi/ic_stat_new_message.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_stat_new_message.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/drawable-xhdpi/ic_stat_new_message.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_action_stat_reply.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/drawable-xhdpi/ic_action_stat_reply.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_action_stat_share.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/drawable-xhdpi/ic_action_stat_share.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_stat_new_message.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/drawable-xxhdpi/ic_stat_new_message.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_stat_new_message.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/drawable-xxxhdpi/ic_stat_new_message.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sabir-Islam-Khan/Friend-In-Need/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/values/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFF6FE
4 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches/build_file_checksums.ser
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | .DS_Store
9 | /build
10 | /captures
11 | .externalNativeBuild
12 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Mar 15 22:08:34 BDT 2019
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 | #778beb
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/asterisklab/com/friendinneedproduction/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.asterisklab.com.friendinneedproduction;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 |
15 |
16 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/asterisklab/com/friendinneedproduction/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.asterisklab.com.friendinneedproduction;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.asterisklab.com.friendinneed", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Friend In Need
3 | Help
4 | Give Your Trusted Contacts here :
5 | First Contact
6 | Second Contact
7 | Third Contact
8 | Fourth Contact
9 | Fifth Contact
10 | Safe Mode
11 | Saved Successfully !
12 | Help !
13 | You are now in Safe Mode
14 | In case of Emergency, Tap this Button
15 | Give Username
16 | Here You can Customize the SMS that would be sent to your friends !
17 | Give your Customized SMS here !
18 | Give SMS permission :
19 | Give Permission
20 | SMS :
21 |
22 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | defaultConfig {
6 | applicationId "com.asterisklab.com.friendinneedproduction"
7 | minSdkVersion 21
8 | targetSdkVersion 28
9 | versionCode 2
10 | versionName "2.0"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | implementation fileTree(dir: 'libs', include: ['*.jar'])
23 | //noinspection GradleCompatible
24 | implementation 'com.android.support:appcompat-v7:28.0.0'
25 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
26 | implementation 'com.google.android.gms:play-services-location:16.0.0'
27 | implementation 'com.android.support:support-v4:28.0.0'
28 | testImplementation 'junit:junit:4.12'
29 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
30 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asterisklab/com/friendinneedproduction/SettingsActivity.java:
--------------------------------------------------------------------------------
1 | package com.asterisklab.com.friendinneedproduction;
2 |
3 | import android.content.Intent;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.widget.EditText;
8 | import android.widget.ImageButton;
9 | import android.widget.Toast;
10 |
11 | public class SettingsActivity extends AppCompatActivity {
12 |
13 | public EditText name;
14 | public EditText msg;
15 | public ImageButton saveBtn;
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | setContentView(R.layout.activity_settings);
20 |
21 | name = findViewById(R.id.userName);
22 | msg = findViewById(R.id.userMsg);
23 | saveBtn = findViewById(R.id.testBtn);
24 |
25 | saveBtn.setOnClickListener(new View.OnClickListener() {
26 | @Override
27 | public void onClick(View v) {
28 |
29 | Intent myIntent = new Intent(SettingsActivity.this, MainActivity.class);
30 | myIntent.putExtra("name",name.getText().toString());
31 | myIntent.putExtra("msg",msg.getText().toString());
32 |
33 | Toast myToast = Toast.makeText(getApplicationContext(), R.string.toast, Toast.LENGTH_LONG);
34 | myToast.show();
35 |
36 | startActivity(myIntent);
37 | }
38 | });
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | This is app through which people can get emergency help when needed.
2 |
3 |
Prologue
4 |
5 | Recently women harassment has dangerously increased in Bangladesh. It is now one of the major concern in our country. I wanted to do something against this. So i decided to make an android app. In this app, user have to give 5 trusted contacts number. If he/She falls in danger, all she needs to do is to open the app and tap a single button. This app will automatically send SMS to those 5 people. The SMS will contain a google maps which will provide users current location. And this app will also calculate the closest police station from user and send the same SMS to Officer in Charge there. And the most cool thing about this app is that, all these things would work in completely offline mode. Now, lets hop right into the depth and see how to use it and how its made.
6 |
7 | Built With
8 |
9 | This a native android app and its made with JAVA in its backend and XML in its frontend.
10 |
11 | Walkthrough
12 |
13 | Home Screen
14 |
15 | This is the home screen of this app. User have to press the emergency button when He/She falls in danfger. Thats all, its that simple.
16 |
17 | Contacts Screen
18 |
19 |
20 |
21 | Before using home screen and sending emergency SMS, user has to provide the app with their trusted contacts in this screen. Is He/She wants to ignore any field, he has to input any gurbage number there.
22 |
23 | Edit SMS Screen
24 |
25 |
26 |
27 | The purpose of this screen is preety simple. user can easily customize their emergency SMS through this screen !
28 |
29 | Final Screen
30 |
31 |
32 |
33 | This screen appears when you call for emergency help. This tells you your closest police station. Which assures you that your app is working and the OC and your friends know that you are in Danger and exactly where you are.
34 |
35 | Thanks for coming to this repo. Give it a star if you like it. It will be highly appreciated
36 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
28 |
29 |
44 |
45 |
63 |
64 |
82 |
83 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asterisklab/com/friendinneedproduction/contactsActivity.java:
--------------------------------------------------------------------------------
1 | package com.asterisklab.com.friendinneedproduction;
2 |
3 | import android.content.Intent;
4 | import android.content.SharedPreferences;
5 | import android.net.Uri;
6 | import android.provider.Settings;
7 | import android.support.v7.app.AppCompatActivity;
8 | import android.os.Bundle;
9 | import android.view.View;
10 | import android.widget.EditText;
11 | import android.widget.ImageButton;
12 | import android.widget.Toast;
13 |
14 |
15 | public class contactsActivity extends AppCompatActivity {
16 |
17 | public static final String SHARED_PREFS = "sharedPreferences";
18 | public static final String contact1 = "Contact1";
19 | public static final String contact2 = "contact2";
20 | public static final String contact3 = "contact3";
21 | public static final String contact4 = "contact4";
22 | public static final String contact5 = "contact5";
23 |
24 |
25 | public EditText first;
26 | public EditText second;
27 | public EditText third;
28 | public EditText fourth;
29 | public EditText fifth;
30 |
31 | public String conLoaded1;
32 | public String conLoaded2;
33 | public String conLoaded3;
34 | public String conLoaded4;
35 | public String conLoaded5;
36 |
37 |
38 |
39 | @Override
40 | protected void onCreate(Bundle savedInstanceState) {
41 | super.onCreate(savedInstanceState);
42 | setContentView(R.layout.activity_contacts);
43 |
44 |
45 | ImageButton saveBtn = findViewById(R.id.saveBtn);
46 |
47 | first = findViewById(R.id.firstContact);
48 | second = findViewById(R.id.secondContact);
49 | third = findViewById(R.id.thirdContact);
50 | fourth = findViewById(R.id.fourthContact);
51 | fifth = findViewById(R.id.fifthContact);
52 |
53 | final String intentValue = "saveButtonPressed";
54 |
55 |
56 |
57 | loadData();
58 |
59 |
60 | saveBtn.setOnClickListener(new View.OnClickListener() {
61 | @Override
62 | public void onClick(View v) {
63 |
64 | saveData();
65 |
66 | loadData();
67 |
68 | Toast myToast = Toast.makeText(getApplicationContext(), R.string.toast, Toast.LENGTH_LONG);
69 | myToast.show();
70 |
71 | Intent mainActivity = new Intent(contactsActivity.this, MainActivity.class);
72 |
73 | mainActivity.putExtra("Contact1",conLoaded1);
74 | mainActivity.putExtra("Contact2",conLoaded2);
75 | mainActivity.putExtra("Contact3",conLoaded3);
76 | mainActivity.putExtra("Contact4",conLoaded4);
77 | mainActivity.putExtra("Contact5",conLoaded5);
78 | mainActivity.putExtra("activityLogger", intentValue);
79 |
80 | startActivity(mainActivity);
81 | }
82 | });
83 | }
84 |
85 | public void saveData(){
86 |
87 | SharedPreferences sharedPreferences = getSharedPreferences(SHARED_PREFS, MODE_PRIVATE);
88 | SharedPreferences.Editor editor = sharedPreferences.edit();
89 |
90 | editor.putString(contact1,first.getText().toString());
91 | editor.putString(contact2, second.getText().toString());
92 | editor.putString(contact3, third.getText().toString());
93 | editor.putString(contact4, fourth.getText().toString());
94 | editor.putString(contact5, fifth.getText().toString());
95 |
96 |
97 |
98 | editor.apply();
99 | }
100 |
101 | public void loadData(){
102 |
103 | SharedPreferences sharedPreferences = getSharedPreferences(SHARED_PREFS, MODE_PRIVATE);
104 |
105 | conLoaded1 = sharedPreferences.getString(contact1,null);
106 | conLoaded2 = sharedPreferences.getString(contact2,null);
107 | conLoaded3 = sharedPreferences.getString(contact3,null);
108 | conLoaded4 = sharedPreferences.getString(contact4,null);
109 | conLoaded5 = sharedPreferences.getString(contact5,null);
110 |
111 | first.setText(conLoaded1);
112 | second.setText(conLoaded2);
113 | third.setText(conLoaded3);
114 | fourth.setText(conLoaded4);
115 | fifth.setText(conLoaded5);
116 |
117 | }
118 |
119 | }
120 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
24 |
25 |
39 |
40 |
55 |
56 |
74 |
75 |
92 |
93 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
10 |
12 |
14 |
16 |
18 |
20 |
22 |
24 |
26 |
28 |
30 |
32 |
34 |
36 |
38 |
40 |
42 |
44 |
46 |
48 |
50 |
52 |
54 |
56 |
58 |
60 |
62 |
64 |
66 |
68 |
70 |
72 |
74 |
75 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_contacts.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
25 |
26 |
44 |
45 |
62 |
63 |
80 |
81 |
98 |
99 |
116 |
117 |
136 |
137 |
138 |
139 |
--------------------------------------------------------------------------------
/.idea/assetWizardSettings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asterisklab/com/friendinneedproduction/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.asterisklab.com.friendinneedproduction;
2 |
3 | import android.Manifest;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.content.SharedPreferences;
7 | import android.content.pm.PackageManager;
8 | import android.location.Location;
9 | import android.location.LocationListener;
10 | import android.location.LocationManager;
11 | import android.support.annotation.NonNull;
12 | import android.support.v4.app.ActivityCompat;
13 | import android.support.v7.app.AppCompatActivity;
14 | import android.os.Bundle;
15 | import android.telephony.SmsManager;
16 | import android.util.Log;
17 | import android.view.View;
18 | import android.widget.ImageButton;
19 | import android.widget.TextView;
20 |
21 | import java.lang.*;
22 |
23 | public class MainActivity extends AppCompatActivity {
24 |
25 |
26 | // Declares variables for Saving into Shared Prefs
27 |
28 | public static String MY_SHARED_PREF = "mSharedPref";
29 | public static String mNumber1 = "number1";
30 | public static String mNumber2 = "number2";
31 | public static String mNumber3 = "number3";
32 | public static String mNumber4 = "number4";
33 | public static String mNumber5 = "number5";
34 | public static String mName = "Name";
35 | public static String mMsg = "msg";
36 |
37 | // Declares Global variables for getting extras from Intent and later use
38 |
39 | public String Number1;
40 | public String Number2;
41 | public String Number3;
42 | public String Number4;
43 | public String Number5;
44 | public String userName;
45 | public String customMsg;
46 |
47 | // Declares global variables for loading data from Shared Pref
48 |
49 | public String numLoaded1;
50 | public String numLoaded2;
51 | public String numLoaded3;
52 | public String numLoaded4;
53 | public String numLoaded5;
54 | public String loadedUserName;
55 | public String loadedCustomMsg;
56 |
57 | public String Lat, Lon, msgBody, closest;
58 | final int REQUEST_CODE = 123;
59 | LocationManager mLocationManager;
60 | LocationListener mLocationListner;
61 |
62 | public float distance=0;
63 | public double distanceFlag = 1000000000;
64 | public double latFlag = 0;
65 | public String station = "NotWorking... chill man";
66 |
67 |
68 | protected void onCreate(Bundle savedInstanceState) {
69 | super.onCreate(savedInstanceState);
70 | setContentView(R.layout.activity_main);
71 |
72 | getUserLocation();
73 |
74 | // Gets the numbers from contactsActivity and saved it in variables
75 |
76 | Number1 = getIntent().getStringExtra("Contact1");
77 | Number2 = getIntent().getStringExtra("Contact2");
78 | Number3 = getIntent().getStringExtra("Contact3");
79 | Number4 = getIntent().getStringExtra("Contact4");
80 | Number5 = getIntent().getStringExtra("Contact5");
81 |
82 | userName = getIntent().getStringExtra("name");
83 | customMsg = getIntent().getStringExtra("msg");
84 |
85 | ImageButton settingsBtn = findViewById(R.id.settingsBtn);
86 |
87 | settingsBtn.setOnClickListener(new View.OnClickListener() {
88 | @Override
89 | public void onClick(View v) {
90 |
91 | Intent myIntent = new Intent(MainActivity.this, SettingsActivity.class);
92 | startActivity(myIntent);
93 |
94 | }
95 | });
96 | String checkButtonPress = "saveButtonPressed";
97 | String testValue = getIntent().getStringExtra("activityLogger");
98 |
99 | if (checkButtonPress.equals(testValue)) {
100 |
101 | SaveData();
102 | LoadData();
103 | } else {
104 |
105 | LoadData();
106 | }
107 |
108 |
109 | ImageButton ContactsBtn = findViewById(R.id.ContactsBtn);
110 |
111 | ContactsBtn.setOnClickListener(new View.OnClickListener() {
112 | @Override
113 | public void onClick(View v) {
114 |
115 | Intent contactsActivity = new Intent(MainActivity.this, contactsActivity.class);
116 |
117 | startActivity(contactsActivity);
118 | }
119 | });
120 |
121 |
122 | ImageButton testBtn = findViewById(R.id.testBtn);
123 |
124 | testBtn.setOnClickListener(new View.OnClickListener() {
125 | @Override
126 | public void onClick(View v) {
127 |
128 | Log.d("clima","Button Pressed");
129 |
130 | getUserLocation();
131 |
132 | TextView testView = findViewById(R.id.testView);
133 |
134 | String test = "https://www.google.com/maps/search/?api=1&query="+Lat+","+Lon;
135 |
136 | msgBody = "I am in Danger. Help me !! My Current Location is \n " + test ;
137 |
138 | testView.setText(closest);
139 |
140 | SmsManager mSmsManager = SmsManager.getDefault();
141 | mSmsManager.sendTextMessage(numLoaded1, null, msgBody, null, null);
142 | mSmsManager.sendTextMessage(numLoaded2, null, msgBody, null, null);
143 | mSmsManager.sendTextMessage(numLoaded3, null, msgBody, null, null);
144 | mSmsManager.sendTextMessage(numLoaded4, null, msgBody, null, null);
145 | mSmsManager.sendTextMessage(numLoaded5, null, msgBody, null, null);
146 |
147 |
148 | }
149 | });
150 |
151 | }
152 |
153 | @Override
154 | protected void onResume() {
155 | super.onResume();
156 | getUserLocation();
157 | }
158 |
159 | private void getUserLocation() {
160 |
161 | Log.d("Clima", "GetUserLoc called");
162 |
163 | mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
164 |
165 | mLocationListner = new LocationListener() {
166 | @Override
167 | public void onLocationChanged(Location location) {
168 |
169 |
170 | Lat = String.valueOf(location.getLatitude());
171 | Lon = String.valueOf(location.getLongitude());
172 |
173 |
174 | Log.d("clima","locationChanged Called");
175 |
176 | Location newLocation=new Location("newlocation");
177 |
178 | Double latArray[] = {25.9160053, 25.9240504, 25.9688841, 26.1241434 , 25.7722621, 25.7476338,
179 | 25.812177, 25.6755823, 25.8529648, 25.5733804, 25.5352382, 25.8067002, 25.5413839, 25.964394,
180 | 26.1096252,25.6545445, 25.5882255, 25.577295, 26.332492, 26.1945975, 26.498407, 26.1187353,
181 | 26.0348237,26.0911915, 25.9015366, 25.8586636, 25.8344054, 25.9312534, 25.7847056, 26.0222387,
182 | 25.8987185, 26.1077924, 26.1539026, 25.3277546, 25.3913506, 25.5693544, 25.2806906, 25.1371294,
183 | 25.110119, 25.6361185, 25.6439975, 25.6326684, 25.6642177, 25.8602952, 25.8037607, 25.7874324,
184 | 25.9276161, 25.5413839, 25.3859332, 25.4196454, 25.284957, 24.8504995, 24.8430921, 25.0374692,
185 | 24.8884074, 24.6903606, 24.6795947, 24.6456764, 24.8193413, 24.874932, 24.8534974, 25.4196454,
186 | 25.0025167, 24.7805705, 24.7309483, 24.9526247, 25.1034425, 25.1897045, 25.0387793, 24.9655931,
187 | 25.066375, 24.4116431, 24.5067186, 24.3126069, 24.5020047, 24.3105928, 24.3688038, 24.1768496,
188 | 24.824784, 24.7418206, 25.0585756, 24.9198654, 24.83167, 24.7942284, 25.0484898, 25.1499645,
189 | 25.1281318, 25.0260128, 24.0088796, 24.1232136, 24.1115883, 24.2314537, 24.2170184, 23.9354616,
190 | 24.0815244, 24.0547793, 24.031901, 23.9139353, 24.4314699, 24.4664561, 24.5889782, 24.40945,
191 | 24.3641035, 24.5554032, 24.4462749, 24.2821396, 24.1974796, 24.4576437, 24.3018661, 24.6682689,
192 | 24.5073459, 24.1759499, 24.4269792, 24.3134294, 24.2241393, 24.7635541, 24.7644757, 24.6333128,
193 | 24.3297693, 24.5815747, 24.7551119, 24.6842217, 24.9535867, 25.1205283, 25.0899039, 24.7713412,
194 | 24.4005021, 24.8620637, 24.9385808, 24.9797902, 24.7702015, 25.1641638, 25.0785053, 24.9127068,
195 | 25.1756727, 24.8859773, 24.9379939, 25.1207105, 24.6630096, 24.8981843, 24.8129262, 25.076718,
196 | 24.8744137, 24.7179773, 24.6890381, 25.0166418, 25.1867203, 24.9678999, 25.0843041, 25.1501818,
197 | 23.840214, 23.9429034, 23.9146524, 23.7061594, 23.7554331, 23.6627037, 23.6150708, 23.8173703,
198 | 23.826194, 23.8594169, 23.7487161, 23.804399, 23.7760672, 23.8502248, 23.8669515, 23.7253484,
199 | 23.7372048, 23.7161249, 23.7613148, 23.8054324, 23.78996, 23.8281543, 23.7287932, 23.7456764,
200 | 23.7393123, 23.6972282};
201 |
202 |
203 | Double lonArray[] = {89.4470094, 89.3434971, 89.2028088, 89.1388761, 89.4129509, 89.2479213,
204 | 89.0921118, 89.0533787,89.2164825, 89.2714476, 89.3012621, 89.6347404, 89.8412904, 89.6874508,
205 | 89.6690624,89.6156556,89.6603213,89.8306695, 88.5521248, 88.5547346, 88.33592,88.7538782,
206 | 88.4600761,88.2752511, 88.2505506, 88.3575224, 88.1201577, 88.8548148, 88.8928377, 89.014323,
207 | 89.0180647, 88.8157069, 88.9192904, 89.5385688, 89.4638046, 89.5189565, 89.3518039, 89.3836046,
208 | 89.5821028, 88.6365913, 88.7743994, 88.5470133, 88.9039233, 88.6533192, 88.4558267, 88.5999352,
209 | 88.7256134, 89.8412904, 88.9919616, 89.0749438, 89.0146452, 89.3706005, 88.4588718, 89.4994515,
210 | 89.5672282, 89.53003, 89.411974, 89.2473453, 89.0360892, 89.1786646, 89.1896616, 89.0748739,
211 | 89.3202814, 88.2756364, 88.4211445, 88.1940552, 89.0205538, 89.0159378, 89.1174544, 89.0185555,
212 | 89.1600796, 88.9912279, 89.1405988, 88.9454841, 88.954998, 89.1585266, 89.231309, 88.9591795,
213 | 88.9273006, 88.9648765, 88.8030117, 88.7447465, 88.5703343, 88.6991193, 88.7480917, 88.8515022,
214 | 88.5857999, 88.4545353, 89.2378781, 89.0630508, 89.2394308, 89.2849204, 89.3749876, 89.4088022,
215 | 89.629316, 89.545381, 89.4105094, 89.6276437, 88.6096473, 88.3163278, 88.5747408, 88.5689769,
216 | 88.8290458, 88.8044711, 88.7614843, 88.7449568, 88.8332672, 89.6984982, 89.6947968, 89.6420503,
217 | 89.5229812, 89.597477, 89.3683666, 89.5683374, 89.6947663, 90.3961454, 90.2550834, 90.2689451,
218 | 90.5808156, 90.3911156, 90.570537, 90.5905246, 90.3600259, 90.3381756, 90.5168707, 90.2564854,
219 | 90.3848778, 90.4242275, 89.9341464, 89.8277512, 89.8405158, 89.7627304, 89.7920001, 89.7240758,
220 | 89.864825, 90.727916, 90.5963248, 90.6732344, 90.8403535, 90.885994, 90.8554597, 90.8843068,
221 | 90.979398, 90.9586429, 91.1367017, 89.9731827, 90.0629338, 90.1765768, 90.1918517, 89.9349591,
222 | 90.2452933, 90.2692914, 90.2142174, 90.3956818, 90.3616677, 90.1601078, 90.117234, 90.3579079,
223 | 90.3642612, 90.4246243, 90.390574, 90.3608405, 90.3746825, 90.4069169, 90.3983084, 90.492466,
224 | 90.3960917, 90.3821638, 90.4414769, 90.3466863, 90.3996907, 90.4174607, 90.431208, 90.4024061,
225 | 90.4234647, 90.4555571};
226 |
227 |
228 | int length = latArray.length;
229 |
230 | for(int l = 0; l < length; l++){
231 |
232 | newLocation.setLatitude(latArray[l]);
233 | newLocation.setLongitude(lonArray[l]);
234 |
235 |
236 | Location crntLocation=new Location("crntlocation");
237 | crntLocation.setLongitude(location.getLongitude());
238 | crntLocation.setLatitude(location.getLatitude());
239 |
240 | distance = crntLocation.distanceTo(newLocation);
241 |
242 | if(distance <= distanceFlag){
243 |
244 | latFlag = latArray[l];
245 |
246 | distanceFlag = distance;
247 |
248 | }
249 |
250 | }
251 |
252 | if(latFlag == 25.9160053 ){
253 |
254 | station = "Sadar, Lalmonirhat";
255 |
256 | } else if(latFlag == 25.9240504 ){
257 |
258 | station = "Aditmari";
259 |
260 | } else if ( latFlag == 25.9688841){
261 |
262 | station = "Kaliganj";
263 |
264 | } else if (latFlag == 26.1241434) {
265 |
266 | station = "Hatibandha";
267 |
268 | } else if( latFlag == 25.7722621){
269 |
270 | station = "Kauniya";
271 |
272 | } else if( latFlag == 25.7476338 ) {
273 |
274 | station = "Kotwali, Rangpur";
275 |
276 | } else if( latFlag == 25.812177) {
277 |
278 | station = "Taraganj";
279 |
280 | } else if (latFlag == 25.6755823 ){
281 |
282 | station = "Bodorganj";
283 |
284 | } else if(latFlag == 25.8529648) {
285 |
286 | station = "Gangachora";
287 |
288 | } else if(latFlag == 25.5733804) {
289 |
290 | station = "Mithapukur";
291 |
292 | } else if (latFlag == 25.5352382) {
293 |
294 | station = "Bamondanga";
295 |
296 | } else if (latFlag == 25.8067002){
297 |
298 | station = "Kurigram Sadar";
299 |
300 | } else if (latFlag == 25.5413839) {
301 |
302 | station = "Fulbari";
303 |
304 | } else if (latFlag == 25.964394) {
305 |
306 | station = "Nageshwari";
307 |
308 | } else if (latFlag == 26.1096252) {
309 |
310 | station = "Bhurungamari";
311 |
312 | } else if (latFlag == 25.6545445) {
313 |
314 | station = "Ulipur";
315 |
316 | } else if(latFlag == 25.5882255) {
317 |
318 | station = "Cilmari";
319 |
320 | } else if(latFlag == 25.577295) {
321 |
322 | station = "Roumari";
323 |
324 | }else if (latFlag == 26.332492) {
325 |
326 | station = "Panchagarh Sadar";
327 |
328 | } else if(latFlag == 26.1945975) {
329 |
330 | station = "Boda";
331 |
332 | } else if (latFlag == 26.498407) {
333 |
334 | station = "Tetulia";
335 |
336 | } else if(latFlag == 26.1187353) {
337 |
338 | station = "Debiganj";
339 |
340 | }else if(latFlag == 26.0348237) {
341 |
342 | station = "Thakurgaon";
343 |
344 | } else if (latFlag == 26.0911915) {
345 |
346 | station = "Baliadangi";
347 |
348 | } else if(latFlag == 25.9015366) {
349 |
350 | station = "Ranisankail";
351 |
352 | } else if (latFlag == 25.8586636) {
353 |
354 | station = "Pirganj";
355 |
356 | } else if (latFlag == 25.8344054) {
357 |
358 | station = "Haripur";
359 |
360 | } else if(latFlag == 25.9312534) {
361 |
362 | station = "Nilphamari Sadar";
363 |
364 | } else if (latFlag == 25.7847056) {
365 |
366 | station = "Saidpur";
367 |
368 | } else if ( latFlag == 26.0222387) {
369 |
370 | station = "Jaldhaka";
371 |
372 | } else if(latFlag == 25.8987185) {
373 |
374 | station = "Kishoreganj";
375 |
376 | } else if (latFlag == 26.1077924) {
377 |
378 | station = "Domar";
379 |
380 | } else if(latFlag == 26.1539026 ) {
381 |
382 | station = "Dimla";
383 | }else if(latFlag == 25.3277546) {
384 |
385 | station = "Gaibandha Sadar";
386 |
387 | } else if(latFlag == 25.3913506) {
388 |
389 | station = "Sadullahpur";
390 |
391 | } else if(latFlag == 25.5693544 ){
392 |
393 | station = "Sundarganj";
394 |
395 | } else if(latFlag == 25.2806906) {
396 |
397 | station = "Polashbari";
398 |
399 | } else if(latFlag == 25.1371294) {
400 |
401 | station = "Gabindoganj";
402 |
403 | } else if(latFlag == 25.110119) {
404 |
405 | station = "Shaghata";
406 |
407 | } else if (latFlag == 25.6361185) {
408 |
409 | station = "Dinajpur Sadar";
410 |
411 | } else if(latFlag == 25.6439975) {
412 |
413 | station = "Chirrirbandar";
414 |
415 | } else if (latFlag == 25.6326684) {
416 |
417 | station = "Birol";
418 |
419 | } else if(latFlag == 25.6642177) {
420 |
421 | station = "Parbotipur";
422 |
423 | } else if(latFlag == 25.8602952) {
424 |
425 | station = "Birganj";
426 |
427 | } else if(latFlag == 25.8037607) {
428 |
429 | station = "Bochaganj";
430 |
431 | } else if(latFlag == 25.7874324) {
432 |
433 | station = "Kaharole";
434 |
435 | } else if(latFlag == 25.9276161) {
436 |
437 | station = "Khansama";
438 |
439 | } else if(latFlag == 25.5413839) {
440 |
441 | station = "Fulbari";
442 |
443 | } else if(latFlag == 25.3859332) {
444 |
445 | station = "Birampur";
446 |
447 | } else if(latFlag == 25.4196454) {
448 |
449 | station = "Nawabganj";
450 |
451 | } else if(latFlag == 25.284957) {
452 |
453 | station = "Hakimpur";
454 |
455 | } else if(latFlag == 24.8504995) {
456 |
457 | station = "Bogra Sadar";
458 |
459 | }else if (latFlag == 24.8430921) {
460 |
461 | station = "Shibganj";
462 |
463 | } else if(latFlag == 25.0374692) {
464 |
465 | station = "Shonatola";
466 |
467 | } else if(latFlag == 24.8884074) {
468 |
469 | station = "Sariakandi";
470 |
471 | } else if(latFlag == 24.6903606) {
472 |
473 | station = "Dhunat";
474 |
475 | } else if (latFlag == 24.6795947) {
476 |
477 | station = "Sherpur";
478 |
479 | } else if (latFlag == 24.6456764) {
480 |
481 | station = "Nandigram";
482 |
483 | } else if (latFlag == 24.8193413) {
484 |
485 | station = "Adamdighi";
486 |
487 | } else if(latFlag == 24.874932) {
488 |
489 | station = "Dhupchanchia";
490 |
491 | } else if(latFlag == 24.8534974) {
492 |
493 | station = "Kahaloo";
494 |
495 | }else if(latFlag == 25.4196454) {
496 |
497 | station = "Nawabganj Sadar";
498 |
499 | } else if(latFlag == 25.0025167) {
500 |
501 | station = "Shibganj";
502 |
503 | } else if(latFlag == 24.7805705) {
504 |
505 | station ="Gomastapur";
506 |
507 | } else if(latFlag == 24.7309483) {
508 |
509 | station = "Nachole";
510 |
511 | } else if(latFlag == 24.9526247) {
512 |
513 | station = "Bholahat";
514 |
515 | } else if(latFlag == 25.1034425) {
516 |
517 | station = "Joypurhat Sadar";
518 |
519 | } else if(latFlag == 25.1897045) {
520 |
521 | station = "Panchbibi";
522 |
523 | } else if(latFlag == 25.0387793) {
524 |
525 | station = "Khetlal";
526 |
527 | } else if(latFlag == 24.9655931) {
528 |
529 | station = "Akkelpur";
530 |
531 | } else if(latFlag == 25.066375) {
532 |
533 | station = "Kalai";
534 |
535 | } else if(latFlag == 24.4116431) {
536 |
537 | station = "Natore Sadar";
538 |
539 | } else if(latFlag == 24.5067186) {
540 |
541 | station = "Singra";
542 |
543 | } else if(latFlag == 24.3126069) {
544 |
545 | station = "Baghatipara";
546 |
547 | } else if(latFlag == 24.5020047) {
548 |
549 | station = "Naldanga";
550 |
551 | } else if(latFlag == 24.3105928) {
552 |
553 | station = "Boraigram";
554 |
555 | } else if(latFlag == 24.3688038) {
556 |
557 | station = "Gurudashpur";
558 |
559 | } else if(latFlag == 24.1768496) {
560 |
561 | station = "Lalpur";
562 |
563 | } else if(latFlag == 24.824784) {
564 |
565 | station = "Naogaon Sadar";
566 |
567 | } else if(latFlag == 24.7418206) {
568 |
569 | station = "Raninagar";
570 |
571 | } else if(latFlag == 25.0585756) {
572 |
573 | station = "Badargachhi";
574 |
575 | } else if(latFlag == 24.9198654) {
576 |
577 | station = "Mohadevpur";
578 |
579 | } else if(latFlag == 24.83167) {
580 |
581 | station = "Niamatpur";
582 |
583 | } else if(latFlag == 24.7942284) {
584 |
585 | station = "Manda";
586 |
587 | } else if(latFlag == 25.0484898) {
588 |
589 | station = "Patnitola";
590 |
591 | } else if(latFlag == 25.1499645) {
592 |
593 | station = "Dhamoirhat";
594 |
595 | } else if(latFlag == 25.1281318) {
596 |
597 | station = "Sapahar";
598 |
599 | } else if(latFlag == 25.0260128 ){
600 |
601 | station = "Porsha";
602 |
603 | } else if(latFlag == 24.0088796) {
604 |
605 | station = "Pabna Sadar";
606 |
607 | } else if(latFlag == 24.1232136) {
608 |
609 | station = "Ishwardi";
610 |
611 | } else if(latFlag == 24.1115883) {
612 |
613 | station = "Atgraria";
614 |
615 | } else if(latFlag == 24.2314537) {
616 |
617 | station = "Chatmohar";
618 |
619 | } else if(latFlag == 24.2170184) {
620 |
621 | station = "Bhangura";
622 |
623 | } else if(latFlag == 23.9354616) {
624 |
625 | station = "Sujanagar";
626 |
627 | } else if(latFlag == 24.0815244) {
628 |
629 | station = "Bera";
630 |
631 | } else if(latFlag == 24.0547793) {
632 |
633 | station = "Sathia";
634 |
635 | } else if(latFlag == 24.031901){
636 |
637 | station = "Ateikula";
638 |
639 | } else if(latFlag == 23.9139353) {
640 |
641 | station = "Aminpur";
642 |
643 | } else if(latFlag == 24.4314699) {
644 |
645 | station = "Paba";
646 |
647 | } else if(latFlag == 24.4664561 ){
648 |
649 | station = "Godagari";
650 |
651 | } else if(latFlag == 24.5889782) {
652 |
653 | station = "Tanore";
654 |
655 | } else if(latFlag == 24.40945) {
656 |
657 | station = "Rajhshahi Police Lines";
658 |
659 | } else if(latFlag == 24.3641035) {
660 |
661 | station = "Puthia";
662 |
663 | } else if(latFlag == 24.5554032) {
664 |
665 | station = "Baghmara";
666 |
667 | } else if(latFlag == 24.4462749) {
668 |
669 | station = "Durgapur";
670 |
671 | } else if(latFlag == 24.2821396){
672 |
673 | station = "Charghat";
674 |
675 | }else if(latFlag == 24.1974796) {
676 |
677 | station = "Bagha";
678 |
679 | } else if(latFlag == 24.4576437) {
680 |
681 | station = "Sirajganj Sadar";
682 |
683 | } else if(latFlag == 24.3018661) {
684 |
685 | station = "Belkuchi";
686 |
687 | } else if(latFlag == 24.6682689) {
688 |
689 | station = "Kazipur";
690 |
691 | } else if(latFlag == 24.5073459) {
692 |
693 | station = "Raiganj";
694 |
695 | } else if(latFlag == 24.1759499) {
696 |
697 | station = "Shahzadpur";
698 |
699 | } else if(latFlag == 24.4269792) {
700 |
701 | station = "Tarash";
702 |
703 | } else if(latFlag == 24.3134294) {
704 |
705 | station = "Ullapara";
706 |
707 | } else if(latFlag == 24.2241393) {
708 |
709 | station = "Enayetpur";
710 |
711 | } else if(latFlag == 24.7635541) {
712 |
713 | station = "Mymensingh Sadar";
714 |
715 | } else if(latFlag == 24.7644757) {
716 |
717 | station = "Muktagacha";
718 |
719 | } else if(latFlag == 24.6333128) {
720 |
721 | station = "Fulbaria";
722 |
723 | } else if(latFlag == 24.3297693) {
724 |
725 | station = "Pagla";
726 |
727 | } else if(latFlag == 24.5815747) {
728 |
729 | station = "Trishal";
730 |
731 | } else if(latFlag == 24.7551119) {
732 |
733 | station = "Gouripur";
734 |
735 | } else if(latFlag == 24.6842217) {
736 |
737 | station = "Ishwarganj";
738 |
739 | } else if(latFlag == 24.9535867) {
740 |
741 | station = "Phulpur";
742 |
743 | } else if(latFlag == 25.1205283) {
744 |
745 | station = "Haluaghat";
746 |
747 | } else if(latFlag == 25.0899039) {
748 |
749 | station = "Dhobaura";
750 |
751 | } else if(latFlag == 24.7713412) {
752 |
753 | station = "Gafargaon";
754 |
755 | } else if(latFlag == 24.4005021) {
756 |
757 | station = "Bhaluka";
758 |
759 | } else if(latFlag == 24.8620637) {
760 |
761 | station = "Tarakanda";
762 |
763 | } else if (latFlag == 24.9385808) {
764 |
765 | station = "Jamalpur Sadar";
766 |
767 | } else if(latFlag == 24.9797902) {
768 |
769 | station = "Melandaha";
770 |
771 | } else if(latFlag == 24.7702015) {
772 |
773 | station = "Sarishabari";
774 |
775 | } else if(latFlag == 25.1641638) {
776 |
777 | station = "Dewanganj";
778 |
779 | } else if(latFlag == 25.0785053) {
780 |
781 | station = "Islampur";
782 |
783 | } else if(latFlag == 24.9127068) {
784 |
785 | station = "Madarganj";
786 |
787 | } else if(latFlag == 25.1756727) {
788 |
789 | station = "Bakshiganj";
790 |
791 | } else if(latFlag == 24.8859773) {
792 |
793 | station = "Netrokona Sadar";
794 |
795 | } else if(latFlag == 24.9379939) {
796 |
797 | station = "Purbodhola";
798 |
799 | } else if(latFlag == 25.1207105) {
800 |
801 | station = "Durgapur";
802 |
803 | } else if(latFlag == 24.6630096) {
804 |
805 | station = "Kendua";
806 |
807 | } else if(latFlag == 24.8981843) {
808 |
809 | station = "Barhatta";
810 |
811 | } else if(latFlag == 24.8129262) {
812 |
813 | station = "Atpara";
814 |
815 | } else if(latFlag == 25.076718) {
816 |
817 | station = "Kalmakanda";
818 |
819 | } else if(latFlag == 24.8744137) {
820 |
821 | station = "Mohanganj";
822 |
823 | } else if(latFlag == 24.7179773) {
824 |
825 | station = "Modon";
826 |
827 | } else if(latFlag == 24.6890381) {
828 |
829 | station = "Khaliajuri";
830 |
831 | } else if(latFlag == 25.0166418){
832 |
833 | station = "Sherpur Sadar";
834 |
835 | } else if(latFlag == 25.1867203) {
836 |
837 | station = "Jhenaigati";
838 |
839 | } else if(latFlag == 24.9678999) {
840 |
841 | station = "Nakla";
842 |
843 | } else if(latFlag == 25.0843041) {
844 |
845 | station = "Nalitabari";
846 |
847 | } else if(latFlag == 25.1501818) {
848 |
849 | station = "Sreebordi";
850 |
851 | } else if(latFlag == 23.840214) {
852 |
853 | station = "Savar";
854 |
855 | } else if(latFlag == 23.9429034 ){
856 |
857 | station = "Ashulia";
858 |
859 | } else if(latFlag == 23.9146524) {
860 |
861 | station = "Dhamrai";
862 |
863 | } else if(latFlag == 23.7061594) {
864 |
865 | station = "Keraniganj";
866 |
867 | } else if(latFlag == 23.7554331) {
868 |
869 | station = "Mohammadpur";
870 |
871 | } else if(latFlag == 23.6627037) {
872 |
873 | station = "Nawabganj";
874 |
875 | } else if(latFlag == 23.6150708) {
876 |
877 | station = "Dohar";
878 |
879 | } else if(latFlag == 23.8173703) {
880 |
881 | station = "Rupnagor";
882 |
883 | } else if(latFlag == 23.826194) {
884 |
885 | station = "Pallabi";
886 |
887 | } else if(latFlag == 23.8594169) {
888 |
889 | station = "Dakshinkhan";
890 |
891 | } else if(latFlag == 23.7487161) {
892 |
893 | station = "Kalabagan";
894 |
895 | } else if(latFlag == 23.804399) {
896 |
897 | station = "Mirpur Model";
898 |
899 | } else if(latFlag == 23.7760672) {
900 |
901 | station = "Sher-E-Bangla Nagar";
902 |
903 | } else if(latFlag == 23.8502248) {
904 |
905 | station = "Airport Police Station";
906 |
907 | } else if(latFlag == 23.8669515) {
908 |
909 | station = "Uttara East";
910 |
911 | } else if(latFlag == 23.7253484) {
912 |
913 | station = "Demra";
914 |
915 | } else if(latFlag == 23.7372048) {
916 |
917 | station = "Shahbag";
918 |
919 | } else if(latFlag == 23.7161249) {
920 |
921 | station = "Lalbagh";
922 |
923 | } else if(latFlag == 23.7613148) {
924 |
925 | station = "Rampura";
926 |
927 | } else if(latFlag == 23.8054324) {
928 |
929 | station = "Shah Ali";
930 |
931 | } else if(latFlag == 23.78996) {
932 |
933 | station = "Banani";
934 |
935 | } else if(latFlag == 23.8281543) {
936 |
937 | station = "Khilkhet";
938 |
939 | } else if(latFlag == 23.7287932 ){
940 |
941 | station = "Mugda";
942 |
943 | } else if(latFlag == 23.7456764) {
944 |
945 | station = "Ramna Model";
946 |
947 | } else if(latFlag == 23.7393123) {
948 |
949 | station = "Shahjahanpur";
950 |
951 | } else if(latFlag == 23.6972282) {
952 |
953 | station = "Kodomtoli";
954 | }
955 |
956 |
957 | closest = "My closest police station is " + station;
958 |
959 | }
960 |
961 | @Override
962 | public void onStatusChanged(String provider, int status, Bundle extras) {
963 |
964 | }
965 |
966 | @Override
967 | public void onProviderEnabled(String provider) {
968 |
969 | }
970 |
971 | @Override
972 | public void onProviderDisabled(String provider) {
973 |
974 | }
975 | };
976 |
977 | if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.SEND_SMS) != PackageManager.PERMISSION_GRANTED) {
978 |
979 | ActivityCompat.requestPermissions(this, new String[] {
980 | Manifest.permission.ACCESS_FINE_LOCATION,
981 | Manifest.permission.ACCESS_COARSE_LOCATION,
982 | Manifest.permission.SEND_SMS
983 |
984 | }, REQUEST_CODE );
985 | return;
986 | }
987 | mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, mLocationListner);
988 | mLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, mLocationListner);
989 | }
990 |
991 | @Override
992 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
993 | super.onRequestPermissionsResult(requestCode, permissions, grantResults);
994 |
995 | if(requestCode == REQUEST_CODE){
996 |
997 | if(grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED){
998 |
999 | getUserLocation();
1000 | } else {
1001 |
1002 | Log.d("Clima", "Permission Denied");
1003 | }
1004 | }
1005 | }
1006 |
1007 | // Creates a method for saving Numbers in Shared Prefs
1008 | public void SaveData() {
1009 |
1010 | SharedPreferences mSharedPrefs = getSharedPreferences(MY_SHARED_PREF, MODE_PRIVATE);
1011 | SharedPreferences.Editor mEditor = mSharedPrefs.edit();
1012 |
1013 | mEditor.putString(mNumber1, Number1);
1014 | mEditor.putString(mNumber2, Number2);
1015 | mEditor.putString(mNumber3, Number3);
1016 | mEditor.putString(mNumber4, Number4);
1017 | mEditor.putString(mNumber5, Number5);
1018 | mEditor.putString(mName,userName);
1019 | mEditor.putString(mMsg,customMsg);
1020 |
1021 | mEditor.apply();
1022 | }
1023 |
1024 | // Creates a method for loading data from Shared Prefs
1025 |
1026 | public void LoadData() {
1027 |
1028 | SharedPreferences mSharedPrefs = getSharedPreferences(MY_SHARED_PREF, MODE_PRIVATE);
1029 |
1030 | numLoaded1 = mSharedPrefs.getString(mNumber1, null);
1031 | numLoaded2 = mSharedPrefs.getString(mNumber2, null);
1032 | numLoaded3 = mSharedPrefs.getString(mNumber3, null);
1033 | numLoaded4 = mSharedPrefs.getString(mNumber4, null);
1034 | numLoaded5 = mSharedPrefs.getString(mNumber5, null);
1035 |
1036 | loadedUserName = mSharedPrefs.getString(mName,null);
1037 | loadedCustomMsg = mSharedPrefs.getString(mMsg,null);
1038 |
1039 | }
1040 |
1041 |
1042 | }
1043 |
1044 |
--------------------------------------------------------------------------------