本文整理匯總了Java中com.google.android.gms.common.GooglePlayServicesNotAvailableException類的典型用法代碼示例。如果您正苦於以下問題:Java GooglePlayServicesNotAvailableException類的具體用法?Java GooglePlayServicesNotAvailableException怎麽用?Java GooglePlayServicesNotAvailableException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
GooglePlayServicesNotAvailableException類屬於com.google.android.gms.common包,在下文中一共展示了GooglePlayServicesNotAvailableException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: selectCity
import com.google.android.gms.common.GooglePlayServicesNotAvailableException; //導入依賴的package包/類
@OnClick(R.id.weather_city)
public void selectCity() {
//restrict to cities
AutocompleteFilter cityFilter = new AutocompleteFilter.Builder()
.setTypeFilter(AutocompleteFilter.TYPE_FILTER_CITIES)
.build();
try {
Intent intent =
new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_OVERLAY)
.setFilter(cityFilter)
.build(getActivity());
startActivityForResult(intent, PLACE_AUTOCOMPLETE_REQUEST_CODE);
} catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) {
// TODO: Handle the error.
}
}
示例2: parseString
import com.google.android.gms.common.GooglePlayServicesNotAvailableException; //導入依賴的package包/類
public static String parseString(Context context, String clickUrl) throws IOException, GooglePlayServicesNotAvailableException, GooglePlayServicesRepairableException {
String deviceId = android.provider.Settings.Secure.getString(Aptoide.getContext().getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
String myid = PreferenceManager.getDefaultSharedPreferences(context).getString(EnumPreferences.APTOIDE_CLIENT_UUID.name(), "NoInfo");
if (deviceId != null) {
clickUrl = clickUrl.replace("[USER_ANDROID_ID]", deviceId);
}
if (myid != null) {
clickUrl = clickUrl.replace("[USER_UDID]", myid);
}
clickUrl = replaceAdvertisementId(clickUrl, context);
clickUrl = clickUrl.replace("[TIME_STAMP]", String.valueOf(new Date().getTime()));
return clickUrl;
}
示例3: onWaypointTitleClick
import com.google.android.gms.common.GooglePlayServicesNotAvailableException; //導入依賴的package包/類
@OnClick(R.id.reminder_item_waypoint_title_text_view)
public void onWaypointTitleClick() {
PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();
if (mRemindItem.getWaypoint() != null) {
LocationPoint locationPoint = mRemindItem.getWaypoint().getLocation();
LatLng latLng = new LatLng(locationPoint.getLatitude(), locationPoint.getLongitude());
LatLngBounds latLngBounds = new LatLngBounds(latLng, latLng);
builder.setLatLngBounds(latLngBounds);
}
Intent intent = null;
try {
intent = builder.build(getActivity());
} catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) {
e.printStackTrace();
}
mProgressDialog = ProgressDialog.show(mContext,
getString(R.string.reminder_place_picker_progress_dialog_title),
getString(R.string.reminder_place_picker_progress_dialog_message), true, false);
startActivityForResult(intent, PLACE_PICKER_REQUEST);
}
示例4: onCreate
import com.google.android.gms.common.GooglePlayServicesNotAvailableException; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_place_picker);
mName = (TextView) findViewById(R.id.textView);
mAddress = (TextView) findViewById(R.id.textView2);
mAttributions = (TextView) findViewById(R.id.textView3);
Button pickerButton = (Button) findViewById(R.id.pickerButton);
pickerButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
PlacePicker.IntentBuilder intentBuilder =
new PlacePicker.IntentBuilder();
intentBuilder.setLatLngBounds(BOUNDS_MOUNTAIN_VIEW);
Intent intent = intentBuilder.build(PlacePickerActivity.this);
startActivityForResult(intent, PLACE_PICKER_REQUEST);
} catch (GooglePlayServicesRepairableException
| GooglePlayServicesNotAvailableException e) {
e.printStackTrace();
}
}
});
}
示例5: Endpoint
import com.google.android.gms.common.GooglePlayServicesNotAvailableException; //導入依賴的package包/類
/**
* Constructor.
*
* @param context The Context to use
*/
Endpoint(@NonNull Context context) {
try {
ProviderInstaller.installIfNeeded(context);
} catch(GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) {
Log.e(TAG, e.getMessage(), e);
}
mContext = context;
final OkHttpClient.Builder builder = new OkHttpClient.Builder()
.connectTimeout(30, TimeUnit.SECONDS);
configureSSL(builder);
mClient = builder.build();
final String apiUri =
context.getString(BuildConfig.DEBUG ? R.string.api_url_debug : R.string.api_url);
mBaseUrl = HttpUrl.parse(apiUri).newBuilder()
.addEncodedPathSegment(getName())
.build();
mUserAgent = context.getString(R.string.user_agent, BuildConfig.VERSION_NAME);
loadAuthToken();
}
示例6: onOptionsItemSelected
import com.google.android.gms.common.GooglePlayServicesNotAvailableException; //導入依賴的package包/類
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_search) {
// Method #3
try {
Intent intent = new PlaceAutocomplete.IntentBuilder
(PlaceAutocomplete.MODE_OVERLAY)
.setBoundsBias(BOUNDS_MOUNTAIN_VIEW)
.build(MainActivity.this);
startActivityForResult(intent, REQUEST_SELECT_PLACE);
} catch (GooglePlayServicesRepairableException |
GooglePlayServicesNotAvailableException e) {
e.printStackTrace();
}
return true;
}
return super.onOptionsItemSelected(item);
}
示例7: installIfNeededAsync
import com.google.android.gms.common.GooglePlayServicesNotAvailableException; //導入依賴的package包/類
public static void installIfNeededAsync(Context paramContext, final ProviderInstallListener paramProviderInstallListener)
{
zzx.zzb(paramContext, "Context must not be null");
zzx.zzb(paramProviderInstallListener, "Listener must not be null");
zzx.zzcx("Must be called on the UI thread");
new AsyncTask()
{
private Integer zzc$9ecd34e()
{
try
{
ProviderInstaller.installIfNeeded(this.zzsR);
return Integer.valueOf(0);
}
catch (GooglePlayServicesRepairableException localGooglePlayServicesRepairableException)
{
return Integer.valueOf(localGooglePlayServicesRepairableException.zzVA);
}
catch (GooglePlayServicesNotAvailableException localGooglePlayServicesNotAvailableException)
{
return Integer.valueOf(localGooglePlayServicesNotAvailableException.errorCode);
}
}
}.execute(new Void[0]);
}
示例8: Bundle
import com.google.android.gms.common.GooglePlayServicesNotAvailableException; //導入依賴的package包/類
public static PendingIntent getRecoveryIfSuggested$12f08959(Context paramContext, String paramString)
throws IOException, UserRecoverableAuthException, GoogleAuthException
{
zzx.zzcy("Calling this from your main thread can lead to deadlock");
try
{
GooglePlayServicesUtil.zzae(paramContext.getApplicationContext());
final Bundle localBundle = new Bundle();
localBundle.putString(KEY_ANDROID_PACKAGE_NAME, paramContext.getPackageName());
zza local3 = new zza() {};
RecoveryDecision localRecoveryDecision = (RecoveryDecision)zza(paramContext, zzVm, local3);
if ((localRecoveryDecision.showRecoveryInterstitial) && (localRecoveryDecision.isRecoveryInterstitialAllowed)) {
return localRecoveryDecision.recoveryIntent;
}
}
catch (GooglePlayServicesRepairableException localGooglePlayServicesRepairableException)
{
throw new GooglePlayServicesAvailabilityException(localGooglePlayServicesRepairableException.zzVA, localGooglePlayServicesRepairableException.getMessage(), new Intent(localGooglePlayServicesRepairableException.mIntent));
}
catch (GooglePlayServicesNotAvailableException localGooglePlayServicesNotAvailableException)
{
throw new GoogleAuthException(localGooglePlayServicesNotAvailableException.getMessage());
}
return null;
}
示例9: zzb
import com.google.android.gms.common.GooglePlayServicesNotAvailableException; //導入依賴的package包/類
public void zzb(boolean paramBoolean)
throws IOException, IllegalStateException, GooglePlayServicesNotAvailableException, GooglePlayServicesRepairableException
{
zzx.zzcy("Calling this from your main thread can lead to deadlock");
try
{
if (this.zzpg) {
finish();
}
this.zzpe = zzq(this.mContext);
this.zzpf = zza$4541938d(this.zzpe);
this.zzpg = true;
if (paramBoolean) {
zzaW();
}
return;
}
finally {}
}
示例10: zzY
import com.google.android.gms.common.GooglePlayServicesNotAvailableException; //導入依賴的package包/類
private static zzjz zzY(Context paramContext)
throws GooglePlayServicesNotAvailableException
{
synchronized (zzqK)
{
if (zzNn == null)
{
if (paramContext.getApplicationContext() != null) {
paramContext = paramContext.getApplicationContext();
}
zzNn = zzjy.zzaa(paramContext);
}
zzjz localzzjz = zzNn;
return localzzjz;
}
}
示例11: initializeMap
import com.google.android.gms.common.GooglePlayServicesNotAvailableException; //導入依賴的package包/類
private void initializeMap() throws GooglePlayServicesNotAvailableException {
try {
MapsInitializer.initialize(getActivity());
if (getActivity().getSupportFragmentManager().findFragmentById(
R.id.mapContainer) == null) {
mapSupportFragment = MySupportMapFragment
.newInstatnce(new Bundle());
mapSupportFragment.setTargetFragment(this, 100);
if (getArguments() != null)
mapSupportFragment.setArguments(getArguments());
getActivity().getSupportFragmentManager().beginTransaction()
.add(R.id.mapContainer, mapSupportFragment).commit();
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例12: onPickEventPlaceClick
import com.google.android.gms.common.GooglePlayServicesNotAvailableException; //導入依賴的package包/類
/**
* Pick place
* https://medium.com/@hitherejoe/exploring-play-services-place-picker-autocomplete-150809f739fe
*/
@Override
public void onPickEventPlaceClick() {
PlacePicker.IntentBuilder intentBuilder = new PlacePicker.IntentBuilder();
if(editEventDataModel.getEvent().hasLocation()) {
double longitude = editEventDataModel.getEvent().getLongitude();
double latitude = editEventDataModel.getEvent().getLatitude();
double offset = 0.01;
LatLng southwest = new LatLng(latitude - offset, longitude - offset);
LatLng northeast = new LatLng(latitude + offset, longitude + offset);
intentBuilder.setLatLngBounds(new LatLngBounds(southwest, northeast));
}
try {
startActivityForResult(intentBuilder.build(this), PLACE_PICKER_REQUEST_CODE);
} catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) {
e.printStackTrace();
Toast.makeText(this, getString(R.string.unknown_error), Toast.LENGTH_LONG).show();
}
}
示例13: m
import com.google.android.gms.common.GooglePlayServicesNotAvailableException; //導入依賴的package包/類
private static void m(Context paramContext)
{
try
{
GooglePlayServicesUtil.m(paramContext);
return;
}
catch (GooglePlayServicesRepairableException localGooglePlayServicesRepairableException)
{
throw new GooglePlayServicesAvailabilityException(localGooglePlayServicesRepairableException.getConnectionStatusCode(), localGooglePlayServicesRepairableException.getMessage(), localGooglePlayServicesRepairableException.getIntent());
}
catch (GooglePlayServicesNotAvailableException localGooglePlayServicesNotAvailableException)
{
throw new GoogleAuthException(localGooglePlayServicesNotAvailableException.getMessage());
}
}
示例14: initialize
import com.google.android.gms.common.GooglePlayServicesNotAvailableException; //導入依賴的package包/類
public static int initialize(Context paramContext)
{
eg.f(paramContext);
c localc;
try
{
localc = q.u(paramContext);
}
catch (GooglePlayServicesNotAvailableException localGooglePlayServicesNotAvailableException)
{
return localGooglePlayServicesNotAvailableException.errorCode;
}
try
{
CameraUpdateFactory.a(localc.ez());
BitmapDescriptorFactory.a(localc.eA());
}
catch (RemoteException localRemoteException)
{
throw new RuntimeRemoteException(localRemoteException);
}
return 0;
}
示例15: updateAdvertisingId
import com.google.android.gms.common.GooglePlayServicesNotAvailableException; //導入依賴的package包/類
public void updateAdvertisingId() {
new Thread(new Runnable() {
@Override
public void run() {
AdvertisingIdClient.Info adInfo = null;
try {
adInfo = AdvertisingIdClient.getAdvertisingIdInfo(TweetingActivity.this);
} catch (IOException | GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException exception) {
// Unrecoverable error connecting to Google Play services (e.g.,
// the old version of the service doesn't support getting AdvertisingId).
}
if (adInfo != null) {
mAdversitingId = adInfo.getId();
}
}
});
}