I've just started with Google Cloud Messenging with phonegap and I'm in an android virtual device.
For the client side app ,I chosed to go with this tutorial : https://github.com/marknutter/GCM-Cordova .
For the server side app ,I created a servlet containing the default code from google (see the last section) : http://developer.android.com/guide/google/gcm/gs.html
For the client app, I just want to make sure where to put exactly the sender id ,the tutorial say that i should place it where ever i find "your_sener_id" in the plugin file code ,but I cant find any string matching "your_sender_id".
-for the server side app,I have 2 little problems :
Here see a variable named "device" should i replaced it with the sender id too ?
import com.google.android.gcm.server.*;
Sender sender = new Sender(myApiKey);
Message message = new Message.Builder().build();
MulticastResult result = sender.send(message, devices, 5);
-for "gcm-server.jar" ,I've tried to download it with sdk manager but the links i've added could not be feched
.I tried also to download it directy from the net but my server wasn't happy with it
thanks for anyhelp and sorry for my bad english.
Related
I have a problem, I just download this code https://github.com/microsoft/Cognitive-Face-Android and take step all this page. But my app to show message "Resource not found" in Detection and other features.
In my azure portal ,I created Subscription , Group , Face API , I received key and Endpoint in this picture.
In my Android Studio, I put key and endpoint in this string.xml
In my gradle app.
Why this app is show message “Resource not found” ?
But I live in southeast asia.
Thank you
You need to have the endpoint with the method , for ex,
If you need to detect face, you need to add "/detect" in the uri
https://tana29testface1.cognitiveservices.azure.com/face/v1.0/detect
I have created an android sample project using AWS Mobile Hub with User Sign-In and Push Notifications services.
I've downloaded the project and opened it through Android Studio, in order to take the necessary files for push notifications from the sample project and to integrate it in my existing Android app.
I thought it would be simple, but then I found out this huge files branch:
It is difficult to understand what files I do need and what files I don't need. Could you please help me to figure out what do I need to import into my existing project in order to integrate Push Notifications in my app?
You should copy the contents of MySampleApp/app/src/main/java/com/amazonaws verbatim into your new project and Also parts of AndroidManifest.xml and build.gradle and Application.java.
For a complete instruction, I would recommend that you go through Mobile Hub Console > Project Name > Build > Select Android > On Left side go to develop > Use as an Example.
You will find all the instructions you need for your android project
The "PushListenerService" class is basically a useful example class where the magic happens. So keep every file that support that class. The
private static void generateNotification(Context context, final String message)
is what displays the notification message.
Another important note is how to get the user's device endpoint value. This can be gotten using the "PushManager" class.
String endpoint = pushManager.getEndpointArn();
The endpoint ARN of a device help you send direct notification to that device.
PublishRequest publishRequest = new PublishRequest();
publishRequest.setMessage(message);
publishRequest.setSubject(subject);
publishRequest.withTargetArn(endpoint); //This can also be a "topic" ARN
snsClient.publish(publishRequest);
Pretty nice job done by the guys at AWS. Big thanks to them! :D
There is no easy way out. Just take your time and go through all the code in the classes that relate to the AWS service you want to implement. Good luck!
Btw, make sure your app is not open on the test device when you send a notification to it or else you won't see a notification since your app is already running. I notice this is a default behaviour.
I am trying to make an app for personal use that has the same functionality of the chrome sender sample app (https://github.com/googlecast/CastHelloText-chrome)
The only thing I am trying to change is the "SAMPLE APP" at the top of the casted screen. I have registered my device via the console and created a new custom receiver in this receiver i have included a URL for a Google drive HTML document I made (Just a black HTML page: https://www.googledrive.com/host/0B7IBRkdKpfYSRmZCYzJaTUpDamM
I then took my newly acquired application id and injected it into the code replacing the Googles sample app ID... I am using Mongoose to host the webpage locally and after I type a message I get no option to connect to my cast device.
Also I have entered my computers local IP and port number (where I am hosting the sender app) under sender details (chrome). I have tried Google's sample code and it works fine the only thing I have changed is the application ID.
Thanks!
I tried the same thing a week ago and the google drive's trick (to host an html page) doesn't work for me.
Your receiver app (your black html page) need to be accessible online, otherwise it's impossible to connect your sender app to your cast device.
So you must put your html file on a server. Do you have a personnal server to host it ?
I pushed your html file on my server and it's connected to a new App ID. Can you try with this App ID : E46DA3D7
If it's working then your probleme is really Google Drive hosting.
Let me know ;)
I am working right now on a tutorial to send push notifications in android.
here is the link - https://parse.com/tutorials/android-push-notifications.
In the tutorial, it says -
// -------------------------------- TUTORIAL -------------------------- //
Create or open your Application class, and add the following line to your onCreate method:
Parse.initialize(this, "YOUR_APP_ID", "YOUR_CLIENT_KEY");
Make sure to replace "YOUR_APP_ID" and "YOUR_CLIENT_KEY" with your Parse app's id and client key. You can find these in your app's Settings page.
// -------------------------------- TUTORIAL -------------------------- //
My question is - where do I get those app's id and client key?
and also, maybe there is an easier way to send push notifications from my application? what is classic way to send push notifications in android?.
by push notifications I mean notification that will appear in the phone even when the app is closed, like email notification for example, or whatsapp.
thanks a lot!
In the parse dash board will find the required keys in the keys tab. Please refer the image below
I'm looking for a solution to send a Push Message from PHP in Intels App-Framework, but I can't find any good solution. I have found this:
https://gist.github.com/prime31/5675017
But how can I get the DEVICE_REGISTRATION_ID? It's very difficult to find some code or solution.
Ive found the Solution. I have forgott to type the IP 0.0.0.0/0 into the Google API Console. And i added the Google API Key and Projectnumber by the Push Category on Build Window.
Then i copy paste the code from http://docs.appmobi.com/index.php/push-messages/ into index_user_scripts.js (only number 2 and 3). Number 1 goes to index.html on the header section. Now it works fine, i can send messages from the Services Tab.