SharingActivity and SettingsActivity #15
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.uam.wmi.findmytutor">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
@ -13,12 +14,16 @@
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
android:theme="@style/AppTheme"
|
||||
tools:ignore="GoogleAppIndexingWarning">
|
||||
|
||||
|
||||
<receiver android:name=".utils.BroadcastLocalizationHandler">
|
||||
<receiver android:name=".utils.BroadcastLocalizationHandler"
|
||||
android:enabled="true"
|
||||
android:exported="false"
|
||||
>
|
||||
<intent-filter>
|
||||
<action android:name="com.uam.wmi.findmytutor">
|
||||
<action android:name="background.location.broadcast">
|
||||
</action>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
@ -37,6 +37,7 @@ import com.mapbox.mapboxsdk.Mapbox;
|
||||
import com.uam.wmi.findmytutor.R;
|
||||
import com.uam.wmi.findmytutor.service.LdapService;
|
||||
import com.uam.wmi.findmytutor.service.LocationService;
|
||||
import com.uam.wmi.findmytutor.utils.BroadcastLocalizationHandler;
|
||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||
|
||||
import org.reactivestreams.Subscriber;
|
||||
@ -142,18 +143,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
|
||||
|
||||
this.broadcastReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
|
||||
latitude = intent.getDoubleExtra("latitude",0);
|
||||
longitude = intent.getDoubleExtra("longitude",0);
|
||||
|
||||
Log.e("Background service", String.valueOf(latitude));
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
this.broadcastReceiver = new BroadcastLocalizationHandler();
|
||||
|
||||
//You should find out what causes this fancy/not reproducible error
|
||||
/* Coordinate coordinate = new Coordinate(latitude);
|
||||
|
@ -5,20 +5,23 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
public class BroadcastLocalizationHandler extends BroadcastReceiver {
|
||||
public static String str_receiver = "servicetutorial.service.receiver";
|
||||
public static String str_receiver = "servicetutorial.service.receiver";
|
||||
|
||||
private IntentFilter filter =
|
||||
new IntentFilter(str_receiver);
|
||||
private IntentFilter filter =
|
||||
new IntentFilter(str_receiver);
|
||||
|
||||
|
||||
@Override
|
||||
public void onReceive(Context arg0, Intent arg1) {
|
||||
//tutaj operujemy na naszym powiadomieniu, dane które zostały nam przekazane wyciągamy z parametru arg1.
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onReceive(Context arg0, Intent intent) {
|
||||
Double latitude, longitude;
|
||||
latitude = intent.getDoubleExtra("latitude", 0);
|
||||
// longitude = intent.getDoubleExtra("longitude",0);
|
||||
|
||||
Log.e("Background service", String.valueOf(latitude));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user