├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── ic_tracker-web.png
│ │ ├── res
│ │ │ ├── drawable
│ │ │ │ ├── aa.png
│ │ │ │ ├── aaa.png
│ │ │ │ ├── cap.png
│ │ │ │ ├── dd.jpg
│ │ │ │ ├── lgo.png
│ │ │ │ ├── s.jpeg
│ │ │ │ ├── signin.png
│ │ │ │ ├── signup.png
│ │ │ │ ├── background.jpg
│ │ │ │ ├── circle.xml
│ │ │ │ ├── ic_tracker.xml
│ │ │ │ └── ic_launcher_background.xml
│ │ │ ├── font
│ │ │ │ ├── bigjhon.otf
│ │ │ │ ├── slimjoe.otf
│ │ │ │ ├── zonaprobold.otf
│ │ │ │ └── zonaproextralight.otf
│ │ │ ├── drawable-v24
│ │ │ │ ├── signin.png
│ │ │ │ ├── signup.png
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_tracker.png
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_trackers.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_tracker_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_tracker.png
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_trackers.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_tracker_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_tracker.png
│ │ │ │ ├── ic_trackers.png
│ │ │ │ ├── ic_tracker_round.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_tracker.png
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_trackers.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_tracker_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_tracker.png
│ │ │ │ ├── ic_trackers.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_tracker_round.png
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_tracker.xml
│ │ │ │ ├── ic_tracker_round.xml
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── values
│ │ │ │ ├── colors.xml
│ │ │ │ ├── styles.xml
│ │ │ │ └── strings.xml
│ │ │ └── layout
│ │ │ │ ├── activity_anotheone.xml
│ │ │ │ ├── activity_splash.xml
│ │ │ │ ├── activity_home.xml
│ │ │ │ └── activity_signin.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── choicemartstore
│ │ │ │ └── computerzone
│ │ │ │ └── dtracker
│ │ │ │ ├── Splash.java
│ │ │ │ ├── Home.java
│ │ │ │ ├── signin.java
│ │ │ │ ├── NewTracker.java
│ │ │ │ ├── Anotheone.java
│ │ │ │ └── TrackerService.java
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── choicemartstore
│ │ │ └── computerzone
│ │ │ └── dtracker
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── choicemartstore
│ │ └── computerzone
│ │ └── dtracker
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── .idea
├── caches
│ ├── gradle_models.ser
│ └── build_file_checksums.ser
├── encodings.xml
├── modules.xml
├── runConfigurations.xml
├── gradle.xml
└── misc.xml
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .gitignore
├── README.md
├── gradle.properties
├── gradlew.bat
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/.idea/caches/gradle_models.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/.idea/caches/gradle_models.ser
--------------------------------------------------------------------------------
/app/src/main/ic_tracker-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/ic_tracker-web.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/aa.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/drawable/aa.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/aaa.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/drawable/aaa.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/drawable/cap.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/dd.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/drawable/dd.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/lgo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/drawable/lgo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/s.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/drawable/s.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/font/bigjhon.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/font/bigjhon.otf
--------------------------------------------------------------------------------
/app/src/main/res/font/slimjoe.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/font/slimjoe.otf
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/.idea/caches/build_file_checksums.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/.idea/caches/build_file_checksums.ser
--------------------------------------------------------------------------------
/app/src/main/res/drawable/signin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/drawable/signin.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/signup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/drawable/signup.png
--------------------------------------------------------------------------------
/app/src/main/res/font/zonaprobold.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/font/zonaprobold.otf
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/signin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/drawable-v24/signin.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/signup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/drawable-v24/signup.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/background.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/drawable/background.jpg
--------------------------------------------------------------------------------
/app/src/main/res/font/zonaproextralight.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/font/zonaproextralight.otf
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_tracker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/mipmap-hdpi/ic_tracker.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_tracker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/mipmap-mdpi/ic_tracker.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_trackers.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/mipmap-hdpi/ic_trackers.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_trackers.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/mipmap-mdpi/ic_trackers.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_tracker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/mipmap-xhdpi/ic_tracker.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_trackers.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/mipmap-xhdpi/ic_trackers.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_tracker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/mipmap-xxhdpi/ic_tracker.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_trackers.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/mipmap-xxhdpi/ic_trackers.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_tracker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_tracker.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_trackers.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_trackers.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_tracker_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/mipmap-hdpi/ic_tracker_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_tracker_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/mipmap-mdpi/ic_tracker_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_tracker_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/mipmap-xhdpi/ic_tracker_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/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/Raja0sama/Tracker-APP/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_tracker_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/mipmap-xxhdpi/ic_tracker_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_tracker_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Raja0sama/Tracker-APP/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_tracker_round.png
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 | /app/google-services.json
--------------------------------------------------------------------------------
/app/src/main/res/drawable/circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat May 19 10:42:13 PKT 2018
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.4-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_tracker.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_tracker_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/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/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #232B3E
4 | #01d08e
5 | #232B3E
6 | #ffffff
7 | #FF4081
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_anotheone.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/test/java/com/choicemartstore/computerzone/dtracker/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.choicemartstore.computerzone.dtracker;
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() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Tracker App
2 |
3 |
4 | This is Based on Java and it requires firebase.
5 | To Get it to work on your system as well, follow the instructions.
6 |
7 | - Clone the Project
8 | - Create a Firebase Account and enable Authentication for email and password.
9 | - Get your google_serivce.json file for android and add it to app folder of the App.
10 | - Run the App.
11 |
12 | ### To View the Results you need my flutter Display Tracker App.
13 |
14 | GitHub Repo : super-sami.com(Link Comming Soon)
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_tracker.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/java/com/choicemartstore/computerzone/dtracker/Splash.java:
--------------------------------------------------------------------------------
1 | package com.choicemartstore.computerzone.dtracker;
2 |
3 | import android.content.Intent;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 |
7 | import java.util.Timer;
8 | import java.util.TimerTask;
9 |
10 | public class Splash extends AppCompatActivity {
11 |
12 | @Override
13 | protected void onCreate(Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 | setContentView(R.layout.activity_splash);
16 | timer();
17 |
18 | }
19 | public void timer(){
20 | startActivity(new Intent(getApplicationContext(), signin.class));
21 | finish();
22 |
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/.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/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | DTracker
3 | Latitude
4 | Longitude
5 | Last location update time
6 |
7 | Start updates
8 | Stop updates
9 |
10 | The location settings on the device are not
11 | adequate to run this sample. Fix in Settings.
12 |
13 | Location permission is needed for core functionality
14 | Permission was denied, but is needed for core
15 | functionality.
16 | Settings
17 |
18 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/choicemartstore/computerzone/dtracker/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.choicemartstore.computerzone.dtracker;
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() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.choicemartstore.computerzone.dtracker", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
29 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'io.fabric'
3 |
4 | android {
5 | compileSdkVersion 26
6 | defaultConfig {
7 | applicationId "com.choicemartstore.computerzone.dtracker"
8 | minSdkVersion 16
9 | targetSdkVersion 26
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | implementation 'com.android.support:appcompat-v7:26.1.0'
24 | implementation 'com.android.support.constraint:constraint-layout:1.0.2'
25 | implementation 'com.google.firebase:firebase-database:12.0.1'
26 | implementation 'com.google.firebase:firebase-storage:12.0.1'
27 | implementation 'com.google.firebase:firebase-auth:12.0.1'
28 | compile 'de.hdodenhof:circleimageview:1.2.1'
29 | implementation 'com.google.android.gms:play-services-location:12.0.1'
30 | testImplementation 'junit:junit:4.12'
31 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
32 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
33 | implementation 'com.crashlytics.sdk.android:crashlytics:2.9.1'
34 | }
35 |
36 |
37 |
38 |
39 |
40 | apply plugin: 'com.google.gms.google-services'
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_splash.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
22 | >
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_home.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
20 |
21 |
35 |
36 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/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 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
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 Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/app/src/main/java/com/choicemartstore/computerzone/dtracker/Home.java:
--------------------------------------------------------------------------------
1 | package com.choicemartstore.computerzone.dtracker;
2 |
3 | import android.content.Intent;
4 | import android.content.pm.PackageManager;
5 | import android.location.LocationManager;
6 | import android.support.v4.app.ActivityCompat;
7 | import android.support.v4.content.ContextCompat;
8 | import android.support.v7.app.AppCompatActivity;
9 | import android.os.Bundle;
10 | import android.view.View;
11 | import android.widget.Button;
12 | import android.widget.Toast;
13 |
14 | import com.google.firebase.auth.FirebaseAuth;
15 |
16 | public class Home extends AppCompatActivity {
17 | private static final int PERMISSIONS_REQUEST = 1;
18 | Button signsout;
19 | @Override
20 | protected void onCreate(Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 | setContentView(R.layout.activity_home);
23 | signsout = (Button)findViewById(R.id.signouts);
24 | LocationManager lm = (LocationManager) getSystemService(LOCATION_SERVICE);
25 | if (!lm.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
26 | Toast.makeText(this, "Please enable location services", Toast.LENGTH_SHORT).show();
27 |
28 | }
29 |
30 | // Check location permission is granted - if it is, start
31 | // the service, otherwise request the permission
32 | int permission = ContextCompat.checkSelfPermission(this,
33 | android.Manifest.permission.ACCESS_FINE_LOCATION);
34 | if (permission == PackageManager.PERMISSION_GRANTED) {
35 | startTrackerService();
36 | } else {
37 | ActivityCompat.requestPermissions(this,
38 | new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION},
39 | PERMISSIONS_REQUEST);
40 | }
41 | signsout.setOnClickListener(new View.OnClickListener() {
42 | @Override
43 | public void onClick(View view) {
44 | Intent stopIntent = new Intent(Home.this, TrackerService.class);
45 | stopIntent.setAction("false");
46 | startService(stopIntent);
47 | FirebaseAuth.getInstance().signOut();
48 | startActivity(new Intent(Home.this,signin.class));
49 |
50 | }
51 | });
52 |
53 | }
54 |
55 | private void startTrackerService() {
56 | //start
57 | Intent startIntent = new Intent(this, TrackerService.class);
58 | startIntent.setAction("true");
59 | startService(startIntent);
60 | //stop
61 |
62 |
63 | // startService(new Intent(this, TrackerService.class));
64 |
65 | }
66 | @Override
67 | public void onRequestPermissionsResult(int requestCode, String[] permissions, int[]
68 | grantResults) {
69 | if (requestCode == PERMISSIONS_REQUEST && grantResults.length == 1
70 | && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
71 | // Start the service when the permission is granted
72 | startTrackerService();
73 | } else {
74 | }
75 | }
76 |
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/app/src/main/java/com/choicemartstore/computerzone/dtracker/signin.java:
--------------------------------------------------------------------------------
1 | package com.choicemartstore.computerzone.dtracker;
2 |
3 | import android.app.ProgressDialog;
4 | import android.content.Intent;
5 | import android.support.annotation.NonNull;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.os.Bundle;
8 | import android.util.Log;
9 | import android.view.View;
10 | import android.widget.EditText;
11 | import android.widget.ImageView;
12 | import android.widget.Toast;
13 |
14 | import com.google.android.gms.tasks.OnCompleteListener;
15 | import com.google.android.gms.tasks.Task;
16 | import com.google.firebase.auth.AuthResult;
17 | import com.google.firebase.auth.FirebaseAuth;
18 | import com.google.firebase.auth.FirebaseUser;
19 |
20 | public class signin extends AppCompatActivity {
21 | View log;
22 | private static final String TAG = signin.class.getSimpleName();
23 | private ProgressDialog dialog;
24 |
25 | EditText use,pw;
26 | private FirebaseAuth mAuth;
27 | @Override
28 | protected void onCreate(Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 | setContentView(R.layout.activity_signin);
31 | mAuth = FirebaseAuth.getInstance();
32 | log = (View)findViewById(R.id.signin);
33 | use = (EditText)findViewById(R.id.email);
34 | pw = (EditText)findViewById(R.id.pw);
35 |
36 | log.setOnClickListener(new View.OnClickListener() {
37 | @Override
38 | public void onClick(View view) {
39 | ProgressDialog pd = new ProgressDialog(signin.this);
40 | pd.setMessage("loading");
41 | pd.show();
42 | signinn();
43 |
44 | }
45 | });
46 |
47 |
48 |
49 | }
50 | @Override
51 | public void onStart() {
52 | super.onStart();
53 | // Check if user is signed in (non-null) and update UI accordingly.
54 | FirebaseUser currentUser = mAuth.getCurrentUser();
55 | if(mAuth.getCurrentUser() != null){
56 |
57 | // Finishing current Login Activity.
58 | finish();
59 |
60 | // Opening UserProfileActivity .
61 | Intent intent = new Intent(signin.this, Home.class);
62 | startActivity(intent);
63 | }
64 |
65 | }
66 | public void signinn(){
67 |
68 | String users = use.getText().toString();
69 | String paswords = pw.getText().toString();
70 | if(!users.isEmpty() && !paswords.isEmpty()){ mAuth.signInWithEmailAndPassword(users, paswords)
71 | .addOnCompleteListener(this, new OnCompleteListener() {
72 | @Override
73 | public void onComplete(@NonNull Task task) {
74 | if (task.isSuccessful()) {
75 | FirebaseUser user = mAuth.getCurrentUser();
76 | startActivity(new Intent(signin.this,Home.class));
77 | finish();
78 | } else {
79 | // If sign in fails, display a message to the user.
80 | Log.w(TAG, "signInWithEmail:failure", task.getException());
81 | Toast.makeText(signin.this, "Authentication failed.",
82 | Toast.LENGTH_SHORT).show();
83 |
84 | }
85 |
86 |
87 | }
88 | });
89 |
90 | }
91 | }
92 |
93 | }
94 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_signin.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
24 |
25 |
41 |
42 |
61 |
62 |
70 |
71 |
87 |
--------------------------------------------------------------------------------
/app/src/main/java/com/choicemartstore/computerzone/dtracker/NewTracker.java:
--------------------------------------------------------------------------------
1 | package com.choicemartstore.computerzone.dtracker;
2 |
3 | import android.app.PendingIntent;
4 | import android.app.Service;
5 | import android.content.BroadcastReceiver;
6 | import android.content.Context;
7 | import android.content.Intent;
8 | import android.content.IntentFilter;
9 | import android.content.pm.PackageManager;
10 | import android.location.Location;
11 | import android.net.Uri;
12 | import android.os.Bundle;
13 | import android.os.IBinder;
14 | import android.provider.Settings;
15 | import android.support.annotation.NonNull;
16 | import android.support.annotation.Nullable;
17 | import android.support.v4.app.ActivityCompat;
18 | import android.support.v4.app.NotificationCompat;
19 | import android.util.Log;
20 | import android.view.View;
21 | import android.widget.TextView;
22 | import android.widget.Toast;
23 |
24 | import com.google.android.gms.location.FusedLocationProviderClient;
25 | import com.google.android.gms.location.LocationServices;
26 | import com.google.android.gms.tasks.OnCompleteListener;
27 | import com.google.android.gms.tasks.Task;
28 |
29 | import java.util.Locale;
30 | import java.util.concurrent.Executor;
31 |
32 | public class NewTracker extends Service {
33 | protected Location mLastLocation;
34 |
35 | private String mLatitudeLabel;
36 | private String mLongitudeLabel;
37 |
38 | private FusedLocationProviderClient mFusedLocationClient;
39 |
40 | private static final String TAG = NewTracker.class.getSimpleName();
41 |
42 | private static final int REQUEST_PERMISSIONS_REQUEST_CODE = 34;
43 |
44 |
45 | private void buildNotification() {
46 | String stop = "stop";
47 | registerReceiver(stopReceiver, new IntentFilter(stop));
48 | PendingIntent broadcastIntent = PendingIntent.getBroadcast(
49 | this, 0, new Intent(stop), PendingIntent.FLAG_UPDATE_CURRENT);
50 | // Create the persistent notification
51 | NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
52 | .setContentTitle(getString(R.string.app_name))
53 | .setContentText("You are now being tracked by Choicemart")
54 | .setOngoing(true)
55 | .setContentIntent(broadcastIntent)
56 | .setSmallIcon(R.drawable.ic_tracker);
57 | startForeground(1, builder.build());
58 | }
59 |
60 | protected BroadcastReceiver stopReceiver = new BroadcastReceiver() {
61 | @Override
62 | public void onReceive(Context context, Intent intent) {
63 | Log.d(TAG, "received stop broadcast");
64 | // Stop the service when the notification is tapped
65 | unregisterReceiver(stopReceiver);
66 |
67 | }
68 | };
69 |
70 |
71 | @Override
72 | public void onCreate() {
73 | super.onCreate();
74 | mLatitudeLabel = "latitude";
75 | mLongitudeLabel = "longitude";
76 |
77 | mFusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
78 | getLastLocation();
79 | buildNotification();
80 |
81 | }
82 |
83 |
84 |
85 |
86 |
87 | private void getLastLocation() {
88 | if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
89 |
90 | return;
91 | }
92 | mFusedLocationClient.getLastLocation()
93 | .addOnCompleteListener((Executor) this, new OnCompleteListener() {
94 | @Override
95 | public void onComplete(@NonNull Task task) {
96 | if (task.isSuccessful() && task.getResult() != null) {
97 | mLastLocation = task.getResult();
98 | mLastLocation.getLongitude();
99 | Toast.makeText(NewTracker.this, ""+mLastLocation.toString()+mLastLocation.getLongitude(), Toast.LENGTH_SHORT).show();
100 |
101 |
102 | } else {
103 | Log.w(TAG, "getLastLocation:exception", task.getException());
104 |
105 | }
106 | }
107 | });
108 | }
109 |
110 | @Nullable
111 | @Override
112 | public IBinder onBind(Intent intent) {
113 | return null;
114 | }
115 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/choicemartstore/computerzone/dtracker/Anotheone.java:
--------------------------------------------------------------------------------
1 | package com.choicemartstore.computerzone.dtracker;
2 |
3 | import android.content.Intent;
4 | import android.content.pm.PackageManager;
5 | import android.net.Uri;
6 | import android.provider.Settings;
7 | import android.support.annotation.NonNull;
8 | import android.support.v4.app.ActivityCompat;
9 | import android.support.v7.app.AppCompatActivity;
10 | import android.os.Bundle;
11 | import android.util.Log;
12 | import android.view.View;
13 | import android.widget.Toast;
14 |
15 | public class Anotheone extends AppCompatActivity {
16 | private static final String TAG = NewTracker.class.getSimpleName();
17 |
18 | private static final int REQUEST_PERMISSIONS_REQUEST_CODE = 34;
19 | @Override
20 | protected void onCreate(Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 | setContentView(R.layout.activity_anotheone);
23 | }
24 |
25 | @Override
26 | protected void onStart() {
27 | super.onStart();
28 |
29 | if (!checkPermissions()) {
30 | requestPermissions();
31 | } else {
32 | startService(new Intent(Anotheone.this,NewTracker.class));
33 | }
34 | }
35 |
36 | private boolean checkPermissions() {
37 | int permissionState = ActivityCompat.checkSelfPermission(this, android.
38 | Manifest.permission.ACCESS_FINE_LOCATION);
39 | return permissionState == PackageManager.PERMISSION_GRANTED;
40 | }
41 |
42 |
43 | private void requestPermissions() {
44 | boolean shouldProvideRationale =
45 | ActivityCompat.shouldShowRequestPermissionRationale(this,android.
46 | Manifest.permission.ACCESS_FINE_LOCATION);
47 |
48 | // Provide an additional rationale to the user. This would happen if the user denied the
49 | // request previously, but didn't check the "Don't ask again" checkbox.
50 | if (shouldProvideRationale) {
51 | Log.i(TAG, "Displaying permission rationale to provide additional context.");
52 |
53 |
54 | // Request permission
55 | startLocationPermissionRequest();
56 |
57 |
58 | } else {
59 | Log.i(TAG, "Requesting permission");
60 | // Request permission. It's possible this can be auto answered if device policy
61 | // sets the permission in a given state or the user denied the permission
62 | // previously and checked "Never ask again".
63 | startLocationPermissionRequest();
64 | }
65 | }
66 | private void startLocationPermissionRequest() {
67 | ActivityCompat.requestPermissions(this,
68 | new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION},
69 | REQUEST_PERMISSIONS_REQUEST_CODE);
70 | }
71 |
72 | @Override
73 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
74 | @NonNull int[] grantResults) {
75 | Log.i(TAG, "onRequestPermissionResult");
76 | if (requestCode == REQUEST_PERMISSIONS_REQUEST_CODE) {
77 | if (grantResults.length <= 0) {
78 | // If user interaction was interrupted, the permission request is cancelled and you
79 | // receive empty arrays.
80 | Log.i(TAG, "User interaction was cancelled.");
81 | } else if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
82 | // Permission granted.
83 | startService(new Intent(Anotheone.this,NewTracker.class));
84 |
85 | } else {
86 | // Permission denied.
87 |
88 | // Notify the user via a SnackBar that they have rejected a core permission for the
89 | // app, which makes the Activity useless. In a real app, core permissions would
90 | // typically be best requested during a welcome-screen flow.
91 |
92 | // Additionally, it is important to remember that a permission might have been
93 | // rejected without asking the user for permission (device policy or "Never ask
94 | // again" prompts). Therefore, a user interface affordance is typically implemented
95 | // when permissions are denied. Otherwise, your app could appear unresponsive to
96 | // touches or interactions which have required permissions.
97 | Toast.makeText(this, "You Denied the Permissions now die", Toast.LENGTH_SHORT).show();
98 |
99 |
100 | }
101 | }
102 | }
103 |
104 | }
105 |
--------------------------------------------------------------------------------
/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 bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/app/src/main/java/com/choicemartstore/computerzone/dtracker/TrackerService.java:
--------------------------------------------------------------------------------
1 | package com.choicemartstore.computerzone.dtracker;
2 |
3 | import android.app.AlertDialog;
4 | import android.app.PendingIntent;
5 | import android.app.ProgressDialog;
6 | import android.app.Service;
7 | import android.content.BroadcastReceiver;
8 | import android.content.Context;
9 | import android.content.DialogInterface;
10 | import android.content.Intent;
11 | import android.content.IntentFilter;
12 | import android.content.pm.PackageManager;
13 | import android.hardware.Sensor;
14 | import android.hardware.SensorEvent;
15 | import android.hardware.SensorEventListener;
16 | import android.hardware.SensorManager;
17 | import android.location.Criteria;
18 | import android.location.Location;
19 | import android.location.LocationListener;
20 | import android.location.LocationManager;
21 | import android.os.Bundle;
22 | import android.os.IBinder;
23 | import android.service.carrier.CarrierMessagingService;
24 | import android.support.v4.app.ActivityCompat;
25 | import android.support.v4.app.NotificationCompat;
26 | import android.support.v4.content.ContextCompat;
27 | import android.util.Log;
28 | import android.widget.Toast;
29 |
30 | import com.google.android.gms.location.FusedLocationProviderClient;
31 | import com.google.android.gms.location.LocationCallback;
32 | import com.google.android.gms.location.LocationRequest;
33 | import com.google.android.gms.location.LocationResult;
34 | import com.google.android.gms.location.LocationServices;
35 | import com.google.android.gms.location.LocationSettingsResult;
36 | import com.google.firebase.auth.FirebaseAuth;
37 | import com.google.firebase.auth.FirebaseUser;
38 | import com.google.firebase.database.ChildEventListener;
39 | import com.google.firebase.database.DataSnapshot;
40 | import com.google.firebase.database.DatabaseError;
41 | import com.google.firebase.database.DatabaseReference;
42 | import com.google.firebase.database.FirebaseDatabase;
43 | import com.google.firebase.database.OnDisconnect;
44 | import com.google.firebase.database.ValueEventListener;
45 |
46 | import java.io.Console;
47 | import java.text.DateFormat;
48 | import java.util.Calendar;
49 | import java.util.Date;
50 | import java.util.HashMap;
51 | import java.util.List;
52 |
53 |
54 | public class TrackerService extends Service {
55 |
56 | private static final String TAG = TrackerService.class.getSimpleName();
57 | String id;
58 | String altitude;
59 | private SensorManager mSensorManager;
60 | List sensors;
61 | Sensor sensor;
62 | Location myLocation;
63 | double longitude;
64 | double latitude;
65 | LocationListener locationListener;
66 |
67 | @Override
68 | public IBinder onBind(Intent intent) {
69 | return null;
70 | }
71 |
72 | private FirebaseAuth mAuth;
73 |
74 | @Override
75 | public void onCreate() {
76 | super.onCreate();
77 | mAuth = FirebaseAuth.getInstance();
78 |
79 | //Calling Service Notification
80 | buildNotification();
81 | //Calling UserData
82 | readingid();
83 |
84 |
85 | }
86 |
87 |
88 | //Building Notification
89 | private void buildNotification() {
90 | String stop = "stop";
91 | registerReceiver(stopReceiver, new IntentFilter(stop));
92 | PendingIntent broadcastIntent = PendingIntent.getBroadcast(
93 | this, 0, new Intent(stop), PendingIntent.FLAG_UPDATE_CURRENT);
94 | // Create the persistent notification
95 | NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
96 | .setContentTitle(getString(R.string.app_name))
97 | .setContentText("You are now being tracked by Choicemart")
98 | .setOngoing(true)
99 | .setContentIntent(broadcastIntent)
100 | .setSmallIcon(R.drawable.ic_tracker);
101 | startForeground(1, builder.build());
102 | }
103 |
104 | protected BroadcastReceiver stopReceiver = new BroadcastReceiver() {
105 | @Override
106 | public void onReceive(Context context, Intent intent) {
107 | Log.d(TAG, "received stop broadcast");
108 | // Stop the service when the notification is tapped
109 | unregisterReceiver(stopReceiver);
110 | }
111 | };
112 |
113 | private void loginToFirebase() {
114 | // Functionality coming next step
115 | }
116 |
117 |
118 | //Requesting Location and submiting to Database every single miliseconds
119 | private void requestLocationUpdates(String trackid) {
120 |
121 | LocationRequest request = new LocationRequest();
122 | request.setInterval(1000);
123 | request.setFastestInterval(500);
124 | request.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
125 | FusedLocationProviderClient client = LocationServices.getFusedLocationProviderClient(this);
126 | final String path = "locations/" + trackid.toString();
127 | int permission = ContextCompat.checkSelfPermission(this,
128 | android.Manifest.permission.ACCESS_FINE_LOCATION);
129 | if (permission == PackageManager.PERMISSION_GRANTED) {
130 | // Request location updates and when an update is
131 | // received, store the location in Firebase
132 | client.requestLocationUpdates(request, new LocationCallback() {
133 | @Override
134 | public void onLocationResult(LocationResult locationResult) {
135 | DatabaseReference ref = FirebaseDatabase.getInstance().getReference(path);
136 | Location location = locationResult.getLastLocation();
137 | if (location != null) {
138 | Log.d(TAG, "location update " + location);
139 | ref.setValue(location);
140 | FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
141 | final String uid = user.getUid().toString();
142 | String paths = "users/" + uid + "/Status";
143 | FirebaseDatabase.getInstance().getReference(paths).setValue("Online");
144 | onUserdisconnectToInternet();
145 | // DatabaseReference refs = FirebaseDatabase.getInstance().getReference("users/" + uid + "/lastseen");
146 | // String currentDateTimeString = DateFormat.getDateTimeInstance().format(new Date());
147 | // refs.setValue(currentDateTimeString);
148 | }
149 | }
150 | }, null);
151 | }
152 |
153 | }
154 |
155 | //Reading Data of the users .
156 | public void readingid() {
157 |
158 | DatabaseReference ref = FirebaseDatabase.getInstance().getReference("users");
159 | ref.addChildEventListener(new ChildEventListener() {
160 | @Override
161 | public void onChildAdded(DataSnapshot dataSnapshot, String previousChildName) {
162 | String key = dataSnapshot.getKey();
163 | FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
164 | if (user != null) {
165 | final String uid = user.getUid().toString();
166 | if (key.equals(uid)) {
167 | HashMap value = (HashMap) dataSnapshot.getValue();
168 | String tracke = value.get("trackerid").toString();
169 | id = tracke;
170 | requestLocationUpdates(id);
171 | String status = value.get("Status").toString();
172 | final String path = "users/" + uid + "/Status";
173 | DatabaseReference ref = FirebaseDatabase.getInstance().getReference(path);
174 | ref.setValue("Online");
175 |
176 |
177 |
178 | }
179 |
180 | }
181 |
182 |
183 | }
184 |
185 | @Override
186 | public void onChildChanged(DataSnapshot dataSnapshot, String previousChildName) {
187 | String key = dataSnapshot.getKey();
188 | HashMap value = (HashMap) dataSnapshot.getValue();
189 | String tracke = value.get("trackerid").toString();
190 | // Toast.makeText(TrackerService.this, "hellow" + tracke, Toast.LENGTH_SHORT).show();
191 | }
192 |
193 | @Override
194 | public void onChildMoved(DataSnapshot dataSnapshot, String previousChildName) {
195 | }
196 |
197 | @Override
198 | public void onChildRemoved(DataSnapshot dataSnapshot) {
199 | }
200 |
201 | @Override
202 | public void onCancelled(DatabaseError error) {
203 | Log.d(TAG, "Failed to read value.", error.toException());
204 | }
205 | });
206 | }
207 |
208 | @Override
209 | public void onDestroy() {
210 |
211 | }
212 |
213 | public void onUserdisconnectToInternet() {
214 | Log.d("ClearFromRecentService", "Service Destroyed");
215 | FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
216 | if (user != null) {
217 | final String uid = user.getUid().toString();
218 | final String path = "users/" + uid + "/Status";
219 | FirebaseDatabase.getInstance().getReference(path).onDisconnect().setValue("Offline");
220 |
221 | }
222 |
223 | }
224 |
225 | @Override
226 | public int onStartCommand(Intent intent, int flags, int startId) {
227 | if (intent.getAction().equals("true")) {
228 | Log.i("as", "Received Start Foreground Intent ");
229 | // your start service code
230 | }
231 | else if (intent.getAction().equals( "false")) {
232 | Log.i("as", "Received Stop Foreground Intent");
233 | stopForeground(true);
234 | stopSelf();
235 | }
236 | return START_STICKY;
237 | }
238 | public void setuseronline() {
239 | FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
240 | if (user != null) {
241 | String uid = user.getUid().toString();
242 | String path = "users/" + uid + "/Status";
243 | FirebaseDatabase.getInstance().getReference(path).setValue("Online");
244 |
245 | }
246 |
247 | }
248 | }
--------------------------------------------------------------------------------