Commit 689ae5f7 authored by A.P.R.C. Abeyrathna's avatar A.P.R.C. Abeyrathna

Accuracy Update V1

parent b57a6bc9
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenRepo" />
<option name="name" value="MavenRepo" />
<option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
......@@ -43,8 +43,23 @@ dependencies {
implementation 'com.google.android.gms:play-services-maps:18.1.0'
implementation 'com.google.android.gms:play-services-maps:18.1.0'
implementation 'com.google.android.gms:play-services-location:20.0.0'
implementation 'com.google.firebase:firebase-database:20.0.4'
implementation 'com.google.firebase:firebase-database:20.0.6'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
\ No newline at end of file
// Import the BoM for the Firebase platform
implementation platform('com.google.firebase:firebase-bom:30.5.0')
// Add the dependency for the Realtime Database library
// When using the BoM, you don't specify versions in Firebase library dependencies
implementation 'com.google.firebase:firebase-database'
// Import the BoM for the Firebase platform
implementation platform('com.google.firebase:firebase-bom:30.5.0')
// Declare the dependencies for the desired Firebase products without specifying versions
// For example, declare the dependencies for Firebase Authentication and Cloud Firestore
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-firestore'
}
......@@ -3,7 +3,9 @@ package com.app.travelle;
import androidx.annotation.NonNull;
import androidx.fragment.app.FragmentActivity;
import android.content.res.Resources;
import android.os.Bundle;
import android.util.Log;
import android.view.Window;
import android.view.WindowManager;
......@@ -12,6 +14,7 @@ import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MapStyleOptions;
import com.google.android.gms.maps.model.MarkerOptions;
import com.app.travelle.databinding.ActivityRetrieveBusMapBinding;
import com.google.firebase.database.DataSnapshot;
......@@ -29,6 +32,7 @@ public class RetrieveBusMap extends FragmentActivity implements OnMapReadyCallba
@Override
protected void onCreate(Bundle savedInstanceState) {
System.out.println("Started");
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
......@@ -55,18 +59,37 @@ public class RetrieveBusMap extends FragmentActivity implements OnMapReadyCallba
mMap = googleMap;
DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference("/");
System.out.println("================================================") ;
System.out.println(databaseReference);
//Styling
try {
// Customise the styling of the base map using a JSON object defined
// in a raw resource file.
boolean success = googleMap.setMapStyle(
MapStyleOptions.loadRawResourceStyle(
this, R.raw.map_style));
if (!success) {
Log.e("HomeMap", "Style parsing failed.");
}
} catch (Resources.NotFoundException e) {
Log.e("HomeMap", "Can't find style. Error: ", e);
}
ValueEventListener listener = databaseReference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
Double latitude = dataSnapshot.child("latitude").getValue(Double.class);
Double longitude = dataSnapshot.child("longitude").getValue(Double.class);
System.out.println("changing-----------------------------");
String latitude = dataSnapshot.child("latitude").getValue(String.class);
String longitude = dataSnapshot.child("longitude").getValue(String.class);
LatLng location = new LatLng(latitude,longitude);
System.out.println(latitude+longitude);
LatLng location = new LatLng(Double.parseDouble(latitude),Double.parseDouble(longitude));
mMap.addMarker(new MarkerOptions().position(location).title("117"));
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(location,14F));
mMap.addMarker(new MarkerOptions().position(location).title("117"));
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(location,17));
}
......
buildscript {
repositories {
// Make sure that you have the following two repositories
}
dependencies {
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.gms:google-services:4.3.14'
}
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.3.0' apply false
id 'com.android.library' version '7.3.0' apply false
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin' version '2.0.1' apply false
}
\ No newline at end of file
}
allprojects {
repositories {
// Make sure that you have the following two repositories
}}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment