how to implement urban airship in android? i download the sample from
here. i run the app i get install option. after the installation i get nothing. actually i do not know how to set up urban air ship with android. i just register an app name xxxx. i am do not created my xxxx app. but i confused with urban air ship implementation. my need is in my xxxx app i touch the button i have to list out videos what i have posted in urban air ship. please help me.
in the above site i get two files MainActivity and sampleApplication. i do not know where i am use the code in my xxxx app. please help me.
In your AndroidManifest-
<receiver android:name="com.urbanairship.CoreReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.ACTION_SHUTDOWN" />
</intent-filter>
</receiver>
<receiver android:name="com.urbanairship.push.c2dm.C2DMPushReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.your.app.here" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.your.app.here" />
</intent-filter>
</receiver>
<service android:name="com.urbanairship.push.PushService" />
Be sure to -
import com.urbanairship.AirshipConfigOptions;
import com.urbanairship.UAirship;
import com.urbanairship.push.PushManager;
In your activity or class file -
AirshipConfigOptions options = AirshipConfigOptions.loadDefaultOptions(this);
options.developmentAppKey = "YOURAPPKEY";
options.developmentAppSecret = "YOURAPPSECRET";
options.productionAppKey = "";
options.iapEnabled = false;
options.inProduction = false; //determines which app key to use
UAirship.takeOff(this.getApplication(), options);
PushManager.enablePush();
Hope This Helps :)
you can go through by This. It has detailed description how to implement urbanairship for android.
Related
I'm trying to send a push notification to my app using Parse back{4}app by following this tutorial. But when I get to step 3, they say to edit android push notification settings in the dashboard, but I cannot find this option in my dashboard.
Another thing I didn't understand is the last part of step 1, changing the red code with my own. What am I supposed to change this to?
<category android:name="**dominwong4.scm.back4apppushnotificationcloudcode**" />
It's from from this code:
<!--
IMPORTANT: Change "YOUR_SENDER_ID" to your GCM Sender Id.
DON't DELETE the "id:"-->
<meta-data android:name="com.parse.push.gcm_sender_id"
android:value="id:966437188652" />
<service android:name="com.parse.PushService" />
<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="**dominwong4.scm.back4apppushnotificationcloudcode**" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.ParsePushBroadcastReceiver" android:exported="false">
<intent-filter>
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.OPEN" />
<action android:name="com.parse.push.intent.DELETE" />
</intent-filter>
</receiver>
You change it to the package name of your application. There's a link at the top of that page to a github project.
If you look in there, you'd see code with
package dominwong4.scm.back4apppushnotificationcloudcode;
The instructions assume you've used a package name that identifies your own app when you created a project
Can't help with the dashboard... Haven't used Back4App
Regarding the push notification settings, after the changes to Back4App's site, it's located by following these steps:
After Login in your Back4App Account, click on "Features" below your AppName. Then you'll search for "Android Push notification" and click on "Server".
That should bring up the Push Notification settings for Android.
Checking the Online Chat is a great idea too, seems very useful.
I am trying to make an existing android app wearable.
Is it necessary, or not, to specify the full package path for setting a media button event receiver?
I haven't seen any explanation in the official documentation. It is as follows in the documentation:
<receiver android:name=".RemoteControlReceiver">
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
</receiver>
While I have this in my current code:
<receiver android:name="com.pckg.my.app.subpack.RemoteControlReceiver">
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
</receiver>
Try to add (.) in the beginning of your android name
<receiver android:name=".com.pckg.my.app.subpack.RemoteControlReceiver">
I have created a plugin application which is composed by multiple .apk
Some .apk provides only a Live Wallpaper service with the following XML:
<application
... omitted
<service
android:name=".DigitalWallpaperService"
android:label="Wear Digital WatchFace">
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="xxx.WATCHFACE" />
</intent-filter>
<meta-data
android:name="android.service.wallpaper"
android:resource="#xml/clock"/>
</service>
</application>
I have created an AsyncLoader that needs to retrieve only this type of service, so my query looks like this one:
// query the available watch faces
Intent filter = new Intent("android.service.wallpaper.WallpaperService");
filter.addCategory("xxx.WATCHFACE");
List<ResolveInfo> watchFaces = packageManager.queryIntentServices(filter, 0);
But I get back nothing. I though that packageManager.queryIntentServices would return them but it doesn't. Any alternative? I don't want all available Live Wallpapers but only those who implement the category I mention before.
So I have resolved using a different Intent Filter.
First, I declare my Live Wallpapers using a special category owned by my company namespace:
<service
android:name=".DigitalWallpaperService"
android:label="Wear Digital WatchFace"
android:enabled="true"
android:permission="android.permission.BIND_WALLPAPER" >
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="ltd.mycompany.WATCHFACE" />
</intent-filter>
<meta-data
android:name="android.service.wallpaper"
android:resource="#xml/clock"/>
</service>
Then I simply query the available Wallpaper Services and filter using my Category:
// search all wallpaper service
Intent filter = new Intent(WallpaperService.SERVICE_INTERFACE);
filter.addCategory("ltd.mycompany.WATCHFACE");
List<ResolveInfo> watchFaces = packageManager.queryIntentServices(filter, PackageManager.GET_META_DATA);
I hope it can help somebody else.
This is my code to send a push notification using parse.com in android.
ParseQuery installQuery = ParseInstallation.getQuery();
installQuery.whereEqualTo("userId", recieverObjectID);
ParsePush androidPush = new ParsePush();
androidPush.setMessage(currentUser.getUsername());
androidPush.setQuery(installQuery);
androidPush.sendInBackground();
In emulator I am able to send and receive push notifications, but I am not able to receive push notification on device. I manage to retrieve that in Installation table of parse when push-type is gcm for those devices or emulators push notifications are not sent. Guide me with solution.
if you are having a Parse account please go through the docs provided over there that will help you alot. you will have to make a class of parse application
public class ParseApplication extends Application{
public void onCreate() {
super.onCreate();
Parse.initialize(this,"app_id","Client_id");
ParseUser.enableAutomaticUser();
}
}
then in your launcher activity you have to intialise parse like this:
ParseInstallation currentInstall=ParseInstallation.getCurrentInstallation();
Have you made Parse Installation table as given in the docs.? you will have to register your device on Parse.
firstly do this:
ParsePush androidPush = new ParsePush();
androidPush.setMessage(currentUser.getUsername());
androidPush.setQuery(installQuery);
androidPush.saveInBackground();
check your manifest then u are Missing with some permissions can be Internet Permission or given below:
then in the application tag:
<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="YOUR PACKAGE NAME" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.ParsePushBroadcastReceiver" android:exported="false">
<intent-filter>
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
</intent-filter>
</receiver>
OK. So then in Your parse Account go and click on Push You will surely get a push.
I create simple "ParseStarterProject" as default of parse.com project. It works. I send notification from one device to other device successfully via setchannel method.
But the problem is I do not use receiver class(I do not know how can I use that) so when a notification comes I need to get its message ? it is possible? or if I use set data can I get its data ?
I use this code to send message:
ParsePush push = new ParsePush();
String yourMessage = "Selam from LG G2";//I want to get this message from other device?
push.setChannel("device2");
push.setMessage(yourMessage);
//push.setData("exampledata"); if I use this can I get this data from other device?
push.sendInBackground();
my manifest file:
<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" />
<!--
IMPORTANT: Change "com.parse.starter" to match your app's package name.
-->
<category android:name="com.parse.starter" />
</intent-filter>
</receiver>
thanks in advance
Create a class that extends BroadcastReceiver, here we call it MyCustomReceiver. Declare the usage of this receiver in your manifest:
<receiver android:name="com.example.MyCustomReceiver" android:exported="false">
<intent-filter>
<action android:name="com.example.UPDATE_STATUS" />
</intent-filter>
</receiver>
I'm not sure what you mean by you have problems with "MyCustomReceiver class on the main activity", in your comment to #kingspeech's answer.
In the worst case, you can create your own Receiver which extends the ParseBroadcastReceiver (and reference the extended class in the manifest). Then it should work by default, but you'll be able to hook into onReceive(Context, Intent)
As Parse tutorial directs, you ca use JSONObject to set data and you can put whatever you want.
Then when you receive Push notification you can have a access to read the previously prepared JSONObject. Please look at the Android tutorial https://parse.com/docs/push_guide#options/Android.
Hope this helps,
Regards.