大佬教程收集整理的这篇文章主要介绍了Android,使用parse.com推送通知,自动启动应用程序,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
这是我的CustomReseiver:
public class CustomPushReceiver extends ParsePushBroadcastReceiver { private final String TAG = CustomPushReceiver.class.getSimplename(); privatE intent parseIntent; public CustomPushReceiver() { super(); } @Override protected void onPushReceive(Context context,Intent intent) { super.onPushReceive(context,intent); if (intent == null) return; try { JSONObject json = new JSONObject(intent.getExtras().getString("com.parse.Data")); Log.e(Constans.LOG_TAG,"Push received: " + json); parseIntent = intent; // Toast.makeText(ParseApplication.get(),json.getString("alert"),Toast.LENGTH_SHORT).show(); if(ProfileBriefsFragment.profileBriefsContext instanceof Profile_SideBar_Activity){ ((Profile_SideBar_Activity)ProfileBriefsFragment.profileBriefsContext).pushReceived(json); } CurrentUser.geTinstance().setHaveNewNotiDication(true); Notification_center_Activity.updateNotifications(); } catch (JSONException E) { Log.e(tag,"Push message json exception: " + e.getmessage()); } } @Override protected void onPushDismiss(Context context,Intent intent) { super.onPushDismiss(context,intent); } @Override public void onPushOpen(Context context,Intent intent) { Intent i = new Intent(context,NewHomeActivity.class); i.putExtras(intent.getExtras()); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); } public interface OnPushReceived{ void pushReceived(JSONObject json); }}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODEs.FROYO) { // Initialize Parse Parse.initialize(this,"your id from parse"); ParseInstallation.getCurrenTinstallation().saveInBACkground(); Parse.setLogLevel(Parse.LOG_LEVEL_INFO); } Pushservice.setDefaultPushCallBACk(this,MainActivity.class,R.drawable.ic_notification);
只有当您单击@L_428_2@mainActivity Opened时才使用setDefaultPushCallBACk.
希望有用.
以上是大佬教程为你收集整理的Android,使用parse.com推送通知,自动启动应用程序全部内容,希望文章能够帮你解决Android,使用parse.com推送通知,自动启动应用程序所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。