Skip to content

Android- App does not receive push notifications from parse platform #885

@sealiasheq

Description

@sealiasheq

I am using from parse platform but I can't receive any notification on my device android.

Here is my manifest:

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="lib.finder.ir.deletme"> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.VIBRATE" /> <application android:name=".App" android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <service android:name="com.parse.fcm.ParseFirebaseInstanceIdService" android:exported="true"> <intent-filter> <action android:name="com.google.firebase.INSTANCE_ID_EVENT" /> </intent-filter> </service> <service android:name="com.parse.fcm.ParseFirebaseMessagingService" android:exported="false"> <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT" /> </intent-filter> </service> <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> <meta-data android:name="com.parse.push.notification_icon" android:resource="@drawable/ic_message" /> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> 

My App.java:

public class App extends Application { @Override public void onCreate() { super.onCreate(); // Use for monitoring Parse OkHttp traffic // Can be Level.BASIC, Level.HEADERS, or Level.BODY // See http://square.github.io/okhttp/3.x/logging-interceptor/ to see the options. OkHttpClient.Builder builder = new OkHttpClient.Builder(); HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor(); httpLoggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY); builder.networkInterceptors().add(httpLoggingInterceptor); Parse.initialize(new Parse.Configuration.Builder(this) .applicationId("1") .server("http://1:80/parse/") .clientBuilder(builder) .build() ); Parse.setLogLevel(Parse.LOG_LEVEL_DEBUG); // Save the current Installation to Parse. ParseInstallation.getCurrentInstallation().saveInBackground(); ParsePush.subscribeInBackground("", new SaveCallback() { @Override public void done(ParseException e) { if (e == null) { Log.i("log", "A: successfully subscribed to the broadcast channel."); } else { Log.i("log", "B: failed to subscribe for push", e); } } }); } } 

And GetPush.java:

public class GetPush extends ParsePushBroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); } @Override protected void onPushReceive(Context context, Intent intent) { super.onPushReceive(context, intent); } @Override protected void onPushOpen(Context context, Intent intent) { super.onPushOpen(context, intent); } } 

And I get google-services.json then add to my project.

{ "project_info": { "project_number": "344518768459", "firebase_url": "https://parsetest-f7e60.firebaseio.com", "project_id": "parsetest-f7e60", "storage_bucket": "parsetest-f7e60.appspot.com" }, "client": [ { "client_info": { "mobilesdk_app_id": "1:344518768459:android:a36a6a64540561a3", "android_client_info": { "package_name": "lib.finder.ir.deletme" } }, "oauth_client": [ { "client_id": "344518768459-09g2pnfhscijt01e4ee8hr02mqaovurh.apps.googleusercontent.com", "client_type": 3 } ], "api_key": [ { "current_key": "AIzaSyBZg-xc8vq5Eu2OJQIaDTbe91W5l5XA1eA" } ], "services": { "analytics_service": { "status": 1 }, "appinvite_service": { "status": 1, "other_platform_oauth_client": [] }, "ads_service": { "status": 2 } } } ], "configuration_version": "1" } 

And my gradle:

apply plugin: 'com.android.application' android { compileSdkVersion 28 defaultConfig { applicationId "lib.finder.ir.deletme" minSdkVersion 16 targetSdkVersion 28 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:28.0.0-rc01' implementation "com.github.parse-community.Parse-SDK-Android:parse:1.18.4" implementation "com.github.parse-community.Parse-SDK-Android:fcm:1.18.4" implementation 'com.google.firebase:firebase-messaging:17.3.0' implementation 'com.google.firebase:firebase-core:16.0.3' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' } apply plugin: 'com.google.gms.google-services' 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions