当前位置: 首页>>代码示例>>Java>>正文


Java OneSignal类代码示例

本文整理汇总了Java中com.onesignal.OneSignal的典型用法代码示例。如果您正苦于以下问题:Java OneSignal类的具体用法?Java OneSignal怎么用?Java OneSignal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OneSignal类属于com.onesignal包,在下文中一共展示了OneSignal类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendOneSignalTags

import com.onesignal.OneSignal; //导入依赖的package包/类
public void sendOneSignalTags() {
    try {
        JSONObject tags = new JSONObject();
        tags.put("ImportantInformation", PreferenceManager.getDefaultSharedPreferences(applicationContext).getBoolean("important_switch", true));
        tags.put("UnavailableStations", PreferenceManager.getDefaultSharedPreferences(applicationContext).getBoolean("unavailable_switch", true));
        tags.put("AvailableStations", PreferenceManager.getDefaultSharedPreferences(applicationContext).getBoolean("available_switch", true));
        tags.put("NewStations", PreferenceManager.getDefaultSharedPreferences(applicationContext).getBoolean("new_stations_switch", true));
        tags.put("AirQualityAlerts", PreferenceManager.getDefaultSharedPreferences(applicationContext).getBoolean("air_quality_switch", true));
        tags.put("rate", Preferences.getInstance(applicationContext).isRateDone());
        Gson gson = new Gson();
        FavoriteItem[] favorites = gson.fromJson(Preferences.getInstance(applicationContext).getIdFav(), FavoriteItem[].class);
        if (favorites != null && favorites.length > 0) {
            for (int i = 0; i < favorites.length; i++) {
                String favText = String.format("Station%s", favorites[i].getId());
                tags.put(favText, true);
            }
        }
        OneSignal.sendTags(tags);
    } catch (JSONException e) {
        //e.printStackTrace();
    }
}
 
开发者ID:Mun0n,项目名称:MADBike,代码行数:23,代码来源:OneSignalUtils.java

示例2: onResume

import com.onesignal.OneSignal; //导入依赖的package包/类
@Override
protected void onResume() {
    super.onResume();

    userStatusRef.setValue(UserStatus.ONLINE.ordinal());

    // Clear all notification
    OneSignal.clearOneSignalNotifications();

    // Check contacts
    if (AppManager.getInstance().phoneContacts.isEmpty() && !AppManager.getInstance().loadedPhoneContacts) {
        // analysis
        Bundle params = new Bundle();
        params.putString("user", mUser.getPhone());
        References.getInstance().analytics.logEvent("empty_contacts", params);
        startActivity(new Intent(this, AppSplashActivity.class));
        this.finish();
        AppManager.getInstance().loadedPhoneContacts = true;
    }
}
 
开发者ID:AppHero2,项目名称:Raffler-Android,代码行数:21,代码来源:MainActivity.java

示例3: onCreate

import com.onesignal.OneSignal; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    OneSignal.init(this, "", "", new NotificationOpenedHandler() {
        @Override
        public void notificationOpened(String s, JSONObject jsonObject, boolean b) {
        }
    });

    tvAddress = (TextView) findViewById(R.id.tvAddress);
    tvDateTime = (TextView) findViewById(R.id.tvDateTime);
    tvTitle = (TextView) findViewById(R.id.tvTitle);
    tvDetails = (TextView) findViewById(R.id.tvDetails);
    mainProgressBar = (ProgressBar) findViewById(R.id.mainProgressBar);
    mainView = (LinearLayout) findViewById(R.id.mainView);
    failedView = (LinearLayout) findViewById(R.id.failedView);

    LoadData();
}
 
开发者ID:SamsamBabadi,项目名称:HamfekrEsfahan,代码行数:22,代码来源:MainActivity.java

示例4: onCreate

