简体   繁体   English

具有网址的Parse.com Android推送通知

[英]Parse.com Android Push Notifications With Url

I am trying to integrate parse into my app with push notifications and have the notification display custom text and open the device's browser when I send a url to it. 我正在尝试将解析与推式通知集成到我的应用中,并在通知中向其显示自定义文本并在向其发送网址时打开设备的浏览器。

The parse integration is fine(Thats the easy part) but where I am stuck is what to code for the integration for handling the json code sent by the parse interface and have the app translate it into the action I need done. 解析集成很好(这是最简单的部分),但我遇到的问题是该集成的代码要处理解析接口发送的json代码,并让应用将其转换为我需要执行的操作。

I know I will have to update the manifest file and the main activity class to accomplish this but I am stuck. 我知道我将必须更新清单文件和主要活动类来完成此操作,但是我被困住了。

Add Manifest to 将清单添加到

<receiver android:name="com.sample.app.android.recevier.PushNotificationRecevier" >
   <intent-filter>
     <action android:name="com.sample.app.android.SIMPLE_NOTIFICATION" />
   </intent-filter>
</receiver>

Create One receiver Class 创建一个接收器类

import org.json.JSONException;
import org.json.JSONObject;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class PushNotificationRecevier extends BroadcastReceiver{
    String SimpleNotification="com.sample.app.android.SIMPLE_NOTIFICATION";
    @Override
    public void onReceive(Context context, Intent intent) {
        if(intent.getAction().equalsIgnoreCase(SimpleNotification)){

            // Your Stuff 
JSONObject jsonObject=new JSONObject(intent.getExtras().getString("com.parse.Data"));


        }
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM