logo
down
shadow

Parse - Notification not being received


Parse - Notification not being received

By : Deron Frederickson
Date : November 21 2020, 07:31 AM
this one helps. To send notifications from a device, you have to do one extra step. Go into the settings of your app on parse and enable Client Push. That should resolve your issue.
code :


Share : facebook icon twitter icon
Parse Push Notification received only on app restart

Parse Push Notification received only on app restart


By : Tetiana Krylova
Date : March 29 2020, 07:55 AM
I hope this helps . Alright, so I fixed the issue by updating my Parse SDK from 1.3 to 1.4! What I fail to understand is, if something worked on 1.3 for some amount of time how did it suddenly stop?
Weird issue, but the solution is upgrading to v1.4 of the Parse SDK.
Customize notification received with parse

Customize notification received with parse


By : user2816713
Date : March 29 2020, 07:55 AM
Any of those help The codes were forked from many SO answers so I could link them all. to all the original authors.
this is my first SO answer. So if in anyway I could improve it, please do advice me.
code :
@Override
    public void onReceive(Context context, Intent intent) {
        // TODO Auto-generated method stub

        final Dbhelper p = new Dbhelper(context);
        try {
            String action = intent.getAction();
             String channel = intent.getExtras().getString("com.parse.Channel");
             JSONObject json = new JSONObject(intent.getExtras().getString("com.parse.Data"));
             Log.i("Got push", "got action " + action + " on channel " + channel + " with:");

             if (action.equalsIgnoreCase("My.app.package")) {
                 String title = "title";
                 String message = "";
                 if (json.has("header"))
                     title = json.getString("header");
                 if (json.has("msg"))
                     message = json.getString("msg");
                    numMessages++;
                    p.addCircular(title, message);
                  generateNotification(context, title, message, json);
             }
           } catch (JSONException e) {
             Log.d(TAG, "JSONException: " + e.getMessage());
           }
    }

    private void generateNotification(Context context, String title, String message, JSONObject json) {
        Intent intent = new Intent(context, MainActivity.class);
        PendingIntent contentIntent = PendingIntent.getActivity(context, 0, intent, 0);

        numMessages = 0;
        NotificationManager mNotifM = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);

        final NotificationCompat.Builder mBuilder =
        new NotificationCompat.Builder(context)
        .setSmallIcon(R.drawable.ic_drawer)
        .setContentTitle(title)
        .setContentText(message)
        .setStyle(new NotificationCompat.BigTextStyle()
        .bigText(message))
        .addAction(0, "Press to open", contentIntent)
        .setAutoCancel(true)
        .setDefaults(new NotificationCompat().DEFAULT_ALL);
        //.setNumber(++numMessages);

        mBuilder.setContentIntent(contentIntent);

        mNotifM.notify(NOTIFICATION_ID, mBuilder.build());

        }

    }
 <receiver
            android:name="My.app.package.MyBroadcastReciverClass"
            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" />
                <action android:name="com.sbu.sathyabama" />
                 <!-- IMPORTANT: Change "com.parse.starter" to match your app's package name. -->
                <category android:name="My.app.package" />
            </intent-filter>
 </receiver>
{
     "header": "My notification Title",
     "msg": "My Notification message",
     "action": "my.app.package"
}
How to handle received push notification from parse ? | RSS

How to handle received push notification from parse ? | RSS


By : user3294612
Date : March 29 2020, 07:55 AM
I wish this helpful for you All you have to do is set a generic key to your payload which in your case looks like title. So when you send a push (as data/payload/json), when user receives one you cross reference the valueForKey:
As always, I highly encourage you try things out yourself because that's how you learn. And I always direct Parse users to their documentation because they are extremely well-documented. Almost too documented if that's a thing. However if you get stuck here is a working example:
code :
NSDictionary *data = @{
@"alert" : @"some generic message here",
@"badge" : @"Increment",
@"sounds" : @"default",
@"title" : @"NY Times" //this is whatever you want
};

//schedule the push with some options. This isn't a mandatory set up, just an example. You can do a lot with PFPushes

PFPush *push = [[PFPush alloc] init];
[push setChannels:@[ @"subscribed" ]];
[push setData:data];
[push sendPushInBackground];
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  . . .
  // Extract the notification data from payload

 NSDictionary *notificationPayload = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey];

 NSString *newsType = [notificationPayload valueForKey:@"title"];

  // perform segue or tab bar selectedIndex or whatever you want after checking if user is launching from notification :

if (notificationPayload) {
    //check it title has your string 
    if ([newsType isEqualToString:@"NY Times"]) {
         //do whatever here 
    } else {

    }
 }
}
{
"aps" : {
    "alert" : "New NY Time Article",
    "badge" : 1,
    "sound" : "default",
    "title" : "NY Times"
        }
}
stack notification received from parse

stack notification received from parse


By : ARipoff
Date : March 29 2020, 07:55 AM
I wish did fix the issue. What you need is a custome PushReceiver, so according to Parse docs you declare receiver in the manifest
code :
<receiver
    <!-- Put here path to a class that will handle pushes -->
    android:name="com.domain.ReceiverClass"
    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>