import com.onesignal.OneSignal; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();

    // http://stackoverflow.com/a/9752494
    try {
        Class.forName("android.os.AsyncTask");
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }

    OneSignal.startInit(this).init();
		
    OneSignal.idsAvailable(new OneSignal.IdsAvailableHandler() {
        @Override
        public void idsAvailable(String userId, String registrationId) {
            setOneSignalPlayerId(userId);
        }
    });		
}
 
开发者ID:ReyKoxha,项目名称:nodebb-webview,代码行数:21,代码来源:WebAppApplication.java

示例5: registerOneSignal

import com.onesignal.OneSignal; //导入依赖的package包/类
private void registerOneSignal(final String deviceName) {
    OneSignal
            .startInit(ApplicationController.getInstance().getApplicationContext())
            .inFocusDisplaying(OneSignal.OSInFocusDisplayOption.None)
            .init();

    OneSignal.idsAvailable(new OneSignal.IdsAvailableHandler() {
        @Override
        public void idsAvailable(String userId, String registrationId) {
            String deviceToken = userId;
            spEditor.putString("one_signal_device_token", userId);
            spEditor.commit();

            // Log it for debugging purposes
            Log.d("RegisterNotifications", "OneSignal device token: " + deviceToken + " - Device Name: " + deviceName);

            if (shouldRegister(deviceToken)) {
                registerWithServer(deviceToken, deviceName);
            }
        }
    });
}
 
开发者ID:wcomartin,项目名称:PlexPy-Remote,代码行数:23,代码来源:RegisterForPushNotificationsAsync.java

示例6: setAllSwitch

import com.onesignal.OneSignal; //导入依赖的package包/类
public void setAllSwitch(boolean key) {
    this.sharedPrefs = this.appContext.getSharedPreferences(PREFS_NAME, 0);
    this.prefsEditor = this.sharedPrefs.edit();
    this.prefsEditor.putBoolean(PREFS_SWITCH_ALL, key);
    this.prefsEditor.apply();
    if (key) {
        resetSwitches();
    } else {
        JSONObject tags = new JSONObject();
        try {
            tags.put("ALL-Filter", false);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        OneSignal.sendTags(tags);
    }
}
 
开发者ID:ItsCalebJones,项目名称:SpaceLaunchNow-Android,代码行数:18,代码来源:SwitchPreferences.java

示例7: onCreate

import com.onesignal.OneSignal; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    sInstance = this;
    FacebookSdk.sdkInitialize(getApplicationContext());
    AppEventsLogger.activateApp(this);
    OneSignal.startInit(this).setNotificationOpenedHandler(new MADBikeNotificationOpenedHandler(this)).init();
    Branch.getAutoInstance(this);
    Dexter.initialize(this);
}
 
开发者ID:Mun0n,项目名称:MADBike,代码行数:11,代码来源:MADBikeApplication.java

示例8: onCreate

import com.onesignal.OneSignal; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    OneSignal.startInit(this)
            .inFocusDisplaying(OneSignal.OSInFocusDisplayOption.InAppAlert)
            .setNotificationReceivedHandler(new ExampleNotificationReceivedHandler())
            .setNotificationOpenedHandler(new ExampleNotificationOpenedHandler()).init();

    myApplication=this;
}
 
开发者ID:appteam-nith,项目名称:Hillffair17,代码行数:11,代码来源:MyApplication.java

示例9: onCreate

import com.onesignal.OneSignal; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    OneSignal.startInit(this)
            .inFocusDisplaying(OneSignal.OSInFocusDisplayOption.InAppAlert)
            .setNotificationReceivedHandler(new ExampleNotificationReceivedHandler())
            .setNotificationOpenedHandler(new ExampleNotificationOpenedHandler()).init();
    myApplication=this;
}
 
开发者ID:appteam-nith,项目名称:Nimbus,代码行数:10,代码来源:MyApplication.java

示例10: setSwitchVan

