• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java OneSignal类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: setSwitchRoscosmos

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


示例17: setSwitchULA

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

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


示例18: setSwitchArianespace

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


示例19: setSwitchCASC

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

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


示例20: setSwitchISRO

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

    try {
        tags.put("ISRO", key);
    } catch (JSONException e) {
        e.printStackTrace();
    }

    OneSignal.sendTags(tags);
}
 
开发者ID:ItsCalebJones,项目名称:SpaceLaunchNow-Android,代码行数:16,代码来源:SwitchPreferences.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CodeSetComponentInfo类代码示例发布时间:2022-05-22
下一篇:
Java IsCancelled类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap