Android Open Source - android-sdk-demo-app Http Post Api Subscription Service






From Project

Back to project page android-sdk-demo-app.

License

The source code is released under:

MIT License

If you think the Android project android-sdk-demo-app listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.measurence.sdk.android.api_subscription.httppost;
/*from   w  ww .j a  v  a2 s  .c  om*/
import android.util.Log;

import com.measurence.sdk.android.api_subscriptions.HttpPostSubscription;
import com.measurence.sdk.android.api_subscriptions.HttpPostSubscriptionException;
import com.measurence.sdk.android.api_subscriptions.MeasurenceAPISubscriptions;
import com.measurence.sdk.android.api_subscription.MeasurenceApiSubscriptionService;
import com.measurence.sdk.android.util.DeviceMacAddress;

public class HttpPostApiSubscriptionService extends MeasurenceApiSubscriptionService {

    private String LOG_TAG = "Measurence " + MeasurenceApiSubscriptionService.class.getSimpleName();

    @Override
    protected void applyToSubscriptionAndNotifyResult(String user_identity) {
        try {
            HttpPostSubscription androidHttpPostSubscription = new HttpPostSubscription(
                    getMeasurencePartnerId(),
                    user_identity,
                    DeviceMacAddress.get(this)
            );
            MeasurenceAPISubscriptions.SubscriptionResult subscriptionResult = measurenceAPISubscriptions.applyToBackEndHttpPostNotification(androidHttpPostSubscription);

            Log.i(LOG_TAG, "http post subscription result|" + subscriptionResult);
            notifySubscriptionResult("HTTP Post Subscription succeeded. Outcome: \"" + subscriptionResult + "\"");
        } catch (HttpPostSubscriptionException e) {
            notifySubscriptionResult("HTTP Post Subscription failed. Error: \"" + e.getMessage() + "\"");
            e.printStackTrace();
        }
    }
}




Java Source Code List

com.measurence.sdk.android.api_subscription.MeasurenceApiSubscriptionService.java
com.measurence.sdk.android.api_subscription.gcm.AndroidApiSubscriptionService.java
com.measurence.sdk.android.api_subscription.gcm.GCMRegistrationIdUtil.java
com.measurence.sdk.android.api_subscription.httppost.HttpPostApiSubscriptionService.java
com.measurence.sdk.android.demo.ApplicationTest.java
com.measurence.sdk.android.demo.MainActivity.java
com.measurence.sdk.android.demo.NotificationsFragment.java
com.measurence.sdk.android.gcm_push_notifications.GcmPushNotificationsReceiver.java
com.measurence.sdk.android.gcm_push_notifications.PresenceSessionUpdatesNotificationService.java