public class PushReceiver extends ParsePushBroadcastReceiver {
    @Override
    protected void onPushReceive(Context context, Intent intent) {
        //Don't call super.onPushReceive!
        JSONObject pushData = new JSONObject(intent.getStringExtra(KEY_PUSH_DATA));
        //Here is how you obtain data
        String alert = pushData.optString("alert", "Notification received.");
        //Any manipulations with stacking go here
    }
}
        SharedPreferences prefs = context.getSharedPreferences(KEY_NOTIFICATIONS,
                Context.MODE_PRIVATE
        );
        JSONArray stacked = new JSONArray(prefs.getString(KEY_STACKED, ""));
        stacked.put(alert);
        prefs.edit().putString(KEY_STACKED, stacked.toString()).apply();
        Intent i = new Intent(context, ActualProcessor.class);
        i.putExtra(EXTRA_COUNT, stacked.length());
        PendingIntent receiver = PendingIntent.getBroadcast(context, CODE, i, 0);
        AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
        alarmManager.set(AlarmManager.RTC_WAKEUP,
                System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(5),
                receiver
        );
Parse Android Notification not received

Parse Android Notification not received


By : Marian
Date : March 29 2020, 07:55 AM
this will help Call Parse.initialize from the onCreate method of your Application class (instead of your Launcher Activity)
AndroidManifest.xml
code :
<application
    android:name=".MyApplication"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/Theme.AppCompat.Light.NoActionBar">
public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();

        // Enable Local Datastore.
        Parse.enableLocalDatastore(this);

        // Add your initialization code here
        Parse.initialize(this, getResources().getString(R.string.ParseAppID), getResources().getString(R.string.ParseClientID));

        // Subscribe to a channel
        ParsePush.subscribeInBackground("twofourseven", new SaveCallback() {
            @Override
            public void done(ParseException e) {
                if (e == null) {
                    Log.d("PARSE", "Successfully subscribed to Parse channel");
                } else {
                    Log.d("PARSE", "Failed to subscribe to Parse channel");
                }
            }
        });

        ParseUser.enableAutomaticUser();
        ParseACL defaultACL = new ParseACL();
        // Optionally enable public read access.
        // defaultACL.setPublicReadAccess(true);
        ParseACL.setDefaultACL(defaultACL, true);
    }
}
<permission android:protectionLevel="signature" android:name="com.walid.app_247_parse.permission.C2D_MESSAGE" />
<uses-permission android:name="com.walid.app_247_parse.permission.C2D_MESSAGE" />
Related Posts Related Posts :
  • How to solve different Preview/Picture sizes returned by android.hardware.camera?
  • How to get songs from album/Artist in android,using MediametadataRetriever?
  • Android UIAutomator how to tilt device
  • DialogFragment issues with screen orientation and MediaController
  • blank screen after re-starting launcher activity (failed binder transaction)
  • How to start activity Language and input
  • location-based Augmented Reality Framework (Android, iOS) with 3D Models?
  • android teamviewer intent with parameters
  • Picasso does not call onBitmapLoaded for the first time
  • How can I pass an audio file as input instead of recorded voice to Google search voice?
  • How to set `ImageView`'s height to match it's width while `layout_weight` is set?
  • How to run a task once, only on installing, on android
  • ADT - Android SDK manager shows update installed with a red mark
  • Android: how to show two activity in one window using java code (not using .xml)
  • How to do independently scrolling rows and columns (a la Netflix app) on Android in a WebView?
  • Sending Data between Activities in Android periodically.
  • Classcastexception achartengine
  • Google Play shows no supported devices
  • OkHttp3 is returning timeout exception
  • What is the best camera parameters for android camera opened in surface view
  • how do i update the database table on the basis of checkbox/unchecked
  • Placeholder for contacts without name in listview
  • Storing username and password in plain text
  • Android Material default colors
  • Android studio importing in gradle issue
  • syntax error (code 1): , while compiling: CREATE TABLE
  • different behavior of app when signed with production key
  • Prevent softkeyboard dismiss on the android back button press
  • can't instantiate class... no empty constructor
  • Image Quality degrading after getting bitmap from internet and setting it to a Image View
  • Home Icon is not showing next to Hamburger icon in ActionBar
  • Layout issue with Toolbar
  • Prevent my android:theme from modifying dialogs?
  • Facebook login with Parse always returns false in user.isNew() Android
  • I get NullPointerException in an Android animation?
  • Things move out of place on different screen sizes
  • android database: the method open() is undefined for the type databasehelper class
  • sending intent with a parcelable extra from widget crashes on activity startup
  • How to record a video less than 10 mb using Android
  • Android - serialize object to pass it over Bluetooth NotSerializableException
  • Facebook Login Button Android in Eclipse
  • Null pointer exception on adding a marker to google maps
  • Jackson : Can not deserialize instance of java.util.ArrayList out of VALUE_TRUE token
  • How to customize PagerTitleStrip android
  • Click event not being captured for ListView items with HorizontalScrollView
  • HAX kernel module is not installed
  • Android: signed watchface on Android Wear 5.0 not installed
  • Dialog Builder in PreferenceFragment
  • HttpClient change UserAgent
  • Numerous 'No resource found' and 'Error retrieving parent' in Android Project
  • Get call log of a particular number
  • Invalid "--android-sdk" value "C:\android-sdk-win" in Titanium while deploying app on android mobile
  • Call onResume() method from Asynctask's onPostExecute() Method
  • Linking with native SO file present in included library project of Android
  • GridView error in horizontal spacing
  • Progressbar on bottom of listview item
  • Adding Markers on Google maps v2 Android
  • How to Remove Duplicate Libraries added via gradle?
  • Datepicker Dialog Validation...!
  • Scale image in ImageView to width of the parent and scale in height accordingly
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org