I Downloaded from the parse.com the blanck Android Project, then go to parse.com create the App to get the Application & Client ID KEY, put it on ParseApplication class, run the application it's work fine on my device but when I try to send a push notification I get it the messge .... No registered devices
So, whats wrong?
Any ideas?
public class ParseApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
// Initialize Crash Reporting.
ParseCrashReporting.enable(this);
// Enable Local Datastore.
Parse.enableLocalDatastore(this);
// Add your initialization code here
Parse.initialize(this,"EVIZ5DUourBOfSWykYZIhy4HFgDC0W","HCmjXHOz3SbHnHLlyQVD4uqOnmXdzAy");
ParsePush.subscribeInBackground("", new SaveCallback() {
#Override
public void done(com.parse.ParseException e) {
// TODO Auto-generated method stub
if (e== null){
//log.e;
} else{
//log.e;
}
}
});
ParseUser.enableAutomaticUser();
ParseACL defaultACL = new ParseACL();
// Optionally enable public read access.
// defaultACL.setPublicReadAccess(true);
ParseACL.setDefaultACL(defaultACL, true);
}
}
Manifest File
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.miscore"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<!-- Internet permission -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!--
NUEVO
-->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:protectionLevel="signature"
android:name="com.example.miscore.permission.C2D_MESSAGE" />
<uses-permission android:name="com.example.miscore.permission.C2D_MESSAGE" />
<application
android:name="com.example.database.BDApplication"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".SplashScreen"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Inicio"
android:label="#string/inicio"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".Configuracion"
android:label="#string/title_config"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".TablaGeneral"
android:label="#string/title_activity_tabla_general"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".Calendario"
android:label="#string/title_activity_calendario"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".TablaGoleo"
android:label="#string/title_activity_tabla_goleo"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".About"
android:label="#string/title_activity_about"
android:screenOrientation="portrait"
android:theme="#style/TransparentTheme" >
</activity>
<activity
android:name=".CondUso"
android:label="#string/title_activity_cond_uso" >
</activity>
<activity
android:name=".AvisoPriv"
android:label="#string/title_activity_aviso_priv" >
</activity>
<activity
android:name=".FirmaLega"
android:label="#string/title_activity_firma_legal" >
</activity>
<!--
NUEVO
-->
<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" />
<!--
IMPORTANT: Change "com.parse.tutorials.pushnotifications" to match your app's package name.
-->
<category android:name="com.example.miscore" />
</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>
</application>
It might sound silly, but try uninstalling your app from your device, and then re-install.
Try your code again, if that doesn't help, try do it like this:
ParseInstallation.getCurrentInstallation().put("nameOfColumnInParseInstallationClass", "some relevant data");
ParseInstallation.getCurrentInstallation().saveInBackground...
And then, uninstall and re-install again.
Related
I am using parse sdk for android and testing my app in an Android lollipop 5.0. I can receive push notifications when app is running or in background, but when I kill it or close it I can't. Here is my manifest.xml code
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ver.verapp" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:protectionLevel="signature"
android:name="com.ver.verapp.permission.C2D_MESSAGE" />
<uses-permission android:name="com.ver.verapp.permission.C2D_MESSAGE" />
<application
android:name="com.ver.verapp.MainApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="io.fabric.ApiKey"
android:value="Z8Uof8cKL0FTs118iLUOOsjY4" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id" />
<activity android:name=".MainActivity" >
</activity>
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:theme="#android:style/Theme.Translucent.NoTitleBar" />
<activity
android:name=".Login"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data android:name="com.parse.push.notification_icon" android:resource="#drawable/verapp_push"/>
<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="com.ver.verapp" />
</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>
</application>
</manifest>
Here is my custom Application Code:
public class MainApplication extends Application {
private static String TAG_SESSIONTOKEN ="sessionToken";
#Override
public void onCreate() {
super.onCreate();
Parse.initialize(this, "XXXX", "XXXX");
ParseInstallation.getCurrentInstallation().saveInBackground();
String Token = (String) ParseInstallation.getCurrentInstallation().get("deviceToken");
SharedPreferences prefs = getSharedPreferences("verapp", 0);
if(Token!=null)
{
SharedPreferences.Editor editor = prefs.edit();
editor.putString("tokenParse", Token);
editor.commit();
}
else
{
Token="";
}
}
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
I figured it out, my Asus Zenfone 2 had a pre installed app named Start Manger that was preventing my app from waking up alone, i had to enable it and now it is working.
Had the same problem. Here:
**Create a new class called Service. In there, put this in the oncreate: **
Parse.initialize(this, "XXXX", "XXXX");
ParseInstallation.getCurrentInstallation().saveInBackground();
Then, go to your manifest and add this:
<application
name:"pacakge.name.to.ServiceClass"
...
>
...
Hey guys I've been trying to figure out why my Parse notifications haven't been showing up when I use the test push to my device. I'll post my manifest and app file to see if you guys can see the problem
Here is the Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.joeforbroke.fuse" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:protectionLevel="signature"
android:name="com.joeforbroke.fuse.permission.C2D_MESSAGE" />
<uses-permission android:name="com.joeforbroke.fuse.permission.C2D_MESSAGE" />
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<application
android:name=".MIApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.joeforbroke.fuse.ui.MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.joeforbroke.fuse.ui.LoginActivity"
android:label="#string/title_activity_login"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.joeforbroke.fuse.ui.SignUpActivity"
android:label="#string/title_activity_sign_up"
android:parentActivityName="com.joeforbroke.fuse.ui.LoginActivity"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.joeforbroke.fuse.ui.EditFriendsActivity"
android:label="#string/title_activity_edit_friends"
android:parentActivityName="com.joeforbroke.fuse.ui.MainActivity"
android:screenOrientation="portrait" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.joeforbroke.fuse.ui.MainActivity" />
</activity>
<activity
android:name="com.joeforbroke.fuse.ui.RecipientsActivity"
android:label="#string/title_activity_recipients"
android:parentActivityName="com.joeforbroke.fuse.ui.MainActivity"
android:screenOrientation="portrait" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.joeforbroke.fuse.ui.MainActivity" />
</activity>
<activity
android:name=".ui.ViewImageActivity"
android:label="#string/title_activity_view_image"
android:parentActivityName="com.joeforbroke.fuse.ui.MainActivity"
android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.joeforbroke.fuse.ui.MainActivity" />
</activity>
<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.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>
<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.joeforbroke.fuse" />
</intent-filter>
</receiver>
</application>
</manifest>
Here is the app file
package com.joeforbroke.fuse;
import android.app.Application;
import com.parse.Parse;
import com.parse.ParseInstallation;
import com.parse.PushService;
public class MIApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
// Enable Local Datastore.
Parse.enableLocalDatastore(this);
Parse.initialize(this, "PRETEND REAL KEY IS HERE", "PRETEND REAL KEY IS HERE");
ParseInstallation.getCurrentInstallation().saveInBackground();
}
}
Even though I changed my package name of my project I used very the original package name and that worked. Not sure how that works but sure.
I am working on an app where I use Parse to send and receive notifications. The problem now is that when I register an installation deviceToken is empty (deviceType and installationId aren't empty). When this token is empty I can't receive any notifications.
How I register the installation:
Parse.initialize(this, "x", "x");
ParseInstallation.getCurrentInstallation().saveInBackground();
When I added all the code for Parse to my app (https://www.parse.com/apps/quickstart#parse_push/android/native/existing) everything was working fine.
My AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxx.xxx" >
<uses-sdk android:maxSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:protectionLevel="signature"
android:name="com.xxx.xxx.permission.C2D_MESSAGE" />
<uses-permission android:name="com.xxx.xxx.permission.C2D_MESSAGE" />
<application
android:name="com.xxx.xxx.Name_"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:logo="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.gms.analytics.globalConfigResource"
android:resource="#xml/global_tracker" />
<activity
android:name="com.xxx.xxx.Activities.SplashActivity_"
android:screenOrientation="portrait"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.xxx.xxx.Activities.LoginActivity_"
android:screenOrientation="portrait"
android:label="#string/app_name" >
</activity>
<activity
android:name="com.xxx.xxx.Activities.ForgotPassword_"
android:screenOrientation="portrait"
android:label="#string/app_name">
</activity>
<activity
android:name="com.xxx.xxx.Activities.MainActivity_"
android:screenOrientation="portrait"
android:label="#string/app_name" >
</activity>
<activity
android:name="com.xxx.xxx.Activities.EditProfile_"
android:screenOrientation="portrait"
android:label="#string/edit_profile" >
</activity>
<receiver android:name="com.google.android.gms.analytics.AnalyticsReceiver"
android:enabled="true">
<intent-filter>
<action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
</intent-filter>
</receiver>
<service android:name="com.google.android.gms.analytics.AnalyticsService"
android:enabled="true"
android:exported="false"/>
<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=".Receiver.MyPushBroadcastReceiver"
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>
<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.xxx.xxx" />
</intent-filter>
</receiver>
</application>
</manifest>
I just created a new application, added Parse and deleted the Installation class/table in Parse but still no deviceToken.
I think it's a bug in the new Parse SDK. I downgraded to 1.9.0 and everything works fine now.
Source: https://groups.google.com/forum/#!topic/parse-developers/a1Z0SSC304M
I followed the tutorial on parse.com to push notifications. But my application is crashing on start. I think the error is in the Manifest file.
This is my code:
Manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.adla.insurancemobileapplication" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!--
IMPORTANT: Change "com.parse.tutorials.pushnotifications.permission.C2D_MESSAGE" in the lines below
to match your app's package name + ".permission.C2D_MESSAGE".
-->
<permission android:name="com.example.adla.insurancemobileapplication.permission.C2D_MESSAGE" android:protectionLevel="signature"
/>
<uses-permission android:name="com.example.adla.insurancemobileapplication.permission.C2D_MESSAGE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".AddCustomer"
android:label="#string/title_activity_add_customer" >
</activity>
<activity
android:name=".AddCustomerDetails"
android:label="#string/title_activity_add_customer_details" >
</activity>
<activity
android:name=".notificationactivity"
android:label="#string/title_activity_notificationactivity" >
</activity>
<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" />
<!--
IMPORTANT: Change "com.parse.tutorials.pushnotifications" to match your app's package name.
-->
<category android:name="com.example.adla.insurancemobileapplication" />
</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>
<!-- replace #drawable/push_icon with your push icon identifier -->
<meta-data android:name="com.parse.push.notification_icon" android:resource="#drawable/push_icon"/>
</application>
</manifest>
This is the onCreate method of the main activity:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
n = (EditText) findViewById(R.id.inputName);
p = (EditText) findViewById(R.id.inputPass);
// Enable Local Datastore.
Parse.enableLocalDatastore(this);
Parse.initialize(this, "QKpM7ar7aWwrbEeTcrSGJ5bDnLMCUtc1kCr26Enl", "MCBdIQ6Y0dTsIoahzJ44UfR1zHZPJMQPwiETwj47");
}
Could you please help me. I don't know where the problem is.
I tried calling MyApplication class and extended it to Application that resolved my problem.
public class MyApplication extends Application {
public void onCreate() {
Parse.initialize(this, "id", "key");
ParseInstallation.getCurrentInstallation().saveInBackground();
}
}
Please do not forget to declare MyApplication class in android manifest
<application android:name=".MyApplication" />
Parse sends the push notifications but the android devices fails to receive.
I have Followed the Parse tutorial very carefully I don't know what else I can do to get it working.
Please Help. Thank You.
My manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.marsfirst.mars_app"
android:versionCode="12"
android:versionName="1.8.4" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="org.marsfirst.mars_app.pushnotifications.permission.C2D_MESSAGE" />
<permission
android:name="org.marsfirst.mars_app"
android:protectionLevel="signature" />
<uses-permission android:name="org.marsfirst.mars_app.pushnotifications.permission.C2D_MESSAGE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="org.marsfirst.mars_app.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="org.marsfirst.mars_app.Signup"
android:label="#string/signup"
android:parentActivityName="org.marsfirst.mars_app.MainActivity" >
<intent-filter />
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="org.marsfirst.mars_app.MainActivity" />
</activity>
<activity
android:name="org.marsfirst.mars_app.MainPage"
android:label="Main Page" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name="org.marsfirst.mars_app.Webpage"
android:label="Website"
android:parentActivityName="org.marsfirst.mars_app.MainPage" >
<intent-filter />
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="org.marsfirst.mars_app.MainPage" />
</activity>
<activity
android:name="org.marsfirst.mars_app.TeamNews"
android:label="Team News"
android:parentActivityName="org.marsfirst.mars_app.MainPage" >
<intent-filter />
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="org.marsfirst.mars_app.MainPage" />
</activity>
<activity
android:name="org.marsfirst.mars_app.OprPage"
android:label="OPR Page"
android:parentActivityName="org.marsfirst.mars_app.MainPage" >
<intent-filter />
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="org.marsfirst.mars_app.MainPage" />
</activity>
<activity
android:name="org.marsfirst.mars_app.MechPage"
android:label="Mechanical Page"
android:parentActivityName="org.marsfirst.mars_app.MainPage" >
<intent-filter />
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="org.marsfirst.mars_app.MainPage" />
</activity>
<activity
android:name="org.marsfirst.mars_app.DriveNews"
android:label="Drive News"
android:parentActivityName="org.marsfirst.mars_app.MainPage" >
<intent-filter />
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="org.marsfirst.mars_app.MainPage" />
</activity>
<activity
android:name="org.marsfirst.mars_app.ProgramingPage"
android:label="Programming Page"
android:parentActivityName="org.marsfirst.mars_app.MainPage" >
<intent-filter />
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="org.marsfirst.mars_app.MainPage" />
</activity>
<activity
android:name="org.marsfirst.mars_app.Application"
android:allowBackup="true"
android:theme="#style/AppTheme">
</activity>
<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="org.marsfirst.mars_app" />
</intent-filter>
</receiver>
</application>
</manifest>
Then my Application.class
import com.parse.Parse;
import com.parse.ParseAnalytics;
import com.parse.ParseInstallation;
import com.parse.PushService;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.support.v7.app.ActionBarActivity;
import android.widget.Toast;
public class Application extends android.app.Application {
public Application() {
}
#Override
public void onCreate() {
super.onCreate();
{
Parse.initialize(this, "key","key");
PushService.setDefaultPushCallback(Application.this, MainActivity.class);
ParseAnalytics.trackAppOpened(getIntent());
ParseInstallation.getCurrentInstallation().saveInBackground();
}
}
private Intent getIntent() {
// TODO Auto-generated method stub
return null;
}}
The entries in your AndroidManifest.xml are wrong,
<permission
android:name="org.marsfirst.mars_app"
android:protectionLevel="signature" />
Change this to
<permission
android:name="org.marsfirst.mars_app.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
This entry occurs twice remove the duplicate and replace it with
<uses-permission android:name="org.marsfirst.mars_app.pushnotifications.permission.C2D_MESSAGE" />
Change to ,
<uses-permission android:name="org.marsfirst.mars_app.permission.C2D_MESSAGE" />
i have successfully implementing the parse push with this manifest
file ...
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="your package name"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="your package name.YourActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<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.RECEIVE_BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
<receiver android:name="your package name.YourCustomReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
<action android:name="your package name.UPDATE_STATUS" />
</intent-filter>
</receiver>
</application>
</manifest>
for any further query please let me know..