Can Push Notifications Be Used to Run Code Without Notifying User

Can push notifications be used to run code without notifying user?

With release of iOS 7 this is finally possible using Remote/Silent notifications. They work same as Push notifications but instead of alerting the user immediately they can fire up background fetch mode and upload/download new content.

Here is simple tutorial:http://www.objc.io/issue-5/multitasking.html

Android Push notification without user interaction

When you receive GCM messages those are intercepted by a BroadcastReceiver registered in your manifest file. What you do when such a message is received is completely up to you. It is not mandatory to show a notification whenever a GCM message arrives. In fact, many applications make all sorts of transparent uses of GCM, but you should always be mindful about battery consumption when it comes to that.

Cheers.

Push Notifications without alert

No, a push notification will always display a notification as it requires user consent to wake up or launch your application. However if your Application is in the foreground and running, the push notification will not appear and your app can handle the message that the push notification has. All of the preceding applies to local notifications aswhile.

I don't know what you mean by game state. But just have your app listen in on a script on your server which will pass information to your app. Edit: Or like I said above if your app is open in the foreground, push notifications won't appear on screen and you can send information that way. However if you want to do it in the background its not possible no matter what unless you are truly multitasking (GPS, VOIP, Music) or you have user consent through push notification.

Can I use Apple Push Notification Service to have my app do something without notifying user in iOS 7

You can use the content-available key in the push notification data and application:didReceiveRemoteNotification:fetchCompletionHandler:. It could be considered a bit of a hack for your use case and if you try to use it too much you will get limited by Apples system.

How to send push notifications to users that don't enter application more then 2 days?

--------------------------------NEW ANSWER------------------------------------

You should be able to do this using the Firebase Console. When creating a Cloud Message you can select in the "Target" section "Last App Engagement" and select that you want the message to go to everyone that hasn't engaged with the app for say 1 day.
Firebase Cloud Messaging Target

After that you set in Scheduling that you want it to be a recurring campaign and you set it to happen "Daily" at say 12pm and set that you want each user to get this only once. Now you have a campaign that every day at 12pm checks who wasn't in the App for 1d and sends him the campaign, but only sends it once to not spam the same guy every single day.
Firebase Cloud Messaging Scheduling

--------------------------------OLD ANSWER -----------------------------------

You could create for example a DailyJob within your app and that DailyJob could either on it's own check how many days since last session was active and create a local notification or you could use that DailyJob to send to say Firebase a custom attribute "days_since_last_login" and setup different campaigns for 2 days offline, 7 days offline, 31 days offline and so on in Firebase.

To easily create a DailyJob you can use Evernote Android Job library.

iOS execute check before push notification is received

Nope, sadly you can't execute any code on the client side without the user clicking on the notification when the app is not launched. You'll have to do your check server-side to decide wether or not sending a push.

Get push notification of other App then run code with string of push notification

App A sends a push notification like "David sent 'Our Network is
currently offline. We try to fix it as soon as possible'"

App B then executes a code with the Text of the Push Notification in a
string.

That is POSSIBLE! Given that the App A and B both receive the same remote push notifications.

You can choose to not present the push notification inside App B. through the use of UNUserNotificationCenterDelegate. https://developer.apple.com/documentation/usernotifications/unusernotificationcenterdelegate

And again with that protocol, you can extract the string or whatever data you need from the remote push notification upon receiving it and then present it to the user or don't at all.



Related Topics



Leave a reply



Submit