parse 1.13.0을 nodechef.com에서 사용하고 있는데 알림을 보내도록 설정했지만 몇 가지 문제가 발생했습니다.구문 분석을 사용하여 응용 프로그램에서 푸시 알림
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.my.path" >
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="com.my.path.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.my.path.permission.C2D_MESSAGE" />
<application
android:name=".MainApplication"
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="@drawable/logo"
android:label="@string/app_name"
android:theme="@style/hsfTheme">
<meta-data
android:name="com.parse.APPLICATION_ID"
android:value="@string/parse_app_id" />
<meta-data
android:name="com.parse.CLIENT_KEY"
android:value="@string/parse_client_key" />
<meta-data
android:name="com.parse.push.notification_icon"
android:resource="@drawable/logo" />
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParseBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.my.path" />
</intent-filter>
</receiver>
<!-- activity main. -->
<activity
android:name=".A0"
android:configChanges="keyboardHidden|screenLayout|orientation"
android:immersive="true"
android:screenOrientation="portrait"
android:theme="@style/hsfTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".A1" />
<activity android:name=".A2" />
<activity android:name=".A3" />
<activity android:name=".utils.A4" />
<!-- Include the AdActivity configChanges and theme. -->
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
</application>
내 응용 프로그램 클래스의
내가 가진 :
이
내 매니페스트입니다 ParseInstallation.getCurrentInstallation()를 saveInBackground();.- DeviceToken는 _Installation 클래스 비어
- 내가 설치 채널을 사용하는 모든 사용자 또는 일부 사용자에게 통지하고 싶은 어떤 행동, 내가 필요로 내 응용 프로그램에서 푸시 알림을 보낼 수 있습니다
작동하지 푸시 . "구문 분석 푸시"또는 gcm을 사용할 지 신경 쓰지 마세요. 앱에서 푸시 알림을 보내는 간단한 방법이 필요합니다.
수정 푸시 - 대시 보드에서 푸시가 작동하지만 클라이언트에서 푸시 알림을 보낼 수 없습니다. 나는 밀어 넣기를 시도하고 "unauthorized : master key를 사용 가능하게"했다. 그래서 내가 뭘해야하니?
편집 2 나는 구름 코드를 생성하지만 외모 request.params에서 GET 값을 작동하지 :
Parse.Cloud.define("sendPush", function(request,response) {
var _locale = "en-US";//request.params.locale;
var _message = "test";//request.params.message;
var query = new Parse.Query(Parse.Installation);
query.equalTo("localeIdentifier", _locale);
Parse.Push.send({
data: {
alert: _message,
badge: "Increment",
sound: "default"
},
where: query
}, {
useMasterKey: true
})
.then(function() {
response.success("Push Sent!");
}, function(error) {
response.error("Error while trying to send push " + error.message);
});
});
EDIT 3
HashMap<String,String> map = new HashMap<String, String>();
map.put("locale","en-US");
map.put("message","Text added");
ParseCloud.callFunctionInBackground("sendPush",map, new FunctionCallback<Object>() {
@Override
public void done(Object object, ParseException e) {
// toast done
}
});
무엇이 문제입니까? 더 많은 코드를 공유 할 수 있습니까? –
@RanHassid 문제에 대한 추가 정보를 추가했습니다. –
parse.com 또는 parse-server를 사용하십니까? –