Skip to content

Commit

Permalink
Checking Google Play Services at launch
Browse files Browse the repository at this point in the history
  • Loading branch information
ValXp committed Jun 4, 2015
1 parent 44537f7 commit b59571e
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 12 deletions.
63 changes: 54 additions & 9 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,32 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/cardview-v7/22.1.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/22.1.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.1.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services/4.2.42/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.0.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/cardview-v7/22.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/mediarouter-v7/22.0.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/22.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-ads/7.5.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-analytics/7.5.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-appindexing/7.5.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-appinvite/7.5.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-appstate/7.5.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-base/7.5.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-cast/7.5.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-drive/7.5.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-fitness/7.5.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-games/7.5.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-gcm/7.5.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-identity/7.5.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-location/7.5.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-maps/7.5.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-nearby/7.5.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-panorama/7.5.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-plus/7.5.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-safetynet/7.5.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-wallet/7.5.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-wearable/7.5.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services/7.5.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.maps.android/android-maps-utils/0.3.4/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
Expand All @@ -91,11 +113,34 @@
</content>
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="play-services-4.2.42" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-22.1.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-22.0.0" level="project" />
<orderEntry type="library" exported="" name="play-services-wallet-7.5.0" level="project" />
<orderEntry type="library" exported="" name="gson-2.3.1" level="project" />
<orderEntry type="library" exported="" name="play-services-cast-7.5.0" level="project" />
<orderEntry type="library" exported="" name="mediarouter-v7-22.0.0" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-22.2.0" level="project" />
<orderEntry type="library" exported="" name="play-services-drive-7.5.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.2.0" level="project" />
<orderEntry type="library" exported="" name="play-services-analytics-7.5.0" level="project" />
<orderEntry type="library" exported="" name="play-services-panorama-7.5.0" level="project" />
<orderEntry type="library" exported="" name="play-services-appindexing-7.5.0" level="project" />
<orderEntry type="library" exported="" name="play-services-location-7.5.0" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-7.5.0" level="project" />
<orderEntry type="library" exported="" name="android-maps-utils-0.3.4" level="project" />
<orderEntry type="library" exported="" name="support-v4-22.1.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.1.1" level="project" />
<orderEntry type="library" exported="" name="cardview-v7-22.1.1" level="project" />
<orderEntry type="library" exported="" name="play-services-safetynet-7.5.0" level="project" />
<orderEntry type="library" exported="" name="play-services-base-7.5.0" level="project" />
<orderEntry type="library" exported="" name="play-services-7.5.0" level="project" />
<orderEntry type="library" exported="" name="play-services-gcm-7.5.0" level="project" />
<orderEntry type="library" exported="" name="play-services-appinvite-7.5.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-22.2.0" level="project" />
<orderEntry type="library" exported="" name="play-services-fitness-7.5.0" level="project" />
<orderEntry type="library" exported="" name="play-services-nearby-7.5.0" level="project" />
<orderEntry type="library" exported="" name="play-services-plus-7.5.0" level="project" />
<orderEntry type="library" exported="" name="play-services-wearable-7.5.0" level="project" />
<orderEntry type="library" exported="" name="play-services-appstate-7.5.0" level="project" />
<orderEntry type="library" exported="" name="play-services-games-7.5.0" level="project" />
<orderEntry type="library" exported="" name="play-services-identity-7.5.0" level="project" />
<orderEntry type="library" exported="" name="play-services-maps-7.5.0" level="project" />
<orderEntry type="library" exported="" name="cardview-v7-22.2.0" level="project" />
</component>
</module>
5 changes: 3 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ if (propsFile.exists()) {
}

dependencies {
compile 'com.google.maps.android:android-maps-utils:0.3+'
compile 'com.google.maps.android:android-maps-utils:+'
compile "com.android.support:recyclerview-v7:+"
compile "com.android.support:cardview-v7:+"
// You must install or update the Google Repository through the SDK manager to use this dependency.
// The Google Repository (separate from the corresponding library) can be found in the Extras category.
compile 'com.google.android.gms:play-services:4.2.42'
compile 'com.google.android.gms:play-services:+'
compile 'com.google.code.gson:gson:+'
compile fileTree(dir: 'libs', include: ['*.jar'])
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.valxp.app.infiniteflightwatcher.activities;

import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.CardView;
Expand All @@ -11,9 +13,12 @@
import android.view.ViewGroup;
import android.widget.TextView;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.valxp.app.infiniteflightwatcher.AppUpdater;
import com.valxp.app.infiniteflightwatcher.R;
import com.valxp.app.infiniteflightwatcher.TimeProvider;
import com.valxp.app.infiniteflightwatcher.Utils;
import com.valxp.app.infiniteflightwatcher.model.Server;

import java.util.HashMap;
Expand All @@ -31,6 +36,7 @@ public class ServerChooserActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Utils.initContext(this);
setContentView(R.layout.activity_server_chooser);
mServerListView = (RecyclerView) findViewById(R.id.server_list);
mLoadingContainer = findViewById(R.id.loading_container);
Expand Down Expand Up @@ -72,7 +78,18 @@ public void run() {
@Override
protected void onResume() {
super.onResume();

int ret = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(this);
if (ret != ConnectionResult.SUCCESS) {
Dialog errDialog = GoogleApiAvailability.getInstance().getErrorDialog(this, ret, 0);
errDialog.setCancelable(false);
errDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialogInterface) {
finish();
}
});
errDialog.show();
}
}

@Override
Expand Down

0 comments on commit b59571e

Please sign in to comment.