Search in sources :

Example 1 with IabHelper

use of com.onesignal.example.iap.IabHelper in project OneSignal-Android-SDK by OneSignal.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Log.e("tet", Locale.getDefault().getLanguage());
    OneSignal.setInFocusDisplaying(OneSignal.OSInFocusDisplayOption.InAppAlert);
    OneSignal.sendTag("test3", "test7");
    //OneSignal.setSubscription(false);
    OneSignal.syncHashedEmail("test@onesignal.com");
    //        OneSignal.idsAvailable(new OneSignal.IdsAvailableHandler() {
    //            @Override
    //            public void idsAvailable(String userId, String registrationId) {
    //                Log.i("OneSignal Example:", "UserID: " + userId + ", RegId: " + (registrationId != null ? registrationId : "null"));
    //
    //                try {
    //                    OneSignal.postNotification(new JSONObject("{'contents': {'en':'Test Message'}, 'include_player_ids': ['" + userId + "']}"), null);
    //                    //OneSignal.postNotification(new JSONObject("{'contents': {'en':'Test Message'}, 'include_player_ids': ['" + "86480bb0-ef9a-11e4-8cf1-000c29917011', '2def6d7a-4395-11e4-890a-000c2940e62c" + "']}"), null);
    //                } catch (JSONException e) {
    //                    e.printStackTrace();
    //                }
    //            }
    //        });
    // compute your public key and store it in base64EncodedPublicKey
    mHelper = new IabHelper(this, "sdafsfds");
    mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {

        public void onIabSetupFinished(IabResult result) {
            if (!result.isSuccess()) {
                // Oh noes, there was a problem.
                Log.d("OneSignalExample", "Problem setting up In-app Billing: " + result);
            }
        // Hooray, IAB is fully set up!
        }
    });
}
Also used : IabResult(com.onesignal.example.iap.IabResult) IabHelper(com.onesignal.example.iap.IabHelper)

Aggregations

IabHelper (com.onesignal.example.iap.IabHelper)1 IabResult (com.onesignal.example.iap.IabResult)1