import com.onesignal.OneSignal; //导入依赖的package包/类
public void setSwitchVan(boolean key) {
    this.sharedPrefs = this.appContext.getSharedPreferences(PREFS_NAME, 0);
    this.prefsEditor = this.sharedPrefs.edit();
    this.prefsEditor.putBoolean(PREFS_SWITCH_VAN, key);
    this.prefsEditor.apply();
    JSONObject tags = new JSONObject();
    try {
        tags.put("Van", key);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    OneSignal.sendTags(tags);
}
 
开发者ID:ItsCalebJones,项目名称:SpaceLaunchNow-Android,代码行数:14,代码来源:SwitchPreferences.java

示例11: setSwitchKSC

import com.onesignal.OneSignal; //导入依赖的package包/类
public void setSwitchKSC(boolean key) {
    this.sharedPrefs = this.appContext.getSharedPreferences(PREFS_NAME, 0);
    this.prefsEditor = this.sharedPrefs.edit();
    this.prefsEditor.putBoolean(PREFS_SWITCH_KSC, key);
    this.prefsEditor.apply();
    JSONObject tags = new JSONObject();
    try {
        tags.put("KSC", key);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    OneSignal.sendTags(tags);
}
 
开发者ID:ItsCalebJones,项目名称:SpaceLaunchNow-Android,代码行数:14,代码来源:SwitchPreferences.java

示例12: setSwitchPles

import com.onesignal.OneSignal; //导入依赖的package包/类
public void setSwitchPles(boolean key) {
    this.sharedPrefs = this.appContext.getSharedPreferences(PREFS_NAME, 0);
    this.prefsEditor = this.sharedPrefs.edit();
    this.prefsEditor.putBoolean(PREFS_SWITCH_PLES, key);
    this.prefsEditor.apply();
    JSONObject tags = new JSONObject();
    try {
        tags.put("Ples", key);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    OneSignal.sendTags(tags);
}
 
开发者ID:ItsCalebJones,项目名称:SpaceLaunchNow-Android,代码行数:14,代码来源:SwitchPreferences.java

示例13: setSwitchCape

import com.onesignal.OneSignal; //导入依赖的package包/类
public void setSwitchCape(boolean key) {
    this.sharedPrefs = this.appContext.getSharedPreferences(PREFS_NAME, 0);
    this.prefsEditor = this.sharedPrefs.edit();
    this.prefsEditor.putBoolean(PREFS_SWITCH_CAPE, key);
    this.prefsEditor.apply();
    JSONObject tags = new JSONObject();
    try {
        tags.put("Cape", key);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    OneSignal.sendTags(tags);
}
 
开发者ID:ItsCalebJones,项目名称:SpaceLaunchNow-Android,代码行数:14,代码来源:SwitchPreferences.java

示例14: setSwitchNasa

import com.onesignal.OneSignal; //导入依赖的package包/类
public void setSwitchNasa(boolean key) {
    this.sharedPrefs = this.appContext.getSharedPreferences(PREFS_NAME, 0);
    this.prefsEditor = this.sharedPrefs.edit();
    this.prefsEditor.putBoolean(PREFS_SWITCH_NASA, key);
    this.prefsEditor.apply();
    JSONObject tags = new JSONObject();

    try {
        tags.put("Nasa", key);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    OneSignal.sendTags(tags);
}
 
开发者ID:ItsCalebJones,项目名称:SpaceLaunchNow-Android,代码行数:15,代码来源:SwitchPreferences.java

示例15: setSwitchSpaceX

import com.onesignal.OneSignal; //导入依赖的package包/类
public void setSwitchSpaceX(boolean key) {
    this.sharedPrefs = this.appContext.getSharedPreferences(PREFS_NAME, 0);
    this.prefsEditor = this.sharedPrefs.edit();
    this.prefsEditor.putBoolean(PREFS_SWITCH_SPACEX, key);
    this.prefsEditor.apply();
    JSONObject tags = new JSONObject();
    try {
        tags.put("SpaceX", key);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    OneSignal.sendTags(tags);
}
 
开发者ID:ItsCalebJones,项目名称:SpaceLaunchNow-Android,代码行数:14,代码来源:SwitchPreferences.java


注:本文中的com.onesignal.OneSignal类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。