Skip to content
Snippets Groups Projects
Commit 2fddcaeb authored by SubashNS's avatar SubashNS
Browse files

gps started

parent c63968aa
No related branches found
No related tags found
No related merge requests found
<component name="ProjectDictionaryState">
<dictionary name="user" />
</component>
\ No newline at end of file
......@@ -27,22 +27,6 @@
</value>
</option>
</component>
<component name="ProjectInspectionProfilesVisibleTreeState">
<entry key="Project Default">
<profile-state>
<expanded-state>
<State>
<id />
</State>
</expanded-state>
<selected-state>
<State>
<id>Android</id>
</State>
</selected-state>
</profile-state>
</entry>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
......@@ -59,19 +43,4 @@
<component name="ProjectType">
<option name="id" value="Android" />
</component>
<component name="masterDetails">
<states>
<state key="ScopeChooserConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>
\ No newline at end of file
......@@ -4,13 +4,17 @@
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.RECEIVE_SMS">
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
</uses-permission>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:icon="@mipmap/kms"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
......
......@@ -6,6 +6,7 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.location.Location;
import android.os.Build;
import android.support.annotation.MainThread;
import android.support.annotation.RequiresApi;
......@@ -17,6 +18,7 @@ import android.telephony.SmsManager;
import android.util.Log;
import android.view.View;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
......@@ -25,6 +27,8 @@ import java.util.List;
public class MainActivity extends AppCompatActivity {
Intent intent;
int choice;
private TextView textView;
private GpsTool gpsTool;
SharedPreferences firsttime;
private static final int REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS = 291;
int backCount=0;
......@@ -66,6 +70,17 @@ public class MainActivity extends AppCompatActivity {
});
textView = (TextView) this.findViewById(R.id.loc);
if (gpsTool == null) {
gpsTool = new GpsTool(this) {
@Override
public void onGpsLocationChanged(Location location) {
super.onGpsLocationChanged(location);
refreshLocation(location);
}
};
}
}
......@@ -138,4 +153,26 @@ public class MainActivity extends AppCompatActivity {
.create()
.show();
}
private void refreshLocation(Location location) {
Double longitude = location.getLongitude();
Double latitude = location.getLatitude();
Double altitude = location.getAltitude();
StringBuilder sb = new StringBuilder();
sb.append("Longitude:").append(longitude).append("\n");
sb.append("Latitude:").append(latitude).append("\n");
sb.append("Altitude:").append(altitude);
textView.setText(sb.toString());
}
@Override
protected void onPause() {
super.onPause();
gpsTool.stopGpsUpdate();
}
@Override
protected void onResume() {
super.onResume();
gpsTool.startGpsUpdate();
}
}
......@@ -12,6 +12,17 @@
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.speedyapps.keepyousafe.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Location"
android:id="@+id/loc"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="true" />
<TextView
android:text="Keep Me Safe!"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment