superuserdo
superuserdo

Reputation: 1657

Saving context for notification in Application Android

I have implemented GCM Handler in my application to send a notification when it receives a message. However I have noticed that if I destroy my application by killing it in the task manager on my phone, the context variable that is passed to the method to send a notification returns null. Is there a way to save context even after the user destroys the application process to send a notification?

Upvotes: 0

Views: 33

Answers (1)

Orbitcoder
Orbitcoder

Reputation: 562

I am not able to understand where you are sending message , you should post your code but i will try

you will have a receiver declared in your manifest something like this

  <receiver
        android:name="<PAKAGE NAME>.MyMessageReceiver">
        <intent-filter>
            <action TAG >
        </intent-filter>
    </receiver>

and in MyMessageReciever.java A method

@Override
public void onReceive(Context context, Intent intent) {

here is the context you don't need to save it ,use this context

Upvotes: 2

Related Questions