Android-синтаксис sdk push-уведомление работает над эмулятором, но когда я запускаю его на телефоне с помощью отладки usb, push-уведомление запускается в фоновом режиме и может быть замечено в моей учетной записи parse.com но телефон не получает push-уведомление.Android parse sdk push notification
public class Profile_InviteActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile__invite);
Bundle extras = getIntent().getExtras();
ParseQuery<ParseObject> query = ParseQuery.getQuery("UserProfile");
Log.d("id",""+extras.getInt("fid"));
query.whereEqualTo("fid", ""+extras.getInt("fid"));
query.findInBackground(new FindCallback<ParseObject>() {
public void done(final List<ParseObject> scoreList, ParseException e) {
if (e == null) {
TextView name = (TextView) findViewById(R.id.profile_name);
TextView location = (TextView) findViewById(R.id.profile_location);
name.setText(scoreList.get(0).getString("name"));
location.setText(scoreList.get(0).getString("location"));
ParseFile img1 = (ParseFile)scoreList.get(0).get("profileimage");
img1.getDataInBackground(new GetDataCallback() {
public void done(byte[] data,
ParseException e) {
if (e == null) {
Log.d("test",
"We've got data in data.");
// Decode the Byte[] into
// Bitmap
ImageView image = (ImageView) findViewById(R.id.profimg);
image.setImageBitmap(BitmapFactory
.decodeByteArray(
data, 0,
data.length));
} else {
Log.d("test",
"There was a problem downloading the data.");
}
}
});
} else {
Log.d("score", "Error: " + e.getMessage());
}
}
});
}
public void inviteToTrain(View v)
{
Log.d("inviting","now");
Bundle extras = getIntent().getExtras();
//ParseInstallation installation = ParseInstallation.getCurrentInstallation();
//installation.put("fids",true);
//installation.saveInBackground();
ParseQuery pushQuery = ParseInstallation.getQuery();
//pushQuery.whereEqualTo("fid", extras.getInt("fid"));
pushQuery.whereEqualTo("fids", true);
// Send push notification to query
ParsePush push = new ParsePush();
push.setQuery(pushQuery); // Set our Installation query
push.setMessage("Someone would like to join you at your event ");
push.sendInBackground();
Log.d("invited","now");
}
}
Пожалуйста, помогите мне с этим.
Благодаря
Где ваш код? – GrIsHu
Код обновлен – rohit