app/src/main/java/de/ahlfeld/breminale/app/services/GcmRegistrationService.java
private void sendRegistrationToServer(JsonObject device) {
        // Add custom implementation, as needed.
        final BreminaleService service = BreminaleService.Factory.create();
        BlockingObservable<JsonObject> call = service.postDeviceToken(BuildConfig.BREMINALE_API_KEY, device).toBlocking();

        call.subscribe(new Subscriber<JsonObject>() {
            @Override
            public void onCompleted() {
                SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(GcmRegistrationService.this);
                sharedPreferences.edit().putBoolean(BreminaleConsts.SENT_TOKEN_TO_SERVER, true).apply();
            }

            @Override
            public void onError(Throwable e) {
                Log.e(TAG, "An error accured while sending divce object", e);
            }

            @Override
            public void onNext(JsonObject jsonObject) {
                Log.i(TAG, jsonObject.toString());
            }
        });
    }
/**
     * Persist registration to third-party servers.
     * <p>
     * Modify this method to associate the user's GCM registration token with any server-side account
     * maintained by your application.
     *
     * @param device The new device object.
     */
Persist registration to third-party servers.

Modify this method to associate the user's GCM registration token with any server-side account
maintained by your application.

@param device The new device object.
Persist registration to third - party servers . Modify this method to associate the user ' s GCM registration token with any server - side account maintained by your application . @param device The new device object .
private void sendRegistrationToServer(JsonObject device) {
        final BreminaleService service = BreminaleService.Factory.create();
        BlockingObservable<JsonObject> call = service.postDeviceToken(BuildConfig.BREMINALE_API_KEY, device).toBlocking();
        call.subscribe(new Subscriber<JsonObject>() {
            @Override
            public void onCompleted() {
                SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(GcmRegistrationService.this);
                sharedPreferences.edit().putBoolean(BreminaleConsts.SENT_TOKEN_TO_SERVER, true).apply();
            }
            @Override
            public void onError(Throwable e) {
                Log.e(TAG, "An error accured while sending divce object", e);
            }
            @Override
            public void onNext(JsonObject jsonObject) {
                Log.i(TAG, jsonObject.toString());
            }
        });
    }
private void sendRegistrationToServer ( JsonObject device ) { final BreminaleService service = BreminaleService . Factory . create ( ) ; BlockingObservable < JsonObject > call = service . postDeviceToken ( BuildConfig . BREMINALE_API_KEY , device ) . toBlocking ( ) ; call . subscribe ( new Subscriber < JsonObject > ( ) { @ Override public void onCompleted ( ) { SharedPreferences sharedPreferences = PreferenceManager . getDefaultSharedPreferences ( GcmRegistrationService . this ) ; sharedPreferences . edit ( ) . putBoolean ( BreminaleConsts . SENT_TOKEN_TO_SERVER , true ) . apply ( ) ; } @ Override public void onError ( Throwable e ) { Log . e ( TAG , "An error accured while sending divce object" , e ) ; } @ Override public void onNext ( JsonObject jsonObject ) { Log . i ( TAG , jsonObject . toString ( ) ) ; } } ) ; }
Persist registration to third-party servers.
Persist registration to third - party servers .
// Add custom implementation, as needed.