Skip to content

Commit b996392

Browse files
author
Paul Ruiz
committed
removing toasts, setting to portrait for now
1 parent b30288a commit b996392

File tree

3 files changed

+2
-32
lines changed

3 files changed

+2
-32
lines changed

GeoFencing/geofencing/src/main/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
android:theme="@style/AppTheme" >
1212
<activity
1313
android:name=".Activity.MainActivity"
14-
android:label="@string/app_name" >
14+
android:label="@string/app_name"
15+
android:screenOrientation="portrait">
1516
<intent-filter>
1617
<action android:name="android.intent.action.MAIN" />
1718

GeoFencing/geofencing/src/main/java/com/ptrprograms/geofencing/Activity/MainActivity.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import android.os.Bundle;
1111
import android.support.v4.content.LocalBroadcastManager;
1212
import android.widget.CompoundButton;
13-
import android.widget.Toast;
1413
import android.widget.ToggleButton;
1514

1615
import com.google.android.gms.common.ConnectionResult;
@@ -72,38 +71,27 @@ private void verifyPlayServices() {
7271
break;
7372
}
7473
case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED: {
75-
Toast.makeText( this,
76-
"Geofencing service requires an update, please open Google Play.",
77-
Toast.LENGTH_SHORT ).show();
7874
finish();
7975
}
8076
default: {
81-
Toast.makeText(this,
82-
"Geofencing service is not available.",
83-
Toast.LENGTH_SHORT).show();
8477
finish();
8578
}
8679
}
8780
}
8881

8982
private void startGeofence() {
90-
Toast.makeText( this, "startGeofence", Toast.LENGTH_SHORT ).show();
9183
Location location = mLocationClient.getLastLocation();
9284
int radius = 100;
9385

9486
Geofence.Builder builder = new Geofence.Builder();
9587
mGeofence = builder
96-
//Unique to this geofence
9788
.setRequestId(FENCE_ID)
98-
//Size and location
9989
.setCircularRegion(
10090
location.getLatitude(),
10191
location.getLongitude(),
10292
radius)
103-
//Events both in and out of the fence
10493
.setTransitionTypes(Geofence.GEOFENCE_TRANSITION_ENTER
10594
| Geofence.GEOFENCE_TRANSITION_EXIT)
106-
//Keep alive
10795
.setExpirationDuration(Geofence.NEVER_EXPIRE)
10896
.build();
10997

@@ -132,14 +120,8 @@ protected void onPause() {
132120
}
133121

134122
public class GeofenceSampleReceiver extends BroadcastReceiver {
135-
/*
136-
* Define the required method for broadcast receivers
137-
* This method is invoked when a broadcast Intent triggers the receiver
138-
*/
139123
@Override
140124
public void onReceive(Context context, Intent intent) {
141-
142-
Toast.makeText( context, "onReceive: " + intent.getAction().toString() , Toast.LENGTH_SHORT ).show();
143125
startService( mIntent );
144126
}
145127
}
@@ -156,9 +138,7 @@ public void onDisconnected() {
156138

157139
@Override
158140
public void onAddGeofencesResult(int status, String[] geofenceIds ) {
159-
Toast.makeText( this, "addGeofencesResult", Toast.LENGTH_SHORT ).show();
160141
if( status == LocationStatusCodes.SUCCESS ) {
161-
Toast.makeText( this, "addGseofencesResult SUCCESS", Toast.LENGTH_SHORT ).show();
162142
Intent intent = new Intent( mIntent );
163143
intent.setAction(GeofencingService.ACTION_INIT);
164144
startService( intent );
@@ -181,7 +161,6 @@ public void onRemoveGeofencesByRequestIdsResult(int status, String[] strings) {
181161
@Override
182162
public void onRemoveGeofencesByPendingIntentResult(int status, PendingIntent pendingIntent) {
183163
if( status == LocationStatusCodes.SUCCESS ) {
184-
Toast.makeText( this, "onRemoveGeofencesByPendingIntentResult SUCCESS", Toast.LENGTH_SHORT ).show();
185164
stopService( mIntent );
186165
}
187166
}

GeoFencing/geofencing/src/main/java/com/ptrprograms/geofencing/Service/GeofencingService.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,9 @@
33
import android.app.IntentService;
44
import android.app.Notification;
55
import android.app.NotificationManager;
6-
import android.content.BroadcastReceiver;
7-
import android.content.Context;
86
import android.content.Intent;
97
import android.os.IBinder;
108
import android.support.v4.app.NotificationCompat;
11-
import android.text.TextUtils;
12-
import android.util.Log;
13-
import android.widget.Toast;
149

1510
import com.google.android.gms.location.Geofence;
1611
import com.google.android.gms.location.LocationClient;
@@ -40,7 +35,6 @@ public IBinder onBind(Intent intent) {
4035

4136
@Override
4237
protected void onHandleIntent(Intent intent) {
43-
Toast.makeText( this, "onHandleIntent", Toast.LENGTH_SHORT ).show();
4438
NotificationCompat.Builder builder = new NotificationCompat.Builder( this );
4539
builder.setSmallIcon( R.drawable.ic_launcher );
4640
builder.setDefaults(Notification.DEFAULT_ALL );
@@ -50,27 +44,23 @@ protected void onHandleIntent(Intent intent) {
5044
if( transitionType == Geofence.GEOFENCE_TRANSITION_ENTER ) {
5145
builder.setContentTitle( "Geofence Transition" );
5246
builder.setContentText( "Entering Geofence" );
53-
Toast.makeText( this, "Entering Geofence", Toast.LENGTH_SHORT ).show();
5447
mNotificationManager.notify( 1, builder.build() );
5548
}
5649
else if( transitionType == Geofence.GEOFENCE_TRANSITION_EXIT ) {
5750
builder.setContentTitle( "Geofence Transition" );
5851
builder.setContentText( "Exiting Geofence" );
59-
Toast.makeText( this, "Exiting Geofence", Toast.LENGTH_SHORT ).show();
6052
mNotificationManager.notify( 1, builder.build() );
6153
}
6254
}
6355

6456
@Override
6557
public void onCreate() {
6658
super.onCreate();
67-
Toast.makeText( this, "onCreate Service", Toast.LENGTH_SHORT ).show();
6859
mNotificationManager = (NotificationManager) getSystemService( NOTIFICATION_SERVICE );
6960
}
7061

7162
@Override
7263
public int onStartCommand(Intent intent, int flags, int startId) {
73-
Toast.makeText( this, "onStartCommand", Toast.LENGTH_SHORT ).show();
7464
onHandleIntent( intent );
7565
return START_NOT_STICKY;
7666
}

0 commit comments

Comments
 (0)