Search in sources :

Example 1 with GooglePlayServicesNotAvailableException

use of com.google.android.gms.common.GooglePlayServicesNotAvailableException in project Ushahidi_Android by ushahidi.

the class ViewReportFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout containing a title and body text.
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.view_report, container, false);
    mView = new ViewReportView(rootView, getActivity());
    mReports = new ListReportModel();
    mView.mMapView.onCreate(savedInstanceState);
    if (mCategoryId > 0) {
        mReports.loadReportByCategory(mCategoryId);
    } else {
        mReports.load();
    }
    // Get GoogleMap from MapView
    mMap = mView.mMapView.getMap();
    try {
        MapsInitializer.initialize(getActivity());
    } catch (GooglePlayServicesNotAvailableException e) {
        e.printStackTrace();
    }
    // Initialize views with report data. This also handles map
    // initialization
    initReport(mPageNumber);
    fetchComments();
    // Set the title view to show the page number.
    mView.setPageIndicator(getString(R.string.title_template_step, mPageNumber + 1, mReports.getReports().size()));
    return rootView;
}
Also used : ViewGroup(android.view.ViewGroup) ListReportModel(com.ushahidi.android.app.models.ListReportModel) ViewReportView(com.ushahidi.android.app.views.ViewReportView) GooglePlayServicesNotAvailableException(com.google.android.gms.common.GooglePlayServicesNotAvailableException)

Example 2 with GooglePlayServicesNotAvailableException

use of com.google.android.gms.common.GooglePlayServicesNotAvailableException in project grpc-java by grpc.

the class TesterInstrumentation method onCreate.

@Override
public void onCreate(Bundle args) {
    super.onCreate(args);
    testCase = args.getString("test_case") != null ? args.getString("test_case") : "empty_unary";
    host = args.getString("server_host");
    port = Integer.parseInt(args.getString("server_port"));
    serverHostOverride = args.getString("server_host_override");
    useTls = args.getString("use_tls") != null ? Boolean.parseBoolean(args.getString("use_tls")) : true;
    useTestCa = args.getString("use_test_ca") != null ? Boolean.parseBoolean(args.getString("use_test_ca")) : false;
    androidSocketFactoryTls = args.getString("android_socket_factory_tls");
    InputStream testCa = null;
    if (useTestCa) {
        testCa = getContext().getResources().openRawResource(R.raw.ca);
    }
    if (useTls) {
        try {
            ProviderInstaller.installIfNeeded(getContext());
        } catch (GooglePlayServicesRepairableException e) {
            // The provider is helpful, but it is possible to succeed without it.
            // Hope that the system-provided libraries are new enough.
            Log.w(InteropTester.LOG_TAG, "Failed installing security provider", e);
        } catch (GooglePlayServicesNotAvailableException e) {
            // The provider is helpful, but it is possible to succeed without it.
            // Hope that the system-provided libraries are new enough.
            Log.w(InteropTester.LOG_TAG, "Failed installing security provider", e);
        }
    }
    try {
        new InteropTester(testCase, TesterOkHttpChannelBuilder.build(host, port, serverHostOverride, useTls, testCa, androidSocketFactoryTls), new InteropTester.TestListener() {

            @Override
            public void onPreTest() {
            }

            @Override
            public void onPostTest(String result) {
                Bundle bundle = new Bundle();
                bundle.putString("grpc test result", result);
                if (InteropTester.SUCCESS_MESSAGE.equals(result)) {
                    finish(0, bundle);
                } else {
                    finish(1, bundle);
                }
            }
        }).execute();
    } catch (Throwable t) {
        Bundle bundle = new Bundle();
        bundle.putString("Exception encountered", t.toString());
        finish(1, bundle);
    }
}
Also used : InputStream(java.io.InputStream) Bundle(android.os.Bundle) Throwable(java.lang.Throwable) GooglePlayServicesRepairableException(com.google.android.gms.common.GooglePlayServicesRepairableException) GooglePlayServicesNotAvailableException(com.google.android.gms.common.GooglePlayServicesNotAvailableException)

Aggregations

GooglePlayServicesNotAvailableException (com.google.android.gms.common.GooglePlayServicesNotAvailableException)2 Bundle (android.os.Bundle)1 ViewGroup (android.view.ViewGroup)1 GooglePlayServicesRepairableException (com.google.android.gms.common.GooglePlayServicesRepairableException)1 ListReportModel (com.ushahidi.android.app.models.ListReportModel)1 ViewReportView (com.ushahidi.android.app.views.ViewReportView)1 InputStream (java.io.InputStream)1 Throwable (java.lang.Throwable)1