├── bin
├── classes.dex
├── resources.ap_
├── javasamples.apk
├── jarlist.cache
├── classes
│ └── com
│ │ └── example
│ │ ├── jadoo
│ │ ├── R.class
│ │ ├── R$id.class
│ │ ├── R$attr.class
│ │ ├── Contact.class
│ │ ├── R$layout.class
│ │ ├── R$string.class
│ │ ├── R$style.class
│ │ ├── BuildConfig.class
│ │ ├── R$drawable.class
│ │ ├── RemindTask.class
│ │ ├── gpstracker.class
│ │ ├── MainActivity$1.class
│ │ ├── MainActivity$2.class
│ │ ├── MainActivity.class
│ │ ├── gpstracker$1.class
│ │ ├── gpstracker$2.class
│ │ ├── DataBaseHandler.class
│ │ └── MainActivity$1$1.class
│ │ └── javasamples
│ │ ├── R.class
│ │ ├── R$id.class
│ │ ├── Contact.class
│ │ ├── R$attr.class
│ │ ├── R$layout.class
│ │ ├── R$string.class
│ │ ├── R$style.class
│ │ ├── R$drawable.class
│ │ ├── RemindTask.class
│ │ ├── gpstracker.class
│ │ ├── BuildConfig.class
│ │ ├── MainActivity.class
│ │ ├── gpstracker$1.class
│ │ ├── gpstracker$2.class
│ │ ├── DataBaseHandler.class
│ │ ├── MainActivity$1.class
│ │ └── MainActivity$2.class
├── res
│ └── crunch
│ │ ├── drawable-hdpi
│ │ └── ic_launcher.png
│ │ ├── drawable-mdpi
│ │ └── ic_launcher.png
│ │ ├── drawable-xhdpi
│ │ └── ic_launcher.png
│ │ └── drawable-xxhdpi
│ │ └── ic_launcher.png
├── dexedLibs
│ ├── annotations-b8609fec3cc8381777a1992f679832a5.jar
│ ├── android-support-v4-7ceb1892deadb6dbb062da81c8baea2b.jar
│ ├── android-support-v4-e1413b4076d123540b112dc7710813cd.jar
│ └── android-support-v4-f212c69ed5c2f3599633129582a674d6.jar
└── AndroidManifest.xml
├── res
├── values
│ ├── strings.xml
│ └── styles.xml
├── drawable-hdpi
│ ├── ic_launcher.png
│ └── img_compass.jpg
├── drawable-mdpi
│ └── ic_launcher.png
├── drawable-xhdpi
│ └── ic_launcher.png
├── drawable-xxhdpi
│ └── ic_launcher.png
├── values-v11
│ └── styles.xml
├── values-v14
│ └── styles.xml
└── layout
│ └── activity_main.xml
├── ic_launcher-web.png
├── libs
└── android-support-v4.jar
├── gen
└── com
│ └── example
│ ├── jadoo
│ ├── BuildConfig.java
│ └── R.java
│ └── javasamples
│ ├── BuildConfig.java
│ └── R.java
├── src
└── com
│ └── example
│ ├── jadoo
│ ├── RemindTask.java
│ ├── Contact.java
│ ├── gpstracker.java
│ ├── DataBaseHandler.java
│ └── MainActivity.java
│ └── javasamples
│ ├── RemindTask.java
│ ├── Contact.java
│ ├── gpstracker.java
│ ├── DataBaseHandler.java
│ └── MainActivity.java
├── project.properties
├── proguard-project.txt
└── AndroidManifest.xml
/bin/classes.dex:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes.dex
--------------------------------------------------------------------------------
/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | javasamples
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/bin/resources.ap_:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/resources.ap_
--------------------------------------------------------------------------------
/bin/javasamples.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/javasamples.apk
--------------------------------------------------------------------------------
/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/ic_launcher-web.png
--------------------------------------------------------------------------------
/bin/jarlist.cache:
--------------------------------------------------------------------------------
1 | # cache for current jar dependency. DO NOT EDIT.
2 | # format is
3 | # Encoding is UTF-8
4 |
--------------------------------------------------------------------------------
/libs/android-support-v4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/libs/android-support-v4.jar
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/img_compass.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/res/drawable-hdpi/img_compass.jpg
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/classes/com/example/jadoo/R.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/jadoo/R.class
--------------------------------------------------------------------------------
/bin/classes/com/example/jadoo/R$id.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/jadoo/R$id.class
--------------------------------------------------------------------------------
/bin/classes/com/example/jadoo/R$attr.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/jadoo/R$attr.class
--------------------------------------------------------------------------------
/bin/classes/com/example/jadoo/Contact.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/jadoo/Contact.class
--------------------------------------------------------------------------------
/bin/classes/com/example/jadoo/R$layout.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/jadoo/R$layout.class
--------------------------------------------------------------------------------
/bin/classes/com/example/jadoo/R$string.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/jadoo/R$string.class
--------------------------------------------------------------------------------
/bin/classes/com/example/jadoo/R$style.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/jadoo/R$style.class
--------------------------------------------------------------------------------
/bin/classes/com/example/javasamples/R.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/javasamples/R.class
--------------------------------------------------------------------------------
/bin/res/crunch/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/res/crunch/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/res/crunch/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/res/crunch/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/res/crunch/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/res/crunch/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/classes/com/example/jadoo/BuildConfig.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/jadoo/BuildConfig.class
--------------------------------------------------------------------------------
/bin/classes/com/example/jadoo/R$drawable.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/jadoo/R$drawable.class
--------------------------------------------------------------------------------
/bin/classes/com/example/jadoo/RemindTask.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/jadoo/RemindTask.class
--------------------------------------------------------------------------------
/bin/classes/com/example/jadoo/gpstracker.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/jadoo/gpstracker.class
--------------------------------------------------------------------------------
/bin/classes/com/example/javasamples/R$id.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/javasamples/R$id.class
--------------------------------------------------------------------------------
/bin/res/crunch/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/res/crunch/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/classes/com/example/jadoo/MainActivity$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/jadoo/MainActivity$1.class
--------------------------------------------------------------------------------
/bin/classes/com/example/jadoo/MainActivity$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/jadoo/MainActivity$2.class
--------------------------------------------------------------------------------
/bin/classes/com/example/jadoo/MainActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/jadoo/MainActivity.class
--------------------------------------------------------------------------------
/bin/classes/com/example/jadoo/gpstracker$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/jadoo/gpstracker$1.class
--------------------------------------------------------------------------------
/bin/classes/com/example/jadoo/gpstracker$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/jadoo/gpstracker$2.class
--------------------------------------------------------------------------------
/bin/classes/com/example/javasamples/Contact.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/javasamples/Contact.class
--------------------------------------------------------------------------------
/bin/classes/com/example/javasamples/R$attr.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/javasamples/R$attr.class
--------------------------------------------------------------------------------
/bin/classes/com/example/javasamples/R$layout.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/javasamples/R$layout.class
--------------------------------------------------------------------------------
/bin/classes/com/example/javasamples/R$string.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/javasamples/R$string.class
--------------------------------------------------------------------------------
/bin/classes/com/example/javasamples/R$style.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/javasamples/R$style.class
--------------------------------------------------------------------------------
/bin/classes/com/example/jadoo/DataBaseHandler.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/jadoo/DataBaseHandler.class
--------------------------------------------------------------------------------
/bin/classes/com/example/jadoo/MainActivity$1$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/jadoo/MainActivity$1$1.class
--------------------------------------------------------------------------------
/bin/classes/com/example/javasamples/R$drawable.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/javasamples/R$drawable.class
--------------------------------------------------------------------------------
/bin/classes/com/example/javasamples/RemindTask.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/javasamples/RemindTask.class
--------------------------------------------------------------------------------
/bin/classes/com/example/javasamples/gpstracker.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/javasamples/gpstracker.class
--------------------------------------------------------------------------------
/bin/classes/com/example/javasamples/BuildConfig.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/javasamples/BuildConfig.class
--------------------------------------------------------------------------------
/bin/classes/com/example/javasamples/MainActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/javasamples/MainActivity.class
--------------------------------------------------------------------------------
/bin/classes/com/example/javasamples/gpstracker$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/javasamples/gpstracker$1.class
--------------------------------------------------------------------------------
/bin/classes/com/example/javasamples/gpstracker$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/javasamples/gpstracker$2.class
--------------------------------------------------------------------------------
/bin/classes/com/example/javasamples/DataBaseHandler.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/javasamples/DataBaseHandler.class
--------------------------------------------------------------------------------
/bin/classes/com/example/javasamples/MainActivity$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/javasamples/MainActivity$1.class
--------------------------------------------------------------------------------
/bin/classes/com/example/javasamples/MainActivity$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/classes/com/example/javasamples/MainActivity$2.class
--------------------------------------------------------------------------------
/gen/com/example/jadoo/BuildConfig.java:
--------------------------------------------------------------------------------
1 | /** Automatically generated file. DO NOT MODIFY */
2 | package com.example.jadoo;
3 |
4 | public final class BuildConfig {
5 | public final static boolean DEBUG = true;
6 | }
--------------------------------------------------------------------------------
/bin/dexedLibs/annotations-b8609fec3cc8381777a1992f679832a5.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/dexedLibs/annotations-b8609fec3cc8381777a1992f679832a5.jar
--------------------------------------------------------------------------------
/gen/com/example/javasamples/BuildConfig.java:
--------------------------------------------------------------------------------
1 | /** Automatically generated file. DO NOT MODIFY */
2 | package com.example.javasamples;
3 |
4 | public final class BuildConfig {
5 | public final static boolean DEBUG = true;
6 | }
--------------------------------------------------------------------------------
/bin/dexedLibs/android-support-v4-7ceb1892deadb6dbb062da81c8baea2b.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/dexedLibs/android-support-v4-7ceb1892deadb6dbb062da81c8baea2b.jar
--------------------------------------------------------------------------------
/bin/dexedLibs/android-support-v4-e1413b4076d123540b112dc7710813cd.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/dexedLibs/android-support-v4-e1413b4076d123540b112dc7710813cd.jar
--------------------------------------------------------------------------------
/bin/dexedLibs/android-support-v4-f212c69ed5c2f3599633129582a674d6.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arpitjain099/Android-Accelerometer-Compass-GPS-sensors-data-logging/HEAD/bin/dexedLibs/android-support-v4-f212c69ed5c2f3599633129582a674d6.jar
--------------------------------------------------------------------------------
/src/com/example/jadoo/RemindTask.java:
--------------------------------------------------------------------------------
1 | package com.example.jadoo;
2 |
3 | import java.util.TimerTask;
4 |
5 | public class RemindTask extends TimerTask {
6 |
7 | @Override
8 | public void run() {
9 | // TODO Auto-generated method stub
10 |
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/src/com/example/javasamples/RemindTask.java:
--------------------------------------------------------------------------------
1 | package com.example.javasamples;
2 |
3 | import java.util.TimerTask;
4 |
5 | public class RemindTask extends TimerTask {
6 |
7 | @Override
8 | public void run() {
9 | // TODO Auto-generated method stub
10 |
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-14
15 |
--------------------------------------------------------------------------------
/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
21 |
22 |
27 |
28 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
29 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/bin/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
29 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/gen/com/example/jadoo/R.java:
--------------------------------------------------------------------------------
1 | /* AUTO-GENERATED FILE. DO NOT MODIFY.
2 | *
3 | * This class was automatically generated by the
4 | * aapt tool from the resource data it found. It
5 | * should not be modified by hand.
6 | */
7 |
8 | package com.example.jadoo;
9 |
10 | public final class R {
11 | public static final class attr {
12 | }
13 | public static final class drawable {
14 | public static final int ic_launcher=0x7f020000;
15 | public static final int img_compass=0x7f020001;
16 | }
17 | public static final class id {
18 | public static final int btnClose=0x7f060003;
19 | public static final int btnWriteSDFile=0x7f060002;
20 | public static final int duration=0x7f060001;
21 | public static final int widget28=0x7f060000;
22 | }
23 | public static final class layout {
24 | public static final int activity_main=0x7f030000;
25 | }
26 | public static final class string {
27 | public static final int app_name=0x7f040000;
28 | }
29 | public static final class style {
30 | /**
31 | Base application theme, dependent on API level. This theme is replaced
32 | by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
33 |
34 |
35 | Theme customizations available in newer API levels can go in
36 | res/values-vXX/styles.xml, while customizations related to
37 | backward-compatibility can go here.
38 |
39 |
40 | Base application theme for API 11+. This theme completely replaces
41 | AppBaseTheme from res/values/styles.xml on API 11+ devices.
42 |
43 | API 11 theme customizations can go here.
44 |
45 | Base application theme for API 14+. This theme completely replaces
46 | AppBaseTheme from BOTH res/values/styles.xml and
47 | res/values-v11/styles.xml on API 14+ devices.
48 |
49 | API 14 theme customizations can go here.
50 | */
51 | public static final int AppBaseTheme=0x7f050000;
52 | /** Application theme.
53 | All customizations that are NOT specific to a particular API-level can go here.
54 | */
55 | public static final int AppTheme=0x7f050001;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/gen/com/example/javasamples/R.java:
--------------------------------------------------------------------------------
1 | /* AUTO-GENERATED FILE. DO NOT MODIFY.
2 | *
3 | * This class was automatically generated by the
4 | * aapt tool from the resource data it found. It
5 | * should not be modified by hand.
6 | */
7 |
8 | package com.example.javasamples;
9 |
10 | public final class R {
11 | public static final class attr {
12 | }
13 | public static final class drawable {
14 | public static final int ic_launcher=0x7f020000;
15 | public static final int img_compass=0x7f020001;
16 | }
17 | public static final class id {
18 | public static final int btnClose=0x7f060003;
19 | public static final int btnWriteSDFile=0x7f060002;
20 | public static final int duration=0x7f060001;
21 | public static final int imageViewCompass=0x7f060005;
22 | public static final int tvHeading=0x7f060004;
23 | public static final int widget28=0x7f060000;
24 | }
25 | public static final class layout {
26 | public static final int activity_main=0x7f030000;
27 | }
28 | public static final class string {
29 | public static final int app_name=0x7f040000;
30 | }
31 | public static final class style {
32 | /**
33 | Base application theme, dependent on API level. This theme is replaced
34 | by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
35 |
36 |
37 | Theme customizations available in newer API levels can go in
38 | res/values-vXX/styles.xml, while customizations related to
39 | backward-compatibility can go here.
40 |
41 |
42 | Base application theme for API 11+. This theme completely replaces
43 | AppBaseTheme from res/values/styles.xml on API 11+ devices.
44 |
45 | API 11 theme customizations can go here.
46 |
47 | Base application theme for API 14+. This theme completely replaces
48 | AppBaseTheme from BOTH res/values/styles.xml and
49 | res/values-v11/styles.xml on API 14+ devices.
50 |
51 | API 14 theme customizations can go here.
52 | */
53 | public static final int AppBaseTheme=0x7f050000;
54 | /** Application theme.
55 | All customizations that are NOT specific to a particular API-level can go here.
56 | */
57 | public static final int AppTheme=0x7f050001;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/com/example/jadoo/Contact.java:
--------------------------------------------------------------------------------
1 | package com.example.jadoo;
2 | public class Contact {
3 |
4 | //private variables
5 | String timestamp;
6 | String latitude;
7 | String longitude;
8 | String Lastx;
9 | String Lasty;
10 | String Lastz;
11 | String degree;
12 | // Empty constructor
13 | public Contact(){
14 |
15 | }
16 | // constructor
17 | public Contact(String timestamp, String name, String longitude,String lastx,String lasty,String lastz,String degree){
18 | this.timestamp = timestamp;
19 | this.latitude = name;
20 | this.longitude = longitude;
21 | this.Lastx=lastx;
22 | this.Lasty=lasty;
23 | this.Lastz=lastz;
24 | this.degree=degree;
25 | }
26 |
27 | // constructor
28 | public Contact(String latitude, String longitude){
29 | this.latitude = latitude;
30 | this.longitude = longitude;
31 | }
32 | // getting ID
33 | public String getID(){
34 | return this.timestamp;
35 | }
36 |
37 | // setting id
38 | public void setID(String id){
39 | this.timestamp = id;
40 | }
41 |
42 | public String getLastx(){
43 | return this.Lastx;
44 | }
45 |
46 | public String getLasty(){
47 | return this.Lasty;
48 | }
49 | public String getLastz(){
50 | return this.Lastz;
51 | }
52 | public void setLastx(String lastx){
53 | this.Lastx = lastx;
54 | }
55 | public void setLasty(String lasty){
56 | this.Lasty = lasty;
57 | }
58 | public void setLastz(String lastz){
59 | this.Lastz = lastz;
60 | }
61 | public String getDegree(){
62 | return this.degree;
63 | }
64 | public void setDegree(String degree){
65 | this.degree = degree;
66 | }
67 |
68 | // getting name
69 | public String getName(){
70 | return this.latitude;
71 | }
72 |
73 | // setting name
74 | public void setName(String name){
75 | this.latitude = name;
76 | }
77 |
78 | // getting phone number
79 | public String getPhoneNumber(){
80 | return this.longitude;
81 | }
82 |
83 | // setting phone number
84 | public void setPhoneNumber(String phone_number){
85 | this.longitude = phone_number;
86 | }
87 | }
--------------------------------------------------------------------------------
/src/com/example/javasamples/Contact.java:
--------------------------------------------------------------------------------
1 | package com.example.javasamples;
2 | public class Contact {
3 |
4 | //private variables
5 | String timestamp;
6 | String latitude;
7 | String longitude;
8 | String Lastx;
9 | String Lasty;
10 | String Lastz;
11 | String degree;
12 | // Empty constructor
13 | public Contact(){
14 |
15 | }
16 | // constructor
17 | public Contact(String timestamp, String name, String longitude,String lastx,String lasty,String lastz,String degree){
18 | this.timestamp = timestamp;
19 | this.latitude = name;
20 | this.longitude = longitude;
21 | this.Lastx=lastx;
22 | this.Lasty=lasty;
23 | this.Lastz=lastz;
24 | this.degree=degree;
25 | }
26 |
27 | // constructor
28 | public Contact(String latitude, String longitude){
29 | this.latitude = latitude;
30 | this.longitude = longitude;
31 | }
32 | // getting ID
33 | public String getID(){
34 | return this.timestamp;
35 | }
36 |
37 | // setting id
38 | public void setID(String id){
39 | this.timestamp = id;
40 | }
41 |
42 | public String getLastx(){
43 | return this.Lastx;
44 | }
45 |
46 | public String getLasty(){
47 | return this.Lasty;
48 | }
49 | public String getLastz(){
50 | return this.Lastz;
51 | }
52 | public void setLastx(String lastx){
53 | this.Lastx = lastx;
54 | }
55 | public void setLasty(String lasty){
56 | this.Lasty = lasty;
57 | }
58 | public void setLastz(String lastz){
59 | this.Lastz = lastz;
60 | }
61 | public String getDegree(){
62 | return this.degree;
63 | }
64 | public void setDegree(String degree){
65 | this.degree = degree;
66 | }
67 |
68 | // getting name
69 | public String getName(){
70 | return this.latitude;
71 | }
72 |
73 | // setting name
74 | public void setName(String name){
75 | this.latitude = name;
76 | }
77 |
78 | // getting phone number
79 | public String getPhoneNumber(){
80 | return this.longitude;
81 | }
82 |
83 | // setting phone number
84 | public void setPhoneNumber(String phone_number){
85 | this.longitude = phone_number;
86 | }
87 | }
--------------------------------------------------------------------------------
/src/com/example/javasamples/gpstracker.java:
--------------------------------------------------------------------------------
1 | package com.example.javasamples;
2 | import android.content.Context;
3 | import android.location.Location;
4 | import android.location.LocationListener;
5 | import android.location.LocationManager;
6 | import android.os.Bundle;
7 | import android.os.IBinder;
8 | import android.util.Log;
9 | import android.provider.Settings;
10 | import android.content.DialogInterface;
11 | import android.content.Intent;
12 | import android.app.AlertDialog;
13 | import android.app.Service;
14 |
15 | public class gpstracker extends Service implements LocationListener{
16 | private final Context mcontext;
17 | boolean isGpsEnabled = false;
18 | boolean isNetworkEnabled= false;
19 | boolean canGetLocation= false;
20 | Location location;
21 | double latitude;
22 | double longitude;
23 | private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10;
24 | private static final long MIN_TIME_BW_UPDATES = 1000 * 60 * 1; // 1 minute
25 | protected LocationManager locationmanager;
26 | public gpstracker(Context context) {
27 | this.mcontext = context;
28 | getLocation();
29 | }
30 | public Location getLocation() {
31 | try {
32 | locationmanager = (LocationManager) mcontext
33 | .getSystemService(LOCATION_SERVICE);
34 |
35 | // getting GPS status
36 | isGpsEnabled = locationmanager
37 | .isProviderEnabled(LocationManager.GPS_PROVIDER);
38 |
39 | // getting network status
40 | isNetworkEnabled = locationmanager
41 | .isProviderEnabled(LocationManager.NETWORK_PROVIDER);
42 |
43 | if (!isGpsEnabled && !isNetworkEnabled) {
44 | // no network provider is enabled
45 | } else {
46 | this.canGetLocation = true;
47 | // First get location from Network Provider
48 | if (isNetworkEnabled) {
49 | locationmanager.requestLocationUpdates(
50 | LocationManager.NETWORK_PROVIDER,
51 | MIN_TIME_BW_UPDATES,
52 | MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
53 | Log.d("Network", "Network");
54 | if (locationmanager != null) {
55 | location = locationmanager
56 | .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
57 | if (location != null) {
58 | latitude = location.getLatitude();
59 | longitude = location.getLongitude();
60 | }
61 | }
62 | }
63 | // if GPS Enabled get lat/long using GPS Services
64 | if (isGpsEnabled) {
65 | if (location == null) {
66 | locationmanager.requestLocationUpdates(
67 | LocationManager.GPS_PROVIDER,
68 | MIN_TIME_BW_UPDATES,
69 | MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
70 | Log.d("GPS Enabled", "GPS Enabled");
71 | if (locationmanager != null) {
72 | location = locationmanager
73 | .getLastKnownLocation(LocationManager.GPS_PROVIDER);
74 | if (location != null) {
75 | latitude = location.getLatitude();
76 | longitude = location.getLongitude();
77 | }
78 | }
79 | }
80 | }
81 | }
82 |
83 | } catch (Exception e) {
84 | e.printStackTrace();
85 | }
86 |
87 | return location;
88 | }
89 | public void stopUsingGPS(){
90 | if(locationmanager != null){
91 | locationmanager.removeUpdates(gpstracker.this);
92 | }
93 | }
94 |
95 | /**
96 | * Function to get latitude
97 | * */
98 | public double getLatitude(){
99 | if(location != null){
100 | latitude = location.getLatitude();
101 | }
102 |
103 | // return latitude
104 | return latitude;
105 | }
106 |
107 | /**
108 | * Function to get longitude
109 | * */
110 | public double getLongitude(){
111 | if(location != null){
112 | longitude = location.getLongitude();
113 | }
114 |
115 | // return longitude
116 | return longitude;
117 | }
118 |
119 | /**
120 | * Function to check GPS/wifi enabled
121 | * @return boolean
122 | * */
123 | public boolean canGetLocation() {
124 | return this.canGetLocation;
125 | }
126 | public void showSettingsAlert(){
127 | AlertDialog.Builder alertDialog = new AlertDialog.Builder(mcontext);
128 |
129 | // Setting Dialog Title
130 | alertDialog.setTitle("GPS settings");
131 |
132 | // Setting Dialog Message
133 | alertDialog.setMessage("GPS is not enabled. Do you want to go to settings menu?");
134 |
135 | // On pressing Settings button
136 | alertDialog.setPositiveButton("Settings", new DialogInterface.OnClickListener() {
137 | public void onClick(DialogInterface dialog,int which) {
138 | Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
139 | mcontext.startActivity(intent);
140 | }
141 | });
142 |
143 | // on pressing cancel button
144 | alertDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
145 | public void onClick(DialogInterface dialog, int which) {
146 | dialog.cancel();
147 | }
148 | });
149 |
150 |
151 | // Showing Alert Message
152 | alertDialog.show();
153 | }
154 |
155 |
156 | @Override
157 | public void onLocationChanged(Location location) {
158 | }
159 |
160 | @Override
161 | public void onProviderDisabled(String provider) {
162 | }
163 |
164 | @Override
165 | public void onProviderEnabled(String provider) {
166 | }
167 |
168 | @Override
169 | public void onStatusChanged(String provider, int status, Bundle extras) {
170 | }
171 |
172 | @Override
173 | public IBinder onBind(Intent arg0) {
174 | return null;
175 | }
176 |
177 | }
178 |
179 |
180 |
--------------------------------------------------------------------------------
/src/com/example/jadoo/gpstracker.java:
--------------------------------------------------------------------------------
1 | package com.example.jadoo;
2 | import android.content.Context;
3 | import android.location.Location;
4 | import android.location.LocationListener;
5 | import android.location.LocationManager;
6 | import android.os.Bundle;
7 | import android.os.IBinder;
8 | import android.util.Log;
9 | import android.provider.Settings;
10 | import android.content.DialogInterface;
11 | import android.content.Intent;
12 | import android.app.AlertDialog;
13 | import android.app.Service;
14 |
15 | public class gpstracker extends Service implements LocationListener{
16 | private final Context mcontext;
17 | boolean isGpsEnabled = false;
18 | boolean isNetworkEnabled= false;
19 | boolean canGetLocation= false;
20 | Location location;
21 | double latitude;
22 | double longitude;
23 | private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 1;
24 | private static final long MIN_TIME_BW_UPDATES = 1; // 1 microsecond
25 | protected LocationManager locationmanager;
26 | public gpstracker(Context context) {
27 | this.mcontext = context;
28 | getLocation();
29 | }
30 | public Location getLocation() {
31 | try {
32 | locationmanager = (LocationManager) mcontext
33 | .getSystemService(LOCATION_SERVICE);
34 |
35 | // getting GPS status
36 | isGpsEnabled = locationmanager
37 | .isProviderEnabled(LocationManager.GPS_PROVIDER);
38 |
39 | // getting network status
40 | isNetworkEnabled = locationmanager
41 | .isProviderEnabled(LocationManager.NETWORK_PROVIDER);
42 |
43 | if (!isGpsEnabled && !isNetworkEnabled) {
44 | // no network provider is enabled
45 | } else {
46 | this.canGetLocation = true;
47 | // First get location from Network Provider
48 | if (isNetworkEnabled) {
49 | locationmanager.requestLocationUpdates(
50 | LocationManager.NETWORK_PROVIDER,
51 | MIN_TIME_BW_UPDATES,
52 | MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
53 | Log.d("Network", "Network");
54 | if (locationmanager != null) {
55 | location = locationmanager
56 | .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
57 | if (location != null) {
58 | latitude = location.getLatitude();
59 | longitude = location.getLongitude();
60 | }
61 | }
62 | }
63 | // if GPS Enabled get lat/long using GPS Services
64 | if (isGpsEnabled) {
65 | if (location == null) {
66 | locationmanager.requestLocationUpdates(
67 | LocationManager.GPS_PROVIDER,
68 | MIN_TIME_BW_UPDATES,
69 | MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
70 | Log.d("GPS Enabled", "GPS Enabled");
71 | if (locationmanager != null) {
72 | location = locationmanager
73 | .getLastKnownLocation(LocationManager.GPS_PROVIDER);
74 | if (location != null) {
75 | latitude = location.getLatitude();
76 | longitude = location.getLongitude();
77 | }
78 | }
79 | }
80 | }
81 | }
82 |
83 | } catch (Exception e) {
84 | e.printStackTrace();
85 | }
86 |
87 | return location;
88 | }
89 | public void stopUsingGPS(){
90 | if(locationmanager != null){
91 | locationmanager.removeUpdates(gpstracker.this);
92 | }
93 | }
94 |
95 | /**
96 | * Function to get latitude
97 | * */
98 | public double getLatitude(){
99 | if(location != null){
100 | latitude = location.getLatitude();
101 | }
102 |
103 | // return latitude
104 | return latitude;
105 | }
106 |
107 | /**
108 | * Function to get longitude
109 | * */
110 | public double getLongitude(){
111 | if(location != null){
112 | longitude = location.getLongitude();
113 | }
114 |
115 | // return longitude
116 | return longitude;
117 | }
118 |
119 | /**
120 | * Function to check GPS/wifi enabled
121 | * @return boolean
122 | * */
123 | public boolean canGetLocation() {
124 | return this.canGetLocation;
125 | }
126 | public void showSettingsAlert(){
127 | AlertDialog.Builder alertDialog = new AlertDialog.Builder(mcontext);
128 |
129 | // Setting Dialog Title
130 | alertDialog.setTitle("GPS settings");
131 |
132 | // Setting Dialog Message
133 | alertDialog.setMessage("GPS is not enabled. Do you want to go to settings menu?");
134 |
135 | // On pressing Settings button
136 | alertDialog.setPositiveButton("Settings", new DialogInterface.OnClickListener() {
137 | public void onClick(DialogInterface dialog,int which) {
138 | Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
139 | mcontext.startActivity(intent);
140 | }
141 | });
142 |
143 | // on pressing cancel button
144 | alertDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
145 | public void onClick(DialogInterface dialog, int which) {
146 | dialog.cancel();
147 | }
148 | });
149 |
150 |
151 | // Showing Alert Message
152 | alertDialog.show();
153 | }
154 |
155 |
156 | @Override
157 | public void onLocationChanged(Location location) {
158 | this.latitude=location.getLatitude();
159 | this.longitude = location.getLongitude();
160 | }
161 |
162 | @Override
163 | public void onProviderDisabled(String provider) {
164 | }
165 |
166 | @Override
167 | public void onProviderEnabled(String provider) {
168 | }
169 |
170 | @Override
171 | public void onStatusChanged(String provider, int status, Bundle extras) {
172 | }
173 |
174 | @Override
175 | public IBinder onBind(Intent arg0) {
176 | return null;
177 | }
178 |
179 | }
180 |
181 |
182 |
--------------------------------------------------------------------------------
/src/com/example/jadoo/DataBaseHandler.java:
--------------------------------------------------------------------------------
1 | package com.example.jadoo;
2 | import java.util.ArrayList;
3 | import java.util.List;
4 |
5 | import android.content.ContentValues;
6 | import android.content.Context;
7 | import android.database.Cursor;
8 | import android.database.sqlite.SQLiteDatabase;
9 | import android.database.sqlite.SQLiteOpenHelper;
10 |
11 | public class DataBaseHandler extends SQLiteOpenHelper {
12 |
13 | // All Static variables
14 | // Database Version
15 | private static final int DATABASE_VERSION = 1;
16 |
17 | // Database Name
18 | private static final String DATABASE_NAME = "contactsManager";
19 |
20 | // Contacts table name
21 | private static final String TABLE_CONTACTS = "contacts";
22 |
23 | // Contacts Table Columns names
24 | private static final String KEYtimestamp = "timestamp";
25 | private static final String KEY_NAME = "latitude";
26 | private static final String KEY_PH_NO = "longitude";
27 | private static final String KEY_lastx = "lastx";
28 | private static final String KEY_lasty = "lasty";
29 | private static final String KEY_lastz = "lastz";
30 | private static final String KEY_degree = "degree";
31 | public DataBaseHandler(Context context) {
32 | super(context, DATABASE_NAME, null, DATABASE_VERSION);
33 | }
34 |
35 | // Creating Tables
36 | @Override
37 | public void onCreate(SQLiteDatabase db) {
38 | db.execSQL("DROP TABLE IF EXISTS " + TABLE_CONTACTS);
39 | String CREATE_CONTACTS_TABLE = "CREATE TABLE " + TABLE_CONTACTS + "("
40 | + KEYtimestamp + " TEXT PRIMARY KEY," + KEY_NAME + " TEXT,"
41 | + KEY_PH_NO + " TEXT," + KEY_lastx +" TEXT," +KEY_lasty +" TEXT," + KEY_lastz + " TEXT," +KEY_degree +" TEXT" +")";
42 | db.execSQL(CREATE_CONTACTS_TABLE);
43 | }
44 |
45 | // Upgrading database
46 | @Override
47 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
48 | // Drop older table if existed
49 | db.execSQL("DROP TABLE IF EXISTS " + TABLE_CONTACTS);
50 |
51 | // Create tables again
52 | onCreate(db);
53 | }
54 |
55 | /**
56 | * All CRUD(Create, Read, Update, Delete) Operations
57 | */
58 |
59 | // Adding new contact
60 | void addContact(Contact contact) {
61 | SQLiteDatabase db = this.getWritableDatabase();
62 |
63 | ContentValues values = new ContentValues();
64 | values.put(KEY_NAME, contact.getName()); // Contact Name
65 | values.put(KEY_PH_NO, contact.getPhoneNumber()); // Contact Phone
66 | values.put(KEYtimestamp,contact.getID());
67 | values.put(KEY_lastx, contact.getLastx());
68 | values.put(KEY_lasty, contact.getLasty());
69 | values.put(KEY_lastz, contact.getLastz());
70 | values.put(KEY_degree, contact.getDegree());
71 | // Inserting Row
72 | db.insert(TABLE_CONTACTS, null, values);
73 | db.close(); // Closing database connection
74 | }
75 | /*
76 | // Getting single contact
77 | Contact getContact(int id) {
78 | SQLiteDatabase db = this.getReadableDatabase();
79 |
80 | Cursor cursor = db.query(TABLE_CONTACTS, new String[] { KEYtimestamp,
81 | KEY_NAME, KEY_PH_NO,KEY_lastx,KEY_lasty,KEY_lastz,KEY_degree }, KEYtimestamp + "=?",
82 | new String[] { String.valueOf(id) }, null, null, null);
83 | if (cursor != null)
84 | cursor.moveToFirst();
85 |
86 | Contact contact = new Contact(cursor.getString(0),
87 | cursor.getString(1), cursor.getString(2),cursor.getString(3),cursor.getString(4),cursor.getString(5),cursor.getString(6));
88 | // return contact
89 | return contact;
90 | }
91 | // Getting All Contacts
92 | public List getAllContacts() {
93 | List contactList = new ArrayList();
94 | // Select All Query
95 | String selectQuery = "SELECT * FROM " + TABLE_CONTACTS;
96 |
97 | SQLiteDatabase db = this.getWritableDatabase();
98 | Cursor cursor = db.rawQuery(selectQuery, null);
99 |
100 | // looping through all rows and adding to list
101 | if (cursor.moveToFirst()) {
102 | do {
103 | Contact contact = new Contact();
104 | contact.setID(cursor.getString(0));
105 | contact.setName(cursor.getString(1));
106 | contact.setPhoneNumber(cursor.getString(2));
107 | contact.setLastx(cursor.getString(3));
108 | contact.setLasty(cursor.getString(4));
109 | contact.setLastz(cursor.getString(5));
110 | contact.setDegree(cursor.getString(6));
111 | // Adding contact to list
112 | contactList.add(contact);
113 | } while (cursor.moveToNext());
114 | }
115 |
116 | // return contact list
117 | return contactList;
118 | }
119 |
120 | // Updating single contact
121 | public int updateContact(Contact contact) {
122 | SQLiteDatabase db = this.getWritableDatabase();
123 |
124 | ContentValues values = new ContentValues();
125 | values.put(KEY_NAME, contact.getName());
126 | values.put(KEY_PH_NO, contact.getPhoneNumber());
127 |
128 | // updating row
129 | return db.update(TABLE_CONTACTS, values, KEYtimestamp + " = ?",
130 | new String[] { String.valueOf(contact.getID()) });
131 | }
132 |
133 | // Deleting single contact
134 | public void deleteContact(Contact contact) {
135 | SQLiteDatabase db = this.getWritableDatabase();
136 | db.delete(TABLE_CONTACTS, KEYtimestamp + " = ?",
137 | new String[] { String.valueOf(contact.getID()) });
138 | db.close();
139 | }
140 |
141 |
142 | // Getting contacts Count
143 | public int getContactsCount() {
144 | String countQuery = "SELECT * FROM " + TABLE_CONTACTS;
145 | SQLiteDatabase db = this.getReadableDatabase();
146 | Cursor cursor = db.rawQuery(countQuery, null);
147 | cursor.close();
148 |
149 | // return count
150 | return cursor.getCount();
151 | }*/
152 |
153 | }
--------------------------------------------------------------------------------
/src/com/example/javasamples/DataBaseHandler.java:
--------------------------------------------------------------------------------
1 | package com.example.javasamples;
2 | import java.util.ArrayList;
3 | import java.util.List;
4 |
5 | import android.content.ContentValues;
6 | import android.content.Context;
7 | import android.database.Cursor;
8 | import android.database.sqlite.SQLiteDatabase;
9 | import android.database.sqlite.SQLiteOpenHelper;
10 |
11 | public class DataBaseHandler extends SQLiteOpenHelper {
12 |
13 | // All Static variables
14 | // Database Version
15 | private static final int DATABASE_VERSION = 1;
16 |
17 | // Database Name
18 | private static final String DATABASE_NAME = "contactsManager";
19 |
20 | // Contacts table name
21 | private static final String TABLE_CONTACTS = "contacts";
22 |
23 | // Contacts Table Columns names
24 | private static final String KEYtimestamp = "timestamp";
25 | private static final String KEY_NAME = "latitude";
26 | private static final String KEY_PH_NO = "longitude";
27 | private static final String KEY_lastx = "lastx";
28 | private static final String KEY_lasty = "lasty";
29 | private static final String KEY_lastz = "lastz";
30 | private static final String KEY_degree = "degree";
31 | public DataBaseHandler(Context context) {
32 | super(context, DATABASE_NAME, null, DATABASE_VERSION);
33 | }
34 |
35 | // Creating Tables
36 | @Override
37 | public void onCreate(SQLiteDatabase db) {
38 | db.execSQL("DROP TABLE IF EXISTS " + TABLE_CONTACTS);
39 | String CREATE_CONTACTS_TABLE = "CREATE TABLE " + TABLE_CONTACTS + "("
40 | + KEYtimestamp + " TEXT PRIMARY KEY," + KEY_NAME + " TEXT,"
41 | + KEY_PH_NO + " TEXT," + KEY_lastx +" TEXT," +KEY_lasty +" TEXT," + KEY_lastz + " TEXT," +KEY_degree +" TEXT" +")";
42 | db.execSQL(CREATE_CONTACTS_TABLE);
43 | }
44 |
45 | // Upgrading database
46 | @Override
47 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
48 | // Drop older table if existed
49 | db.execSQL("DROP TABLE IF EXISTS " + TABLE_CONTACTS);
50 |
51 | // Create tables again
52 | onCreate(db);
53 | }
54 |
55 | /**
56 | * All CRUD(Create, Read, Update, Delete) Operations
57 | */
58 |
59 | // Adding new contact
60 | void addContact(Contact contact) {
61 | SQLiteDatabase db = this.getWritableDatabase();
62 |
63 | ContentValues values = new ContentValues();
64 | values.put(KEY_NAME, contact.getName()); // Contact Name
65 | values.put(KEY_PH_NO, contact.getPhoneNumber()); // Contact Phone
66 | values.put(KEYtimestamp,contact.getID());
67 | values.put(KEY_lastx, contact.getLastx());
68 | values.put(KEY_lasty, contact.getLasty());
69 | values.put(KEY_lastz, contact.getLastz());
70 | values.put(KEY_degree, contact.getDegree());
71 | // Inserting Row
72 | db.insert(TABLE_CONTACTS, null, values);
73 | db.close(); // Closing database connection
74 | }
75 | /*
76 | // Getting single contact
77 | Contact getContact(int id) {
78 | SQLiteDatabase db = this.getReadableDatabase();
79 |
80 | Cursor cursor = db.query(TABLE_CONTACTS, new String[] { KEYtimestamp,
81 | KEY_NAME, KEY_PH_NO,KEY_lastx,KEY_lasty,KEY_lastz,KEY_degree }, KEYtimestamp + "=?",
82 | new String[] { String.valueOf(id) }, null, null, null);
83 | if (cursor != null)
84 | cursor.moveToFirst();
85 |
86 | Contact contact = new Contact(cursor.getString(0),
87 | cursor.getString(1), cursor.getString(2),cursor.getString(3),cursor.getString(4),cursor.getString(5),cursor.getString(6));
88 | // return contact
89 | return contact;
90 | }
91 | // Getting All Contacts
92 | public List getAllContacts() {
93 | List contactList = new ArrayList();
94 | // Select All Query
95 | String selectQuery = "SELECT * FROM " + TABLE_CONTACTS;
96 |
97 | SQLiteDatabase db = this.getWritableDatabase();
98 | Cursor cursor = db.rawQuery(selectQuery, null);
99 |
100 | // looping through all rows and adding to list
101 | if (cursor.moveToFirst()) {
102 | do {
103 | Contact contact = new Contact();
104 | contact.setID(cursor.getString(0));
105 | contact.setName(cursor.getString(1));
106 | contact.setPhoneNumber(cursor.getString(2));
107 | contact.setLastx(cursor.getString(3));
108 | contact.setLasty(cursor.getString(4));
109 | contact.setLastz(cursor.getString(5));
110 | contact.setDegree(cursor.getString(6));
111 | // Adding contact to list
112 | contactList.add(contact);
113 | } while (cursor.moveToNext());
114 | }
115 |
116 | // return contact list
117 | return contactList;
118 | }
119 |
120 | // Updating single contact
121 | public int updateContact(Contact contact) {
122 | SQLiteDatabase db = this.getWritableDatabase();
123 |
124 | ContentValues values = new ContentValues();
125 | values.put(KEY_NAME, contact.getName());
126 | values.put(KEY_PH_NO, contact.getPhoneNumber());
127 |
128 | // updating row
129 | return db.update(TABLE_CONTACTS, values, KEYtimestamp + " = ?",
130 | new String[] { String.valueOf(contact.getID()) });
131 | }
132 |
133 | // Deleting single contact
134 | public void deleteContact(Contact contact) {
135 | SQLiteDatabase db = this.getWritableDatabase();
136 | db.delete(TABLE_CONTACTS, KEYtimestamp + " = ?",
137 | new String[] { String.valueOf(contact.getID()) });
138 | db.close();
139 | }
140 |
141 |
142 | // Getting contacts Count
143 | public int getContactsCount() {
144 | String countQuery = "SELECT * FROM " + TABLE_CONTACTS;
145 | SQLiteDatabase db = this.getReadableDatabase();
146 | Cursor cursor = db.rawQuery(countQuery, null);
147 | cursor.close();
148 |
149 | // return count
150 | return cursor.getCount();
151 | }*/
152 |
153 | }
--------------------------------------------------------------------------------
/src/com/example/javasamples/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.javasamples;
2 | import java.io.*;
3 | import java.util.List;
4 | import android.app.Activity;
5 | import android.content.Context;
6 | import android.graphics.Color;
7 | import android.hardware.Sensor;
8 | import android.hardware.SensorEvent;
9 | import android.hardware.SensorEventListener;
10 | import android.hardware.SensorManager;
11 | import android.os.Bundle;
12 | import android.os.Handler;
13 | import android.text.Editable;
14 | import android.text.InputType;
15 | import android.util.Log;
16 | import android.widget.TextView;
17 | import android.widget.Toast;
18 |
19 | import java.sql.Timestamp;
20 | import java.util.Timer;
21 | import java.util.TimerTask;
22 | import android.os.Environment;
23 | import android.view.*;
24 | import android.view.View.OnClickListener;
25 | import android.view.animation.Animation;
26 | import android.view.animation.RotateAnimation;
27 | import android.widget.*;
28 | import com.example.javasamples.*;
29 |
30 |
31 | public class MainActivity extends Activity implements SensorEventListener{
32 | // GUI controls
33 | EditText txtData;
34 | Button btnWriteSDFile;
35 | Button btnReadSDFile;
36 | Button btnClearScreen;
37 | Button btnClose;
38 | private SensorManager sensorManager;
39 |
40 | private View view;
41 | private long lastUpdate;
42 | // define the display assembly compass picture
43 | private ImageView image;
44 |
45 | // record the compass picture angle turned
46 | private float currentDegree = 0f;
47 |
48 | // device sensor manager
49 | private SensorManager mSensorManager;
50 |
51 | TextView tvHeading;
52 |
53 |
54 |
55 |
56 |
57 |
58 | @Override
59 | public void onCreate(Bundle savedInstanceState) {
60 | super.onCreate(savedInstanceState);
61 | setContentView(R.layout.activity_main);
62 | final File myFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/xfile.txt");
63 | txtData = (EditText) findViewById(R.id.duration);
64 | image = (ImageView) findViewById(R.id.imageViewCompass);
65 |
66 | // TextView that will tell the user what degree is he heading
67 | tvHeading = (TextView) findViewById(R.id.tvHeading);
68 |
69 | // initialize your android device sensor capabilities
70 | mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
71 |
72 | sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
73 | lastUpdate = System.currentTimeMillis();
74 | //txtData.setHint("Enter some lines of data here...");
75 | try {
76 | myFile.createNewFile();
77 | } catch (IOException e2) {
78 | // TODO Auto-generated catch block
79 | e2.printStackTrace();
80 | }
81 | FileInputStream fIn=null;
82 | try {
83 | fIn = new FileInputStream(myFile);
84 | } catch (FileNotFoundException e1) {
85 | // TODO Auto-generated catch block
86 | e1.printStackTrace();
87 | }
88 |
89 |
90 |
91 |
92 | // bind GUI elements with local controls
93 |
94 | btnWriteSDFile = (Button) findViewById(R.id.btnWriteSDFile);
95 | btnWriteSDFile.setOnClickListener(new OnClickListener() {
96 |
97 |
98 | public void onClick(View v) {
99 | // write on SD card file data in the text box
100 | try {
101 | btnWriteSDFile.setEnabled(false);
102 |
103 | FileOutputStream fOut = new FileOutputStream(myFile);
104 | final OutputStreamWriter myOutWriter =
105 | new OutputStreamWriter(fOut);
106 |
107 |
108 |
109 | //timer = new Timer();
110 |
111 |
112 | String temp=txtData.getText().toString();
113 |
114 | int duration=Integer.parseInt(temp);
115 | // timer.schedule(new RemindTask(), 2000,2000);
116 | // Thread thread = new Thread(runnable);
117 | // thread.start();
118 |
119 |
120 | /*while(curr/1000 < prev/1000 + 30){
121 | curr=System.currentTimeMillis();
122 | if(curr/1000-temp/1000==incr){
123 | java.util.Date date= new java.util.Date();
124 | final Timestamp a= new Timestamp(date.getTime());
125 | final double latitude = gps.getLatitude();
126 | final double longitude = gps.getLongitude();
127 |
128 |
129 | myOutWriter.append(a.toString()+"lat:"+String.valueOf(latitude) +"long:"+String.valueOf(longitude)+"lastX:"+ String.valueOf(mLastX)+"lastY"+String.valueOf(mLastY)+"lastZ"+String.valueOf(mLastZ)+"degree:"+String.valueOf(currentDegree));
130 | incr++;}
131 | }*/
132 | int i;
133 | for(i=0;i= 2) //
216 | {
217 | if (actualTime - lastUpdate < 200) {
218 | return;
219 | }
220 | lastUpdate = actualTime;
221 | //global_x=x;global_y=y;global_z=z;
222 | }
223 | }
224 | @Override
225 | public void onSensorChanged(SensorEvent event) {
226 | if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
227 | float[] values = event.values;
228 | // Movement
229 | float x = values[0];
230 | float y = values[1];
231 | float z = values[2];
232 |
233 | float accelationSquareRoot = (x * x + y * y + z * z)
234 | / (SensorManager.GRAVITY_EARTH * SensorManager.GRAVITY_EARTH);
235 | long actualTime = event.timestamp;
236 | if (accelationSquareRoot >= 2) //
237 | {
238 | if (actualTime - lastUpdate < 200) {
239 | return;
240 | }
241 | lastUpdate = actualTime;
242 | Toast.makeText(this, "Device was shuffed", Toast.LENGTH_SHORT)
243 | .show();
244 |
245 |
246 |
247 | // TODO Auto-generated catch block
248 |
249 |
250 | java.util.Date date= new java.util.Date();
251 | final Timestamp a= new Timestamp(date.getTime());
252 | String rootPath=Environment.getExternalStorageDirectory().getAbsolutePath()+"/accel/";
253 | File file=new File(rootPath);
254 | if(!file.exists()){
255 | file.mkdirs();
256 | }
257 | File myFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/accel/"+String.valueOf(System.currentTimeMillis()+".txt"));
258 | FileOutputStream fOut = null;
259 | try {
260 | myFile.createNewFile();
261 | } catch (IOException e) {
262 | // TODO Auto-generated catch block
263 | Toast.makeText(this, "problem in file creation", Toast.LENGTH_SHORT)
264 | .show();
265 | e.printStackTrace();
266 | }
267 | try {
268 | fOut = new FileOutputStream(myFile);
269 | } catch (FileNotFoundException e) {
270 | // TODO Auto-generated catch block
271 | Toast.makeText(this, "line101", Toast.LENGTH_SHORT)
272 | .show();
273 | e.printStackTrace();
274 | }
275 |
276 | OutputStreamWriter myOutWriter =
277 | new OutputStreamWriter(fOut);
278 | try {
279 | myOutWriter.append(a.toString()+ " X : "+ String.valueOf(x)+" Y: " +String.valueOf(y)+" Z: "+String.valueOf(z));
280 | myOutWriter.close();
281 | fOut.close();
282 | } catch (IOException e) {
283 | // TODO Auto-generated catch block
284 | Toast.makeText(this, "line112", Toast.LENGTH_SHORT)
285 | .show();
286 | e.printStackTrace();
287 | }
288 |
289 |
290 |
291 |
292 | Toast.makeText(getBaseContext(),
293 | "Done writing SD 'accelerometer.txt'",
294 | Toast.LENGTH_SHORT).show();
295 | }
296 | }
297 |
298 |
299 |
300 | float degree = Math.round(event.values[0]);
301 |
302 | tvHeading.setText("Heading: " + Float.toString(degree) + " degrees");
303 |
304 | // create a rotation animation (reverse turn degree degrees)
305 | RotateAnimation ra = new RotateAnimation(
306 | currentDegree,
307 | -degree,
308 | Animation.RELATIVE_TO_SELF, 0.5f,
309 | Animation.RELATIVE_TO_SELF,
310 | 0.5f);
311 |
312 | // how long the animation will take place
313 | ra.setDuration(210);
314 |
315 | // set the animation after the end of the reservation status
316 | ra.setFillAfter(true);
317 |
318 | // Start the animation
319 | image.startAnimation(ra);
320 | currentDegree = -degree;
321 |
322 |
323 |
324 |
325 | java.util.Date date= new java.util.Date();
326 | final Timestamp a= new Timestamp(date.getTime());
327 | String rootPath=Environment.getExternalStorageDirectory().getAbsolutePath()+"/compass/";
328 | File file=new File(rootPath);
329 | if(!file.exists()){
330 | file.mkdirs();
331 | }
332 |
333 | String rootPath2=Environment.getExternalStorageDirectory().getAbsolutePath()+"/compass/";
334 | File file2=new File(rootPath);
335 | if(file.isDirectory()){
336 |
337 | if(file.list().length==0){
338 | File myFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/compass/"+String.valueOf(System.currentTimeMillis()/1000) +".txt");
339 | FileOutputStream fOut = null;
340 | try {
341 | myFile.createNewFile();
342 | } catch (IOException e) {
343 | // TODO Auto-generated catch block
344 | Toast.makeText(this, "problem in file creation", Toast.LENGTH_SHORT)
345 | .show();
346 | e.printStackTrace();
347 | }
348 | try {
349 | fOut = new FileOutputStream(myFile);
350 | } catch (FileNotFoundException e) {
351 | // TODO Auto-generated catch block
352 | Toast.makeText(this, "line101", Toast.LENGTH_SHORT)
353 | .show();
354 | e.printStackTrace();
355 | }
356 |
357 | OutputStreamWriter myOutWriter = new OutputStreamWriter(fOut);
358 | try {
359 | myOutWriter.append(a.toString()+" degree: "+String.valueOf(degree));
360 | myOutWriter.append(" "+a.toString()+" newsample: "+String.valueOf(currentDegree-degree));
361 | myOutWriter.close();
362 | fOut.close();
363 | } catch (IOException e) {
364 | // TODO Auto-generated catch block
365 | Toast.makeText(this, "line112", Toast.LENGTH_SHORT)
366 | .show();
367 | e.printStackTrace();
368 | }
369 |
370 |
371 |
372 |
373 | Toast.makeText(getBaseContext(),
374 | "Done writing SD 'compass.txt'",
375 | Toast.LENGTH_SHORT).show();
376 |
377 | }
378 | else{
379 |
380 |
381 |
382 | String rootPath3=Environment.getExternalStorageDirectory().getAbsolutePath()+"/compass/"+String.valueOf((System.currentTimeMillis()-1000)/1000)+".txt";
383 | File file3=new File(rootPath);
384 | if(file.exists()){
385 | File myFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/compass/"+String.valueOf(System.currentTimeMillis()/1000) +".txt");
386 | FileOutputStream fOut = null;
387 | try {
388 | myFile.createNewFile();
389 | } catch (IOException e) {
390 | // TODO Auto-generated catch block
391 | Toast.makeText(this, "problem in file creation", Toast.LENGTH_SHORT)
392 | .show();
393 | e.printStackTrace();
394 | }
395 | try {
396 | fOut = new FileOutputStream(myFile);
397 | } catch (FileNotFoundException e) {
398 | // TODO Auto-generated catch block
399 | Toast.makeText(this, "line101", Toast.LENGTH_SHORT)
400 | .show();
401 | e.printStackTrace();
402 | }
403 |
404 | OutputStreamWriter myOutWriter =
405 | new OutputStreamWriter(fOut);
406 | try {
407 | myOutWriter.append(a.toString()+" degree: "+String.valueOf(degree));
408 | myOutWriter.append(" "+a.toString()+" newsample: "+String.valueOf(currentDegree-degree));
409 | myOutWriter.close();
410 | fOut.close();
411 | } catch (IOException e) {
412 | // TODO Auto-generated catch block
413 | Toast.makeText(this, "line112", Toast.LENGTH_SHORT)
414 | .show();
415 | e.printStackTrace();
416 | }
417 |
418 |
419 |
420 |
421 | Toast.makeText(getBaseContext(),
422 | "Done writing SD 'compass.txt'",
423 | Toast.LENGTH_SHORT).show();
424 |
425 | }
426 |
427 |
428 | }
429 |
430 |
431 | }
432 |
433 |
434 |
435 | }
436 |
437 | }// AndSDcard
438 |
--------------------------------------------------------------------------------
/src/com/example/jadoo/MainActivity.java:
--------------------------------------------------------------------------------
1 | //currently working code
2 | package com.example.jadoo;
3 | import java.io.*;
4 | import java.util.List;
5 | import android.app.Activity;
6 | import android.content.Context;
7 | import android.graphics.Color;
8 | import android.hardware.Sensor;
9 | import android.hardware.SensorEvent;
10 | import android.hardware.SensorEventListener;
11 | import android.hardware.SensorManager;
12 | import android.os.Bundle;
13 | import android.os.Handler;
14 | import android.text.Editable;
15 | import android.text.InputType;
16 | import android.util.Log;
17 | import android.widget.TextView;
18 | import android.widget.Toast;
19 |
20 | import java.sql.Timestamp;
21 | import java.util.Timer;
22 | import java.util.TimerTask;
23 | import android.os.Environment;
24 | import android.view.*;
25 | import android.view.View.OnClickListener;
26 | import android.view.animation.Animation;
27 | import android.view.animation.RotateAnimation;
28 | import android.widget.*;
29 |
30 | import com.example.jadoo.*;
31 |
32 |
33 |
34 | public class MainActivity extends Activity implements SensorEventListener{
35 | // GUI controls
36 | EditText txtData;
37 | Button btnWriteSDFile;
38 | Button btnReadSDFile;
39 | Button btnClearScreen;
40 | Button btnClose;
41 | private SensorManager sensorManager;
42 | Float azimut;
43 | private SensorManager mSensorManager;
44 | Sensor accelerometer;
45 | Sensor magnetometer;
46 | //SensorManager lets you access the device's sensors
47 |
48 | private View view;
49 | private long lastUpdate;
50 | // define the display assembly compass picture
51 |
52 |
53 | // record the compass picture angle turned
54 | private float currentDegree = 0f;
55 |
56 | // device sensor manager
57 |
58 | String rootPath;
59 | String globaltimestamp;
60 | String gpsRootpath;
61 |
62 | long endtime;
63 |
64 |
65 |
66 |
67 | @Override
68 | public void onCreate(Bundle savedInstanceState) {
69 | super.onCreate(savedInstanceState);
70 | setContentView(R.layout.activity_main);
71 | globaltimestamp=String.valueOf(System.currentTimeMillis());
72 | //final File myFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/gps"+globaltimestamp+".txt");
73 | txtData = (EditText) findViewById(R.id.duration);
74 |
75 | // rootPath=Environment.getExternalStorageDirectory().getAbsolutePath()+"/accel"+globaltimestamp+"/";
76 | String rootPath2=Environment.getExternalStorageDirectory().getAbsolutePath()+"/accel"+globaltimestamp+"/";
77 | File file=new File(rootPath2);
78 | if(!file.exists()){
79 | file.mkdirs();
80 | }
81 | String gpsRootpath=Environment.getExternalStorageDirectory().getAbsolutePath()+"/gps"+globaltimestamp+"/";
82 | file=new File(gpsRootpath);
83 | if(!file.exists()){
84 | file.mkdirs();
85 | }
86 | String compassRootpath=Environment.getExternalStorageDirectory().getAbsolutePath()+"/compass"+globaltimestamp+"/";
87 | file=new File(compassRootpath);
88 | if(!file.exists()){
89 | file.mkdirs();
90 | }
91 |
92 | sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
93 | lastUpdate = System.currentTimeMillis();
94 |
95 | // TextView that will tell the user what degree is he heading
96 |
97 | //String rootPath_new=Environment.getExternalStorageDirectory().getAbsolutePath()+"/accel"+globaltimestamp+"/";
98 | //File file_new=new File(rootPath_new);
99 | //if(!file_new.exists()){
100 | //file_new.mkdirs();
101 | //}
102 |
103 | // initialize your android device sensor capabilities
104 | mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
105 |
106 |
107 | lastUpdate = System.currentTimeMillis();
108 | //txtData.setHint("Enter some lines of data here...");
109 | // String rootPath=Environment.getExternalStorageDirectory().getAbsolutePath()+"/compass"+globaltimestamp+"/";
110 |
111 | mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);
112 | accelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
113 | magnetometer = mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
114 |
115 |
116 |
117 | // bind GUI elements with local controls
118 |
119 | btnWriteSDFile = (Button) findViewById(R.id.btnWriteSDFile);
120 | btnWriteSDFile.setOnClickListener(new OnClickListener() {
121 |
122 |
123 | public void onClick(View v) {
124 | // write on SD card file data in the text box
125 | try {
126 | btnWriteSDFile.setEnabled(false);
127 |
128 |
129 |
130 |
131 |
132 |
133 | //String temp=txtData.getText().toString();
134 |
135 | //int duration=Integer.parseInt(temp);
136 | String rootPath=Environment.getExternalStorageDirectory().getAbsolutePath()+"/gps"+globaltimestamp+"/";
137 | File file=new File(rootPath);
138 | if(!file.exists()){
139 | file.mkdirs();
140 | }
141 | //int timeofclick= (int)System.currentTimeMillis()/1000;
142 |
143 |
144 | Timer timer = new Timer();
145 | TimerTask tt = new TimerTask(){
146 | @Override
147 | public void run(){
148 | //Thread.sleep(1000);
149 | File myFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/gps"+globaltimestamp+"/"+String.valueOf(System.currentTimeMillis()/1000) +".txt");
150 | FileOutputStream fOut = null;
151 | try {
152 | myFile.createNewFile();
153 | } catch (IOException e) {
154 | // TODO Auto-generated catch block
155 |
156 | e.printStackTrace();
157 | }
158 | try {
159 | fOut = new FileOutputStream(myFile);
160 | } catch (FileNotFoundException e) {
161 | // TODO Auto-generated catch block
162 |
163 | e.printStackTrace();
164 | }
165 |
166 | OutputStreamWriter myOutWriter = new OutputStreamWriter(fOut);
167 | try {
168 | java.util.Date date= new java.util.Date();
169 | final Timestamp a= new Timestamp(date.getTime());
170 | gpstracker gps = new gpstracker(MainActivity.this);
171 | double latitude = gps.getLatitude();
172 | double longitude = gps.getLongitude();
173 | myOutWriter.append(a.toString()+","+String.valueOf(latitude) +","+String.valueOf(longitude)+"\n");
174 |
175 | myOutWriter.close();
176 | fOut.close();
177 | } catch (IOException e) {
178 | // TODO Auto-generated catch block
179 |
180 | e.printStackTrace();
181 | }
182 |
183 | }
184 | };
185 |
186 |
187 | timer.schedule(tt, 1,1000);// delay the task 1 second, and then run task every five seconds
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 | Toast.makeText(getBaseContext(),
200 | "Done writing SD 'mysdfile.txt'",
201 | Toast.LENGTH_SHORT).show();
202 |
203 | } catch (Exception e) {
204 | Toast.makeText(getBaseContext(), e.getMessage(),
205 | Toast.LENGTH_SHORT).show();
206 | }
207 |
208 | }// onClick
209 | }); // btnWriteSDFile
210 |
211 |
212 |
213 |
214 |
215 | btnClose = (Button) findViewById(R.id.btnClose);
216 | btnClose.setOnClickListener(new OnClickListener() {
217 |
218 | public void onClick(View v) {
219 | // clear text box
220 | finish();
221 | }
222 | }); // btnClose
223 |
224 | }// onCreate
225 | @Override
226 | protected void onPause() {
227 | super.onPause();
228 | // sensorManager.unregisterListener(this);
229 | // mSensorManager.unregisterListener(this);
230 | }
231 |
232 | @Override
233 | protected void onDestroy() {
234 | super.onPause();
235 | sensorManager.unregisterListener(this);
236 | mSensorManager.unregisterListener(this);
237 |
238 | }
239 |
240 | @Override
241 | protected void onResume() {
242 | super.onResume();
243 | // register this class as a listener for the orientation and
244 | // accelerometer sensors
245 | sensorManager.registerListener(this,
246 | sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
247 | SensorManager.SENSOR_DELAY_NORMAL);
248 | // Register the sensor listeners
249 | mSensorManager.registerListener(this, accelerometer, SensorManager.SENSOR_DELAY_UI);
250 | mSensorManager.registerListener(this, magnetometer, SensorManager.SENSOR_DELAY_UI);
251 |
252 | }
253 | @Override
254 | public void onAccuracyChanged(Sensor sensor, int accuracy) {
255 | //can be safely ignored for this demo
256 | }
257 |
258 | float[] mGravity;
259 | float[] mGeomagnetic;
260 | @Override
261 | public void onSensorChanged(SensorEvent event) {
262 | if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
263 | float[] values = event.values;
264 | // Movement
265 | float x = values[0];
266 | float y = values[1];
267 | float z = values[2];
268 |
269 | float accelationSquareRoot = (x * x + y * y + z * z)
270 | / (SensorManager.GRAVITY_EARTH * SensorManager.GRAVITY_EARTH);
271 | long actualTime = event.timestamp;
272 | if (accelationSquareRoot >= 2) //
273 | {
274 | if (actualTime - lastUpdate < 200) {
275 | return;
276 | }
277 | lastUpdate = actualTime;
278 | Toast.makeText(this, "Device was shuffed", Toast.LENGTH_SHORT)
279 | .show();
280 |
281 |
282 | // TODO Auto-generated catch block
283 | String rootPath3=Environment.getExternalStorageDirectory().getAbsolutePath()+"/accel"+globaltimestamp+"/"+String.valueOf((System.currentTimeMillis())/1000)+".txt";
284 | File file3=new File(rootPath3);
285 | if(!file3.exists()){
286 |
287 | java.util.Date date= new java.util.Date();
288 | final Timestamp a= new Timestamp(date.getTime());
289 |
290 | File myFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/accel"+ globaltimestamp+"/"+String.valueOf(System.currentTimeMillis()/1000)+".txt");
291 | FileOutputStream fOut = null;
292 | try {
293 | myFile.createNewFile();
294 | } catch (IOException e) {
295 | // TODO Auto-generated catch block
296 | Toast.makeText(this, "problem in file creation", Toast.LENGTH_SHORT)
297 | .show();
298 | e.printStackTrace();
299 | }
300 | try {
301 | fOut = new FileOutputStream(myFile);
302 | } catch (FileNotFoundException e) {
303 | // TODO Auto-generated catch block
304 | Toast.makeText(this, "line101", Toast.LENGTH_SHORT)
305 | .show();
306 | e.printStackTrace();
307 | }
308 |
309 | OutputStreamWriter myOutWriter =
310 | new OutputStreamWriter(fOut);
311 | try {
312 | myOutWriter.append(a.toString()+ ","+ String.valueOf(x)+"," +String.valueOf(y)+","+String.valueOf(z));
313 | myOutWriter.close();
314 | fOut.close();
315 | } catch (IOException e) {
316 | // TODO Auto-generated catch block
317 | Toast.makeText(this, "line112", Toast.LENGTH_SHORT)
318 | .show();
319 | e.printStackTrace();
320 | }
321 |
322 |
323 |
324 |
325 | Toast.makeText(getBaseContext(),
326 | "Done writing SD 'mysdfile.txt'",
327 | Toast.LENGTH_SHORT).show();
328 | }}
329 | }
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 | if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER)
360 | mGravity = event.values.clone();
361 | if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD)
362 | mGeomagnetic = event.values.clone();
363 | if (mGravity != null && mGeomagnetic != null) {
364 | float R[] = new float[9];
365 | float I[] = new float[9];
366 | /*Computes the inclination matrix I as well as the rotation matrix R transforming a vector from the device coordinate
367 | * system to the world's coordinate system which is defined as a direct orthonormal basis*/
368 | boolean success = SensorManager.getRotationMatrix(R, I, mGravity, mGeomagnetic);
369 | if (success) {
370 | float orientation[] = new float[3];
371 | /*Computes the device's orientation based on the rotation matrix*/
372 | SensorManager.getOrientation(R, orientation);
373 | azimut = orientation[0]; // orientation contains: azimut, pitch and roll
374 | azimut = (float)Math.toDegrees(orientation[0]);
375 | azimut=(float) ((azimut+ 360.0) % 360.0);
376 |
377 | java.util.Date date= new java.util.Date();
378 | final Timestamp a= new Timestamp(date.getTime());
379 | String rootPath=Environment.getExternalStorageDirectory().getAbsolutePath()+"/compass"+globaltimestamp+"/";
380 | File file=new File(rootPath);
381 | if(!file.exists()){
382 | file.mkdirs();
383 | }
384 |
385 | String rootPath2=Environment.getExternalStorageDirectory().getAbsolutePath()+"/compass"+globaltimestamp+"/";
386 | File file2=new File(rootPath2);
387 | if(file2.isDirectory()){
388 |
389 | if(file2.list().length==0){
390 | File myFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/compass"+globaltimestamp+"/"+String.valueOf(System.currentTimeMillis()/1000) +".txt");
391 | FileOutputStream fOut = null;
392 | try {
393 | myFile.createNewFile();
394 | } catch (IOException e) {
395 | // TODO Auto-generated catch block
396 | Toast.makeText(this, "problem in file creation", Toast.LENGTH_SHORT)
397 | .show();
398 | e.printStackTrace();
399 | }
400 | try {
401 | fOut = new FileOutputStream(myFile);
402 | } catch (FileNotFoundException e) {
403 | // TODO Auto-generated catch block
404 | Toast.makeText(this, "line101", Toast.LENGTH_SHORT)
405 | .show();
406 | e.printStackTrace();
407 | }
408 |
409 | OutputStreamWriter myOutWriter = new OutputStreamWriter(fOut);
410 | try {
411 | myOutWriter.append(a.toString()+","+String.valueOf(azimut));
412 | //myOutWriter.append(" "+a.toString()+" newsample: "+String.valueOf(-azimut*360/(2*3.14159f)));
413 | myOutWriter.close();
414 | fOut.close();
415 | } catch (IOException e) {
416 | // TODO Auto-generated catch block
417 | Toast.makeText(this, "line112", Toast.LENGTH_SHORT)
418 | .show();
419 | e.printStackTrace();
420 | }
421 |
422 |
423 |
424 |
425 | Toast.makeText(getBaseContext(),
426 | "Done writing SD 'compass.txt'",
427 | Toast.LENGTH_SHORT).show();
428 |
429 | }
430 | else{
431 |
432 |
433 |
434 | String rootPath3=Environment.getExternalStorageDirectory().getAbsolutePath()+"/compass"+globaltimestamp+"/"+String.valueOf((System.currentTimeMillis()-1000)/1000)+".txt";
435 | File file3=new File(rootPath3);
436 | if(file3.exists()){
437 | File myFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/compass"+globaltimestamp+"/"+String.valueOf(System.currentTimeMillis()/1000) +".txt");
438 | FileOutputStream fOut = null;
439 | try {
440 | myFile.createNewFile();
441 | } catch (IOException e) {
442 | // TODO Auto-generated catch block
443 | Toast.makeText(this, "problem in file creation", Toast.LENGTH_SHORT)
444 | .show();
445 | e.printStackTrace();
446 | }
447 | try {
448 | fOut = new FileOutputStream(myFile);
449 | } catch (FileNotFoundException e) {
450 | // TODO Auto-generated catch block
451 | Toast.makeText(this, "line101", Toast.LENGTH_SHORT)
452 | .show();
453 | e.printStackTrace();
454 | }
455 |
456 | OutputStreamWriter myOutWriter =
457 | new OutputStreamWriter(fOut);
458 | try {
459 | myOutWriter.append(a.toString()+","+String.valueOf(azimut));
460 | // myOutWriter.append(" "+a.toString()+" newsample: "+String.valueOf(-azimut*360/(2*3.14159f)));
461 | myOutWriter.close();
462 | fOut.close();
463 | } catch (IOException e) {
464 | // TODO Auto-generated catch block
465 | Toast.makeText(this, "line112", Toast.LENGTH_SHORT)
466 | .show();
467 | e.printStackTrace();
468 | }
469 |
470 |
471 |
472 |
473 |
474 | }
475 |
476 |
477 | }
478 | }
479 | }
480 |
481 | }
482 |
483 |
484 | }
485 |
486 |
487 |
488 | }
489 |
490 | // AndSDcard
491 |
--------------------------------------------------------------------------------