Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8194573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:52:18+00:00 2026-06-07T04:52:18+00:00

I am using app engine to send push notification in Hebrew to smartphone using

  • 0

I am using app engine to send push notification in Hebrew to smartphone using Google Cloud Messaging, but when i receive the message on phone the text is ??????? instead of Hebrew.

Here the code for preparing Post message to phone using JSON object:

                JSONObject obj=new JSONObject();
                JSONArray registrationsIDList = new JSONArray();

                Query newsQuery = new Query("Devices");
                List<Entity> results = datastore.prepare(newsQuery).asList(
                        FetchOptions.Builder.withDefaults());
                if(results!=null)
                {
                    for(int j=0;j<results.size();j++)
                    {
                        Entity entity=results.get(j);
                        if(entity!=null)
                        {
                            String ID=(String) entity.getProperty("Registration ID");
                            if(ID!=null)
                            {
                                registrationsIDList.put(ID);
                            }
                        }
                    }
                }

                LinkedHashMap data = new LinkedHashMap();
                data.put("Subject",subjects.get(i).getSubject());
                data.put("Writer", subjects.get(i).getWriter());
                data.put("SubjectDate", subjects.get(i).getLastCommentDateTime());
                data.put("SubjectLink", subjects.get(i).getSubjectLink());

                try {
                    obj.put("registration_ids", registrationsIDList);
                    obj.put("data", data);
                } catch (JSONException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                }



                //Sending message to GCM for devices


                try 
                {
                    URL url = new URL("https://android.googleapis.com/gcm/send");
                    HttpURLConnection connection = (HttpURLConnection) url.openConnection();
                    connection.setDoOutput(true);
                    connection.setRequestMethod("POST");
                    connection.setRequestProperty("Content-Type", "application/json ; charset=utf-8");
                    connection.setRequestProperty("Authorization", "key=*************************************");

                    OutputStream writer = connection.getOutputStream();
                    Entity tmp=new Entity("JSON");
                    tmp.setProperty("Message", obj.toString());
                    datastore.put(tmp);
                    writer.write(obj.toString().getBytes());
                    writer.close();

                    Entity device=new Entity("Messages Results");
                    device.setProperty("Response Code", connection.getResponseCode());
                    device.setProperty("Response Message", connection.getResponseMessage());
                    datastore.put(device);
                    if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {

                    } else {
                        // Server returned HTTP error code.
                    }
                } catch (MalformedURLException ex) {
                    // ...
                } catch (IOException ex) {
                    // ...
                }

Before sending the message, i checked that JSON object holds proper Hebrew text.

Here the code for receiving the message on phone:

@Override
protected void onMessage(Context arg0, Intent arg1) {
    Log.d("GCM", "RECIEVED A MESSAGE");
    String str = arg1.getExtras().getString("Subject");
    Log.d("GCM", str);
    String str1 =arg1.getExtras().getString("Writer");
    Log.d("GCM", str1);
    String str2 =arg1.getExtras().getString("SubjectDate");
    Log.d("GCM", str2);
    String str3 =arg1.getExtras().getString("SubjectLink");
    Log.d("GCM", str3);
}

Now the text is ????????????????? instead of Hebrew.
Any advice will be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T04:52:20+00:00Added an answer on June 7, 2026 at 4:52 am

    You need to use Unicode: .toString.getBytes("UTF8")

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using app-engine to send out notification emails to myself (not even to
How can i send Chat invitation over GTalk using Google App Engine(Python), i was
When I send emails through google app engine using the mail's send_mail function, they
Im tring to send a simple email with this code using google app engine.
Using Google App Engine, I am trying to urlfetch a gzip file from a
When using Google app engine is there any benefit to use a CDN if
When using Google App Engine 1.6.4 testbed with Flask 0.8, and in particular the
I am using Google App Engine, spring mvc and spring jpa dao. In my
I am using Google App Engine (python), I want my users to be able
I am using google app engine in python with a Jinja2 template engine. This

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.