Michael Winther
Michael Winther

Reputation: 381

Android Push notification without user interaction

After some searching for my question "Android Push notification without user interaction?" I cant seem to find an answer..

There seems to be some conflicting answers in this post: Push Notification without user interaction

But this is for iOS.

So anybody who can give me the answer, without a user clicking on the notification, can it be intercepted in onMessage in android and then be used to run some code, like start the GPS and play a sound, if its in the background?

Upvotes: 2

Views: 1085

Answers (1)

woot
woot

Reputation: 3731

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.

Upvotes: 2

Related Questions