Parse notifications work on emulator but not Android device - android

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.

Related

Why my app is not compatible with my own phone in google play

I know this questions has been asked a lot but I really don't get any answer
My app is not compatible with any phone:
Developer console
this is my android manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="amaigh.biolotel">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#drawable/ico"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".FullscreenActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/app_name"
android:theme="#style/FullscreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar">
</activity>
<activity android:name=".Settings" />
<activity android:name=".Chooser" />
<activity android:name=".PdfReader"></activity>
</application>
</manifest>
When I Analyze my app with android studio I get this manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="3"
android:versionName="1.0"
package="amaigh.biolotel"
platformBuildVersionCode="25"
platformBuildVersionName="7.1.1">
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="25" />
<uses-permission
android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission
android:name="android.permission.INTERNET" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission
android:name="android.permission.WAKE_LOCK" />
<uses-permission
android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission
android:name="amaigh.biolotel.permission.C2D_MESSAGE"
android:protectionLevel="0x2" />
<uses-permission
android:name="amaigh.biolotel.permission.C2D_MESSAGE" />
<application
android:theme="#ref/0x7f08003b"
android:label="#ref/0x7f06003d"
android:icon="#ref/0x7f02006d"
android:debuggable="true"
android:allowBackup="true"
android:supportsRtl="true">
<activity
android:theme="#ref/0x7f0800d7"
android:label="#ref/0x7f06003d"
android:name="amaigh.biolotel.FullscreenActivity"
android:configChanges="0x4a0">
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:theme="#ref/0x7f08003c"
android:label="#ref/0x7f06003d"
android:name="amaigh.biolotel.MainActivity" />
<activity
android:name="amaigh.biolotel.Settings" />
<activity
android:name="amaigh.biolotel.Chooser" />
<activity
android:name="amaigh.biolotel.PdfReader" />
<activity
android:theme="#ref/0x0103000f"
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="0xfb0" />
<activity
android:theme="#ref/0x7f080125"
android:name="com.google.android.gms.ads.purchase.InAppPurchaseActivity" />
<activity
android:theme="#ref/0x01030010"
android:name="com.google.android.gms.common.api.GoogleApiActivity"
android:exported="false" />
<receiver
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
android:enabled="true"
android:exported="false" />
<receiver
android:name="com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver"
android:permission="android.permission.INSTALL_PACKAGES"
android:enabled="true">
<intent-filter>
<action
android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
<service
android:name="com.google.android.gms.measurement.AppMeasurementService"
android:enabled="true"
android:exported="false" />
<receiver
android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
android:permission="com.google.android.c2dm.permission.SEND"
android:exported="true">
<intent-filter>
<action
android:name="com.google.android.c2dm.intent.RECEIVE" />
<action
android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category
android:name="amaigh.biolotel" />
</intent-filter>
</receiver>
<receiver
android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver"
android:exported="false" />
<service
android:name="com.google.firebase.iid.FirebaseInstanceIdService"
android:exported="true">
<intent-filter
android:priority="-500">
<action
android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<provider
android:name="com.google.firebase.provider.FirebaseInitProvider"
android:exported="false"
android:authorities="amaigh.biolotel.firebaseinitprovider"
android:initOrder="100" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#ref/0x7f0a0006" />
</application>
</manifest>
Don't use this code in manifest.. if you are using android studio
just check in your app.gridle file min and target SDK api no

Parse deviceToken empty after ParseInstallation save

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

android push notification with parse doesen't work

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.

Android Parse.com Push Notifications Application Crashes on Start

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.com Push notification fails to be received

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..

Categories

Resources