user3676309
user3676309

Reputation: 1

Getting error while using pushwoosh and gcm library both

I have used GCM to send single message to user. It's working fine but when I used pushwoosh to send messages to all registered device then I am getting an error and the error is

Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/google/android/gcm/GCMBaseIntentService'

so I removed GCM.jar file because in PushWoosh they already provide GCMIntentService class but I got another error in GCMIntentService.java file as I shown below

http://www.imagesup.net/?di=1414011958054

Here I am getting suggestion to remove arguments to match GCMIntentService and constructor is undefined. Suggestion is below

public GCMIntentService() {
    // Call extended class Constructor GCMBaseIntentService
    super();
}

If I remove Config.GOOGLE_SENDER_ID how can we set sender id.

Upvotes: 0

Views: 514

Answers (2)

shader
shader

Reputation: 2121

With Pushwoosh you don't need to go that deep with GCMIntentService. Just put the Project ID into AndroidManifest.xml under applications tag:

<meta-data android:name="PW_APPID" android:value="4F0C807E51EC77.93591449" /> <meta-data android:name="PW_PROJECT_ID" android:value="A60756016005" />

See the step 4 here: http://www.pushwoosh.com/programming-push-notification/android/native-android-sdk-integration/

Upvotes: 0

Tushar
Tushar

Reputation: 501

This constructor for GCMBaseIntentSerice is context specific. Constructor that does not set a sender id, useful when the sender id is context-specific. When using this constructor, the subclass must override getSenderIds(Context), otherwise methods such as onHandleIntent(Intent) will throw an IllegalStateException on runtime. Check the official documention http://developer.android.com/reference/com/google/android/gcm/GCMBaseIntentService.html#GCMBaseIntentService()

After overriding the method you can set sender ids there. See the code below.

@Override
 protected String[] getSenderIds(Context context) {
     String[] ids = new String[1];
     ids[0] = Config.GOOGLE_SENDER_ID;
     return ids;
  }

Upvotes: 1

Related Questions