本文整理汇总了Java中com.tencent.android.tpush.XGPushManager.onActivityStarted方法的典型用法代码示例。如果您正苦于以下问题:Java XGPushManager.onActivityStarted方法的具体用法?Java XGPushManager.onActivityStarted怎么用?Java XGPushManager.onActivityStarted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.tencent.android.tpush.XGPushManager
的用法示例。
在下文中一共展示了XGPushManager.onActivityStarted方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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());
}
}
示例3: 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;
}
示例4: 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();
}
示例5: onStart
import com.tencent.android.tpush.XGPushManager; //导入方法依赖的package包/类
@Override
protected void onStart() {
super.onStart();
XGPushManager.onActivityStarted(this);
}