本文整理汇总了Java中com.tencent.android.tpush.XGPushManager类的典型用法代码示例。如果您正苦于以下问题:Java XGPushManager类的具体用法?Java XGPushManager怎么用?Java XGPushManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XGPushManager类属于com.tencent.android.tpush包,在下文中一共展示了XGPushManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onStart
import com.tencent.android.tpush.XGPushManager; //导入依赖的package包/类
@Override
protected void onStart() {
super.onStart();
XGPushClickedResult result = XGPushManager.onActivityStarted(this);
if (result != null) {
String custom = result.getCustomContent();
if (custom != null && !custom.isEmpty()) {
try {
JSONObject json = new JSONObject(custom);
String url = json.getString("param_url");
// Intent mainIntent = new Intent(this, MainActivity_.class);
// mainIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// mainIntent.putExtra("mPushUrl", url);
// startActivity(mainIntent);
Intent resultIntent = new Intent(MyPushReceiver.PushClickBroadcast);
resultIntent.setPackage("net.coding.program");
resultIntent.putExtra("data", url);
sendBroadcast(resultIntent);
finish();
} catch (Exception e) {
Global.errorLog(e);
}
}
}
}
示例2: loginOut
import com.tencent.android.tpush.XGPushManager; //导入依赖的package包/类
@Click
void loginOut() {
showDialog(MyApp.sUserObject.global_key, "退出当前账号?", (dialog, which) -> {
XGPushManager.registerPush(getActivity(), "*");
AccountInfo.loginOut(getActivity());
startActivity(new Intent(getActivity(), GuideActivity.class));
getActivity().finish();
});
}
示例3: updateNotifyService
import com.tencent.android.tpush.XGPushManager; //导入依赖的package包/类
private void updateNotifyService() {
boolean needPush = AccountInfo.getNeedPush(this);
if (needPush) {
String globalKey = MyApp.sUserObject.global_key;
XGPushManager.registerPush(this, globalKey);
} else {
XGPushManager.registerPush(this, "*");
}
}
示例4: onCreate
import com.tencent.android.tpush.XGPushManager; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 调用下,防止收到上次登陆账号的通知
XGPushManager.registerPush(this, "*");
}
示例5: getUserBean
import com.tencent.android.tpush.XGPushManager; //导入依赖的package包/类
public static UserBean getUserBean(Context context) {
Preference preference = Preference.instance(context);
if (CheckUtils.stringIsEmpty(preference.getString(Preference.SX_USER))) {
return null;
}
if (userBean == null) {
userBean = new UserBean();
String user = preference.getString(Preference.SX_USER);
userBean.setSessionId(preference.getString(Preference.SESSION_ID));
userBean.setSxAcount(user);
XGPushManager.registerPush(context, user);
// XGPushConfig.enableDebug(context, true);
}
return userBean;
}
示例6: onResume
import com.tencent.android.tpush.XGPushManager; //导入依赖的package包/类
@Override
protected void onResume() {
Log.i(tag,"onResume");
super.onResume();
XGPushClickedResult click = XGPushManager.onActivityStarted(this);
Log.i(tag, "onResumeXGPushClickedResult:" + click);
if (click != null) { // 判断是否来自信鸽的打开方式
Toast.makeText(this, "通知被点击:" + click.toString(), Toast.LENGTH_SHORT).show();
Log.i(tag,"通知被点击:" + click.toString());
}
}
示例7: notify
import com.tencent.android.tpush.XGPushManager; //导入依赖的package包/类
/**
* send local notify
* @param title
* @param content
* @param callbackContext
* @return
*/
public boolean notify(String title,String content,final CallbackContext callbackContext) {
XGLocalMessage localMessage = new XGLocalMessage();
localMessage.setContent(content);
localMessage.setTitle(title);
localMessage.setType(1);
//localMessage.setBuilderId(XGPushConfig.);
Long msgId = XGPushManager.addLocalNotification(this.cordova.getActivity(),localMessage);
callbackContext.success(""+msgId);
return true;
}
示例8: configure
import com.tencent.android.tpush.XGPushManager; //导入依赖的package包/类
public boolean configure(Long accessId,String accessKey,boolean debug,final CallbackContext callbackContext) {
XGPushConfig.setAccessId(this.cordova.getActivity(), accessId);
XGPushConfig.setAccessKey(this.cordova.getActivity(), accessKey);
XGPushConfig.enableDebug(this.cordova.getActivity(), debug);
XGPushManager.onActivityStarted(this.cordova.getActivity());
callbackContext.success();
return true;
}
示例9: onViewClicked
import com.tencent.android.tpush.XGPushManager; //导入依赖的package包/类
@OnClick({R.id.iv_nav_avatar, R.id.tv_nav_name, R.id.tv_nav_private_message,
R.id.tv_nav_update, R.id.tv_nav_share, R.id.tv_nav_logout, R.id.tv_nav_about,
R.id.tv_nav_fback, R.id.imgbtn_menusetting, R.id.imgbtn_bell,
R.id.tv_tongzhi_contont, R.id.tv_tongzhi_title, R.id.tv_notice_maincontent})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.iv_nav_avatar:
startActivity(UserInfoActivity.class);
break;
case R.id.tv_nav_name:
startActivity(UserInfoActivity.class);
break;
case R.id.tv_nav_private_message:
mainPresenter.startChat();
break;
case R.id.tv_nav_update:
Beta.checkUpgrade();
break;
case R.id.tv_nav_share:
mainPresenter.share();
break;
case R.id.tv_nav_logout:
final CommonDialog commonDialog = new CommonDialog(context);
commonDialog
.setMessage("确定退出?")
.setPositiveButton("是的", new View.OnClickListener() {
@Override
public void onClick(View v) {
RongIM.getInstance().logout();
XGPushManager.deleteTag(getApplicationContext(), user.getStudentKH());
XGPushManager.registerPush(getApplicationContext(), "*");
XGPushManager.unregisterPush(getApplicationContext());
startActivity(LoginActivity.class);
commonDialog.dismiss();
finish();
}
})
.setNegativeButton("再想想", null)
.show();
break;
case R.id.tv_nav_about:
startActivity(AboutActivity.class);
break;
case R.id.tv_nav_fback:
startActivity(FeedBackActivity.class);
break;
case R.id.imgbtn_menusetting:
rootView.open();
break;
case R.id.imgbtn_bell:
mainPresenter.startChat();
break;
case R.id.tv_tongzhi_title:
case R.id.tv_tongzhi_contont:
if (notice != null) {
Bundle bundle = new Bundle();
bundle.putLong("noticeId", notice.getId());
startActivity(NoticeItemActivity.class, bundle);
}
break;
case R.id.tv_notice_maincontent:
startActivity(NoticeActivity.class);
break;
}
}
示例10: onCreate
import com.tencent.android.tpush.XGPushManager; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.inject(this);
// 注册网络变化广播,必须放在夜间模式前,否则recreate时回调onDestroy时unregister出错
IntentFilter intentFilter = new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE");
registerReceiver(mNetChangedReceiver, intentFilter);
// 首次进入跳转到LoginActivity
if (!SPUtils.getBoolean(LoginActivity.IS_REGISTER)) {
startActivity(new Intent(this, LoginActivity.class));
finish();
return; // must return here
}
// XingePush
Context context = getApplicationContext();
XGPushManager.registerPush(context, AppInfoUtils.getImei());
// 事件总线
EventBus.getDefault().register(this);
// 状态栏
UiUtils.setTranslucentStatusBar(this, mNavigationView);
// 夜间模式
if (UiUtils.isNightMode(this)) {
return;
}
// 检查更新
if (SettingUtils.autoCheckUpdate()) {
mUpdatePresenter = new UpdatePresenter(this);
mUpdatePresenter.checkNewVersion();
}
initToolbar();
initNavigationView();
initFab();
initFragment();
}
示例11: onCreate
import com.tencent.android.tpush.XGPushManager; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_show_luntan);
instance=this;
users = SaveUserUtil.loadAccount(this);
result = XGPushManager.onActivityStarted(ShowLuntanActivity.this);
if (result != null) {
xg_bool = true;
// 获取自定义key-value
String customContent = result.getCustomContent();
if (customContent != null && customContent.length() != 0) {
try {
JSONObject obj = new JSONObject(customContent);
// key1为前台配置的key
if (!obj.isNull("data")) {
news_luntan = new News_luntan();
String data = obj.getString("data");
JSONObject object = new JSONObject(data);
User userr = new User();
userr.setUser(object.getString("user"));
userr.setNickname(object.getString("nickname"));
userr.setIcon(object.getString("icon"));
userr.setSex(object.getString("sex"));
news_luntan.setUser(userr);
news_luntan.setLid(object.getInt("lid"));
news_luntan.setContent(object.getString("content"));
news_luntan.setImage(object.getString("image"));
news_luntan.setTime(object.getString("time"));
news_luntan.setLocation(object.getString("location"));
}
// ...
} catch (JSONException e) {
e.printStackTrace();
}
}
} else {
intent = getIntent();
news_luntan = (News_luntan) intent.getSerializableExtra("news_luntan");
}
initialView();
}
示例12: onDestroy
import com.tencent.android.tpush.XGPushManager; //导入依赖的package包/类
@Override
protected void onDestroy() {
super.onDestroy();
XGPushManager.unregisterPush(this);
}
示例13: onStart
import com.tencent.android.tpush.XGPushManager; //导入依赖的package包/类
@Override
protected void onStart() {
super.onStart();
XGPushManager.onActivityStarted(this);
}
示例14: onStop
import com.tencent.android.tpush.XGPushManager; //导入依赖的package包/类
@Override
protected void onStop() {
super.onStop();
XGPushManager.onActivityStoped(this);
}
示例15: cleanUser
import com.tencent.android.tpush.XGPushManager; //导入依赖的package包/类
public static void cleanUser(Context context) {
userBean = null;
XGPushManager.unregisterPush(context);
}