.mylocationtrackoverfbdb code example
Example 1: .mylocationtrackoverfbdb
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.example.mylocationtrackoverfbdb"
minSdkVersion 28
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.firebase:firebase-core:17.0.0'
implementation 'com.google.firebase:firebase-database:17.0.0'
}
apply plugin: 'com.google.gms.google-services'
Example 2: .mylocationtrackoverfbdb
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.google.gms:google-services:4.3.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Example 3: .mylocationtrackoverfbdb
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MapsActivity">
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="550dp"
tools:context=".MapsActivity"
tools:layout="@android:layout/simple_spinner_dropdown_item" />
<EditText
android:id="@+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_marginTop="550dp"
android:ems="10"
android:hint="@string/latitude"
android:inputType="textPersonName"
android:autofillHints="" />
<EditText
android:id="@+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="220dp"
android:layout_marginTop="550dp"
android:ems="10"
android:hint="@string/longitude"
android:inputType="textPersonName"
android:autofillHints="" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="150dp"
android:layout_marginTop="600dp"
android:onClick="updateButtonOnclick"
android:text="@string/update" />
</FrameLayout>
Example 4: .mylocationtrackoverfbdb
<resources>
<!--
TODO: Before you run your application, you need a Google Maps API key.
To get one, follow this link, follow the directions and press "Create" at the end:
https:
You can also add your credentials to an existing key, using these values:
Package name:
C3:E7:EC:00:59:FC:44:F3:06:AB:E1:EF:F8:9C:3D:8C:85:8B:53:3C
SHA-1 certificate fingerprint:
C3:E7:EC:00:59:FC:44:F3:06:AB:E1:EF:F8:9C:3D:8C:85:8B:53:3C
Alternatively, follow the directions here:
https:
Once you have your key (it starts with "AIza"), replace the "google_maps_key"
string in this file.
-->
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">AIzaSyA9vD-5rTAXDfVCMxoGWVrfrAMd83MVkrs</string>
</resources>
Example 5: .mylocationtrackoverfbdb
<?php
function fetch_user_chat_history($from_user_id, $to_user_id, $connect)
{
$query = "
SELECT * FROM chat_message
WHERE (from_user_id = '".$from_user_id."'
AND to_user_id = '".$to_user_id."')
OR (from_user_id = '".$to_user_id."'
AND to_user_id = '".$from_user_id."')
ORDER BY timestamp DESC
";
$statement = $connect->prepare($query);
$statement->execute();
$result = $statement->fetchAll();
$output = '<ul class="list-unstyled">';
foreach($result as $row)
{
$user_name = '';
$dynamic_background = '';
$chat_message = '';
if($row["from_user_id"] == $from_user_id)
{
if($row["status"] == '2')
{
$chat_message = '<em>This message has been removed</em>';
$user_name = '<b class="text-success">You</b>';
}
else
{
$chat_message = $row['chat_message'];
$user_name = '<button type="button" class="btn btn-danger btn-xs remove_chat" id="'.$row['chat_message_id'].'">x</button> <b class="text-success">You</b>';
}
$dynamic_background = 'background-color:#ffe6e6;';
}
else
{
if($row["status"] == '2')
{
$chat_message = '<em>This message has been removed</em>';
}
else
{
$chat_message = $row["chat_message"];
}
$user_name = '<b class="text-danger">'.get_user_name($row['from_user_id'], $connect).'</b>';
$dynamic_background = 'background-color:#ffffe6;';
}
$output .= '
<li style="border-bottom:1px dotted #ccc;padding-top:8px; padding-left:8px; padding-right:8px;'.$dynamic_background.'">
<p>'.$user_name.' - '.$chat_message.'
<div align="right">
- <small><em>'.$row['timestamp'].'</em></small>
</div>
</p>
</li>
';
}
$output .= '</ul>';
$query = "
UPDATE chat_message
SET status = '0'
WHERE from_user_id = '".$to_user_id."'
AND to_user_id = '".$from_user_id."'
AND status = '1'
";
$statement = $connect->prepare($query);
$statement->execute();
return $output;
}
?>
Example 6: .mylocationtrackoverfbdb
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mylocationtrackoverfbdb">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<activity
android:name=".MapsActivity"
android:label="@string/title_activity_maps">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>