Giter VIP home page Giter VIP logo

pushwoosh-android-sdk's People

Contributors

aaevstefeev avatar akidisdev avatar dimanam avatar fleurdeviande avatar minakov avatar nikolleto avatar savinmike avatar shaders avatar wfhm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pushwoosh-android-sdk's Issues

[javax.net.ssl.SSLPeerUnverifiedException] ERROR: Cannot verify hostname: XXXX-XXXX.api.pushwoosh.com. Response = null

Hi, Android SDK i tried add in our project here, but i receive this error on init in SDK .
Apparently this is a problem with https and your CACertificate in your domain.

XXXx-XXXX = Is my projectId i remove this here.
Full Stack :
javax.net.ssl.SSLPeerUnverifiedException: Cannot verify hostname: XXXX-XXXX.api.pushwoosh.com at android.net.SSLCertificateSocketFactory.verifyHostname(SSLCertificateSocketFactory.java:241) at android.net.SSLCertificateSocketFactory.createSocket(SSLCertificateSocketFactory.java:483) at com.android.okhttp.Connection.upgradeToTls(Connection.java:131) at com.android.okhttp.Connection.connect(Connection.java:107) at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294) at com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255) at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206) at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345) at com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89) at com.android.okhttp.internal.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:197) at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:254) at com.pushwoosh.internal.b.l.a(Unknown Source) at com.pushwoosh.internal.b.l.a(Unknown Source) at com.pushwoosh.internal.b.l$1.run(Unknown Source)

Adding this code in my main activity to ignore all SSL problems certificates and others, your SDK works.

try { HttpsURLConnection.setDefaultHostnameVerifier(new NullHostNameVerifier()); SSLContext context = SSLContext.getInstance("TLS"); context.init(null, new X509TrustManager[]{new NullX509TrustManager()}, new SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(context.getSocketFactory()); }catch (Exception e){ e.printStackTrace(); }
mention about the same problem.

http://stackoverflow.com/questions/31917988/okhttp-javax-net-ssl-sslpeerunverifiedexception-hostname-domain-com-not-verifie

isNotificationEnabled

I know you want to check whether user is enable notification, but AppOpsManager is not support below Android 5.0, resulting in crashes on devices below Lollipop.

Unable to create minifyEnabled release build with Pushwoosh SDK and Google Play Services 8.1.0, 8.3.0, or 8.4.0

There is a known issue that can cause the dex step during a minifyEnabled build to fail when an app depends on Play Services 8.1.0 and above but its third-party dependencies are compiled against an older version of Play Services. The workaround is to have the third-party libraries, in this case Pushwoosh SDK, re-compile against Play Services 8.1.0 and above. More detail on this issue:
https://code.google.com/p/android/issues/detail?id=187483

This problem can be reproduced using sample Pushwoosh Android Studio app:

  1. Clone and import sample app to Android Studio
  2. Change release build type config to minifyEnabled true
  3. Assemble debug build, observe build is successful
  4. Assemble release build, observe build fails with the following error messages:

:app:proguardRelease
:app:dexRelease
EXCEPTION FROM SIMULATION:
com.android.dx.rop.cst.CstMethodRef cannot be cast to com.android.dx.rop.cst.CstInterfaceMethodRef
...at bytecode offset 00000042
locals[0000]: Lcom/pushwoosh/location/GoogleGeofencer;
locals[0001]: Landroid/content/Context;
locals[0002]: Lcom/pushwoosh/location/IGeofenceTracker;
stack[top0]: Lcom/google/android/gms/common/api/n;
...while working on block 0042
...while working on method :(Landroid/content/Context;Lcom/pushwoosh/location/IGeofenceTracker;)V
...while processing (Landroid/content/Context;Lcom/pushwoosh/location/IGeofenceTracker;)V
...while processing com/pushwoosh/location/GoogleGeofencer.class
1 error; aborting
Error:Execution failed for task ':app:dexRelease'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
Information:BUILD FAILED

Error while compiling is:
Unknown source file : Uncaught translation error: com.android.dx.cf.code.SimException: com.android.dx.rop.cst.CstMethodRef cannot be cast to com.android.dx.rop.cst.CstInterfaceMethodRef

Show notification in system bar/tray when app is in foreground

Is there a way to display the notification in the system bar/tray when app is running in the foreground? I noticed that there is a similar feature in the PhoneGap version using
<meta-data android:name="PW_NO_BROADCAST_PUSH" android:value="true" />
(See Pushwoosh/pushwoosh-phonegap-plugin#103 and https://community.pushwoosh.com/questions/2287/notification-on-tray-even-when-app-is-in-foreground)

Would it be possible to bring this feature to the Pushwoosh Android SDK? Thanks!

Misleading gradle advice in docs

The docs advise to use the below gradle line to add pushwoosh as a dependency.
compile 'com.pushwoosh:pushwoosh:+'

But using + in mentioning a gradle dependency is not advisable as the client may not realize that his library has updated.
So, the code may go between two incompatible version and since it is push notification, the client may ship the app with his push notification in a inconsistent state.

Moreover, it is too hard to find the latest released SDK version as of now. My suggestion is that the docs always suggest the latest stable version and mention any migration paths between two versions.

Please let me know if I am missing any point.

Thanks and regards
Divyendu Singh

No details in VERSION.md

Hi,

in my opinion changelog in VERSION.md:

Support getLaunchNotification with custom push receiver

is not enough. It will be much better with more details like: link to the documentation and sample use case.

When I see:

getLaunchNotification with custom push receiver

or

Remote pushwoosh commands

I'm not sure if i need or not ;)

Thanks in advance.
Greetings.

Threading issues in Multi mode

When enabling multiple notifications and when they are received at the same time, there are side-effects such as duplicate notification text, replacing messages, etc, related to thread racing conditions.

As each notification is handled in separate worker thread, you can fix it by making this code in AbsNotificationFactory#notify more thread-safe:

public final void notify(Context context, Bundle extra, PushData pushData) {
        ....
        this.mPushData = pushData; // <- mPushData keeps the value set by the last accessed thread

        ....
        if (!this.mPushData.isSilent()) {
            Notification notification = this.onGenerateNotification(this.mPushData); // <- just pass argument "pushData" instead so that notifications handled by different threads would always contain unique info
            this.generateNotification(notification, pushData.getMessageTag());

You can also make this method synchronized:

public static int getMessageId(Context context)

so that message id will be always unique, even when accessed by multiple threads at the same time. This will solve accidental "replacement" of notifications with same id that we had many times during our stress testing at Kapaza.

DeadObjectException on Android 4.3, Galaxy 9300

com.pushwoosh.internal.utils.a <init> com.pushwoosh.internal.utils.a a com.pushwoosh.internal.a a com.pushwoosh.internal.a b com.pushwoosh.internal.a.a$a a com.pushwoosh.internal.b.h setProcessed com.pushwoosh.internal.b.l$1$1 run

and

com.pushwoosh.internal.utils.a <init> com.pushwoosh.internal.utils.a a com.pushwoosh.internal.a a com.pushwoosh.internal.a a com.pushwoosh.internal.a.a$a a com.pushwoosh.internal.b.h setProcessed com.pushwoosh.internal.b.l$1$1 run

Please investigate.

Richpage issues with Android 6.0

Have you tested Richpage pushes on Android 6.0? I am getting exception errors when trying to open richpage notifications on devices running 6.0. (exact version is 6.0.1). It is working on devices running 4.1 and 5.0. Running Pushwoosh version 3.2.0. Stack trace below.

12-14 10:02:45.313 12344-12361/I/Pushwoosh: [com.pushwoosh.GCMListenerService] Received message: Bundle[{pw_msg=1, j=1137, p=1S, ibc=#ff0000, pri=, vib=0, title=new content!, collapse_key=do_not_collapse}] from: 368319224253
12-14 10:02:45.324 12344-12361/ I/Pushwoosh: [AbsNotificationFactory] nofify: Bundle[{onStart=false, pw_msg=1, j=1137, p=1S, ibc=#ff0000, pri=, vib=0, title=new content!, collapse_key=do_not_collapse, foreground=true}]
12-14 10:02:46.331 12344-12366/D/Pushwoosh: [RequestManager] Try To send: messageDeliveryEvent
12-14 10:02:46.552 12344-12366/ I/Pushwoosh: [RequestManager]
x
| Pushwoosh request:
| Url: https://cp.pushwoosh.com/json/1.3/messageDeliveryEvent
| Payload: {"request":{"v":"3.2.0.614","device_type":3,"application":"57468-3DE96","hwid":"cbaf71b9a4e07f2c","hash":"1S","userId":"cbaf71b9a4e07f2c"}}
| Response: {"status_code":200,"status_message":"OK","response":null}
x
12-14 10:02:46.552 12344-12366/ D/Pushwoosh: [RequestManager] messageDeliveryEvent response success
12-14 10:02:48.215 12344-12428/ D/Pushwoosh: [RequestManager] Try To send: getPage
12-14 10:02:48.421 12344-12428/ I/Pushwoosh: [RequestManager]
x
| Pushwoosh request:
| Url: https://cp.pushwoosh.com/json/1.3/getPage
| Payload: {"request":{"v":"3.2.0.614","device_type":3,"page_id":"1137","application":"57468-3DE96","hwid":"cbaf71b9a4e07f2c","userId":"cbaf71b9a4e07f2c"}}
| Response: {"status_code":200,"status_message":"OK","response":{"page":{"1":{"background":"255,255,255,255","headerBackground":"255,0,0,255","name":"global","type":"global","formHeader":"Global Settings"},"2":{"content":"< Back","color":"255,255,255,255","name":"backBtn","type":"backBtn","formHeader":"Button Back"},"3":{"url":"https://cp.pushwoosh.com/img/logo.png","name":"logo","type":"img","formHeader":"Logo"},"4":{"content":"

Pushwoosh</p>","fontSize":"32","color":"255,255,255,255","name":"title","type":"lineText","formHeader":"Title"},"5":{"url":"https://cp.pushwoosh.com/img/logo-large.png","name":"banner","type":"img","formHeader":"Banner"},"6":{"content":"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.","fontSize":"14","color":"#fff","name":"content","type":"blockText","formHeader":"Text Content"},"7":{"background":"0,20,77,255","backgroundHover":"19,36,83,255","content":"Submit","color":"255,255,255,255","url":"","json":"","name":"submitBtn","type":"btn","formHeader":"Button Submit"}},"template":"1"}}
x
12-14 10:02:48.421 12344-12428/ D/Pushwoosh: [RequestManager] getPage response success
12-14 10:02:48.802 12344-12344/ E/Pushwoosh: Exception ocurred
java.lang.IllegalAccessException: java.lang.Class<android.content.res.XmlBlock> is not accessible from java.lang.Class<com.pushwoosh.richpages.RichPushUtils>
at java.lang.reflect.Constructor.newInstance(Native Method)
at com.pushwoosh.richpages.RichPushUtils.getParser(Unknown Source)
at com.pushwoosh.richpages.RichPageActivity.getInflatedView(Unknown Source)
at com.pushwoosh.richpages.RichPageActivity.addView(Unknown Source)
at com.pushwoosh.richpages.RichPageActivity.onPageLoadSuccess(Unknown Source)
at com.pushwoosh.richpages.RichPageActivity$GetPageTask.onPostExecute(Unknown Source)
at com.pushwoosh.richpages.RichPageActivity$GetPageTask.onPostExecute(Unknown Source)
at android.os.AsyncTask.finish(AsyncTask.java:651)
at android.os.AsyncTask.-wrap1(AsyncTask.java)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
12-14 10:02:48.808 12344-12344/ D/AndroidRuntime: Shutting down VM
12-14 10:02:48.813 12344-12344/ E/AndroidRuntime: FATAL EXCEPTION: main
Process: , PID: 12344
java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String org.xmlpull.v1.XmlPullParser.getPositionDescription()' on a null object reference
at android.view.LayoutInflater.inflate(LayoutInflater.java:540)
at com.pushwoosh.richpages.RichPageActivity.getInflatedView(Unknown Source)
at com.pushwoosh.richpages.RichPageActivity.addView(Unknown Source)
at com.pushwoosh.richpages.RichPageActivity.onPageLoadSuccess(Unknown Source)
at com.pushwoosh.richpages.RichPageActivity$GetPageTask.onPostExecute(Unknown Source)
at com.pushwoosh.richpages.RichPageActivity$GetPageTask.onPostExecute(Unknown Source)
at android.os.AsyncTask.finish(AsyncTask.java:651)
at android.os.AsyncTask.-wrap1(AsyncTask.java)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
12-14 10:02:49.181 12344-12366/ D/Pushwoosh: [RequestManager] Try To send: pushStat
12-14 10:02:49.383 12344-12366/ I/Pushwoosh: [RequestManager]
x
| Pushwoosh request:
| Url: https://cp.pushwoosh.com/json/1.3/pushStat
| Payload: {"request":{"v":"3.2.0.614","device_type":3,"application":"57468-3DE96","hwid":"cbaf71b9a4e07f2c","hash":"1S","userId":"cbaf71b9a4e07f2c"}}
| Response: {"status_code":200,"status_message":"OK","response":null}
x
12-14 10:02:49.384 12344-12366/ D/Pushwoosh: [RequestManager] pushStat response success

AbsNotificationFactory::onGenerateNotification

I'm trying to generate my own notifications using AbsNotificationFactory::onGenerateNotificaion, but I have some problems:

  • The code is executed, but the returned notification is only displayed a few milliseconds. (If I run the same notificationbuilder code myself, and calling notify from the manager myself, outside pushwoosh environment, the notification is right). Also, doOnMessageReceive is called just after onGenerateNotification.
  • When the app is closed, onGenerateNotification(PushData) is not called. A notification appear, but obviously without the modification of onGenerateNotification.

DeadObjectExceptions for 9300 and 9305 Samsung S3 on Android 4.3

Hey guys, we've recently started to get a lot of DeadObjectExceptions for 9300 and 9305 Samsung S3 on Android 4.3. The stack looks like that basically and I cannot reproduce it with an emulator

Config.java com.pushwoosh.internal.utils.Config 28 Config.java com.pushwoosh.internal.utils.Config getInstance 59 PushEventsTransmitter.java com.pushwoosh.internal.PushEventsTransmitter getUseBroadcast 29 PushEventsTransmitter.java com.pushwoosh.internal.PushEventsTransmitter onRegisterError 83 DeviceRegistrar.java com.pushwoosh.internal.registrar.DeviceRegistrar$1InnerRegistrationListener onError 52 PushRequest.java com.pushwoosh.internal.request.PushRequest setProcessed 73 RequestManager.java com.pushwoosh.internal.request.RequestManager$1$1 run 167

or

Config.java com.pushwoosh.internal.utils.Config 28 Config.java com.pushwoosh.internal.utils.Config getInstance 59 PushEventsTransmitter.java com.pushwoosh.internal.PushEventsTransmitter getUseBroadcast 29 PushEventsTransmitter.java com.pushwoosh.internal.PushEventsTransmitter onRegisterError 83 GCMRegistrationService.java com.pushwoosh.GCMRegistrationService register 63 GCMRegistrationService.java com.pushwoosh.GCMRegistrationService onHandleIntent 106

Do you have any idea on what's happening? We are using PushWoosh 3.5.3, here's my init code - it's in a singleton.

   try {
        this.context = context;
        PushManager.initializePushManager(context, gygConfig.getPushWooshKey(), gygConfig.getGCMNumber());
        pushManager = PushManager.getInstance(context);
        pushManager.onStartup(context);
        pushManager.registerForPushNotifications();
        pushManager.setNotificationFactory(new PushFactory());
    } catch (Exception e) {
        Log.e(TAG, "Failed to track to PushWoosh", e);
    }

`GET_ACCOUNTS` permission no longer needed

The GET_ACCOUNTS permission is no longer needed for GCM to work.

It used to be required for registration to GCM, but a recent Play Services update stopped using the Google account even on Froyo and Gingerbread. If you are registering to GCM with Play Services (i.e. With GoogleCloudMessaging.register), you no longer need this permission on any Android version.

If you are using the deprecated library (GCMRegistrar.register), you still need a Google Account on pre 4.0.4 version, which requires that permission.

So, it would be awesome if you could drop this from the SDK (entirely or for the min versions where it's possible).

Asking for permissions tend to affect downloads (lower conversion rates in Play Store). Also, Google recommends asking for no more permissions than necessary[1].

[1] https://developer.android.com/training/articles/security-tips.html#RequestingPermissions

Local notifications AlarmReceiver - UIThread.

I want onGenerateNotification from AbsNotificationFactory to be executed on non UiThread.
I know AlarmReceiver's onReceive method is called on UiThread - which give me no possibility to process some async work (for example get Image for notification icon from backend).

Is there any workaround for this or is there any chance you will refactor AlarmReceiver to start IntentService instead of directly interacting with AbsNotificationFactory in future?

Rich media page Forbidden 403

Hi

I have updated to new version of sdk (4.9.0) because the pushwoosh library I was using (old one - jar version) does not receive any push notification anymore (compatibility issues????)

So, I have been forced to update to the latest version, and now I receive normal push notifications where the action is open the app.

However, when a push notification is sent with a rich media page, and the notification is open, the rich media page is not open and the 403 Forbidden message is show on the screen. This does not happen with the old sdk version I have integrated.

Why is this happening?

Thank you

Request client push or upstream push

Since your offering migration from Parse, I believe one feature Parse has is client or upstream push. I've scoured the documentation and I can't find a method that allows upstream push. Parse: Sending Push from Android

Specifically; this and this for Android would be the best. For the meantime; how do I send push notifications from an Android device to a target?

What is the need of Pushwoosh.Jar?

Related to Android Mobile Application.
Developed with Eclipse IDE.

  1. Once we create an Android App with some activities, we will get .apk after execution.
  2. That .apk, uploaded in Google Play Store.
  3. Later, I need to send push notifications to .apk which is installed in several mobile devices.
  4. In this scenario, Pushwoosh should get only Google Project ID and then it can deliver push notifications to devices. is it not?
  • Why we need to include pushwoosh.jar? Rolling back all AndroidManifest and MainActivity?
  • Really I could not understand.
  • I dont know, I may wrong. But still, Kindly clarify.

java.lang.NoClassDefFoundError: com.amazon.device.messaging.ADM

java.lang.NoClassDefFoundError: com.amazon.device.messaging.ADM
at com.arellomobile.android.push.registrar.PushRegistrarADM.<init>(Unknown Source)
at com.arellomobile.android.push.PushManager.<init>(Unknown Source)
at com.arellomobile.android.push.PushManager.<init>(Unknown Source)

https://developer.amazon.com/public/apis/engage/device-messaging/tech-docs/04-integrating-your-app-with-adm#Gracefully Degrade if ADM Is Unavailable

ADMAvailable = false;
try {
    Class.forName("com.amazon.device.messaging.ADM");
    ADMAvailable = true;
} catch (ClassNotFoundException e) {
    // Handle the exception.
}

JSONException when parsing server responses

Since today, I'm getting strange exceptions when my app is performing some actions with the sdk.

For example, I'm getting this exception:

      x
      |     Pushwoosh request:
      | Url: https://B65C1-67A8B.api.pushwoosh.com/json/1.3/setTags
      | Payload: {"request":{"tags":{"msisdn":    ["722505881","722500437"]},"v":"4.8.4","application":"53268-AB926","hwid":"65d5d76e02c11164","device_type":3,"userId":"65d5d76e02c11164"}}
      | Response: {"status_code":200,"status_message":"OK","response":{"skipped":{}}}
      x
 [RequestManager] setTags response success
 [RequestManager] ERROR: Value {} at skipped of type org.json.JSONObject cannot be converted to   JSONArray. Response = {"response":{"skipped":{}},"status_code":200,"status_message":"OK"}
       org.json.JSONException: Value {} at skipped of type org.json.JSONObject cannot be converted to   JSONArray at org.json.JSON.typeMismatch(JSON.java:100)
       at org.json.JSONObject.getJSONArray(JSONObject.java:552)
       at com.pushwoosh.internal.b.o.parseResponse(Unknown Source)
       at com.pushwoosh.internal.b.l.a(Unknown Source)
       at com.pushwoosh.internal.b.l$1.run(Unknown Source)

java.lang.RuntimeException for com.pushwoosh:pushwoosh:4.8.4

Hey!

I am getting blow crash on GI-I9500_TMMARS Device using Android 4.1.1
Have you fixed this issue on latest SDK?

Fatal Exception: java.lang.RuntimeException: Unable to instantiate receiver com.pushwoosh.MessageAlertReceiver: java.lang.ClassNotFoundException: com.pushwoosh.MessageAlertReceiver
       at android.app.ActivityThread.handleReceiver(ActivityThread.java:2248)
       at android.app.ActivityThread.access$1500(ActivityThread.java:131)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1272)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:137)
       at android.app.ActivityThread.main(ActivityThread.java:4791)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:511)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
       at dalvik.system.NativeStart.main(NativeStart.java)
Caused by java.lang.ClassNotFoundException: com.pushwoosh.MessageAlertReceiver
       at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
       at android.app.ActivityThread.handleReceiver(ActivityThread.java:2243)
       at android.app.ActivityThread.access$1500(ActivityThread.java:131)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1272)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:137)
       at android.app.ActivityThread.main(ActivityThread.java:4791)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:511)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
       at dalvik.system.NativeStart.main(NativeStart.java)

Saving custom data on notification launch time

Hi PushWoosh Team,
My app requirement is "Save the data,receiving in the notification." Second I want to open the desired activity onClick of notification.
Currently I can store the data only on that activity in
BroadcastReceiver mBroadcastReceiver = new BaseRegistrationReceiver() {
@OverRide
public void onRegisterActionReceive(Context context, Intent intent) {
checkMessage(intent);
}
};
private String data;
private BroadcastReceiver mReceiver = new BasePushMessageReceiver() {
@OverRide
protected void onMessageReceive(Intent intent) {
//JSON_DATA_KEY contains JSON payload of push notification.
//showMessage("push message is " + intent.getExtras().getString(JSON_DATA_KEY));
data = intent.getExtras().getString(JSON_DATA_KEY);
//*******Storing opration
} catch (JSONException e) {
e.printStackTrace();
}
}
};
but i want to store the data from anywhere even i am out of the app. but if the notification has been generated the data must be store in Sqlite.
Please suggest and help me what should i do?
Thanks

Create versioned releases

Please create versioned releases for the SDK. A Pushwoosh.jar in the projects libs folder makes it impossible to know if the lib is up-to-date or outdated.

Permission Denial: starting Intent

Getting this issue on Android KitKat 4.4.2. Have tried setting exported in manifest file for the activity, but still getting same error.

Permission Denial: starting Intent { flg=0x24000000 cmp=com.android.icreon.mlbpa/com.arellomobile.android.push.PushHandlerActivity bnds=[63,101][657,189](has extras) } from null (pid=-1, uid=10160) not exported from uid 10165

PushManager.getTagsAsync bugged when trying to load a list tag.

When I use PushManager.getTagsAsync to load my tags (include list-type tag) from Pushwoosh website, a exception of java.io.IOException: Serialization error: org.json.JSONArray came out.
This is the tags I loaded from Pushwoosh website.

Response: {"status_code":200,"status_message":"OK","response":{"result":{"Language":"zh","Application Version":"1.0","Country":"jp","City":"jp, tokyo","gree_user":1234567,"gree_name":"test_name","gree_attr":["test_x","test_y"],"channel_test":["four","two","three"],"Last Application Open":1457913600,"First Install":1457913600,"green_name":"test_name","green_user":1234567,"green_attr":["test_x","test_y"]}}}

This is the exception details I got.

03-14 16:07:05.610  16859-16859/net.gree.pushwooshtest E/Pushwoosh﹕ Exception ocurred
    java.io.IOException: Serialization error: org.json.JSONArray
            at com.pushwoosh.internal.utils.ObjectSerializer.serialize(Unknown Source)
            at com.pushwoosh.internal.utils.NotificationPrefs.setTags(Unknown Source)
            at com.pushwoosh.PushManager$1InnerTagsListener.onRequestFinished(Unknown Source)
            at com.pushwoosh.internal.request.PushRequest.setProcessed(Unknown Source)
            at com.pushwoosh.internal.request.RequestManager$1$1.run(Unknown Source)
            at android.os.Handler.handleCallback(Handler.java:739)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:211)
            at android.app.ActivityThread.main(ActivityThread.java:5373)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815)
     Caused by: java.io.NotSerializableException: org.json.JSONArray
            at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1344)
            at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1651)
            at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1497)
            at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1461)
            at java.util.HashMap.writeObject(HashMap.java:976)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1033)
            at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1384)
            at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1651)
            at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1497)
            at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1461)
            at com.pushwoosh.internal.utils.ObjectSerializer.serialize(Unknown Source)
            at com.pushwoosh.internal.utils.NotificationPrefs.setTags(Unknown Source)
            at com.pushwoosh.PushManager$1InnerTagsListener.onRequestFinished(Unknown Source)
            at com.pushwoosh.internal.request.PushRequest.setProcessed(Unknown Source)
            at com.pushwoosh.internal.request.RequestManager$1$1.run(Unknown Source)
            at android.os.Handler.handleCallback(Handler.java:739)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:211)
            at android.app.ActivityThread.main(ActivityThread.java:5373)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815)

I think the bug actually lies in this part.
Function : public static void getTagsAsync(Context context, final PushManager.GetTagsListener listener)

         public void onRequestFinished(PushRequest request) {
                     if(listener != null) {
                        GetTagsRequest req = (GetTagsRequest)request;
                        Map tags = req.getTags();
                        NotificationPrefs.setTags(applicationContext, tags);  // exception ocurred here !!!
                        listener.onTagsReceived(tags);
                    }
          }

It seems that setTags is trying to serialize a map which contains JSONArray (list-type tag ?). I think this is reason why java.io exception was triggered.
Function : public static void setTags(Context context, Map<String, Object> tags)

public static void setTags(Context context, Map<String, Object> tags) {
        String serialized;
        try {
            serialized = ObjectSerializer.serialize(tags);   // Exception occurred here !!!
        } catch (IOException var5) {
            Log.exception(var5); // Exception loged here !!!
            return;
        }

        SharedPreferences prefs = context.getSharedPreferences("com.pushwoosh.pushnotifications", 0);
        Editor editor = prefs.edit();
        editor.putString("cached_tags", serialized);
        editor.commit();
}

java.lang.NullPointerException in getPushEventListener

o/

I'm getting a null pointer exception while trying pushwoosh:

E/AndroidRuntime(17744): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference
E/AndroidRuntime(17744):    at com.arellomobile.android.push.fragment.PushFragment.getPushEventListener(Unknown Source)
E/AndroidRuntime(17744):    at com.arellomobile.android.push.fragment.PushFragment.checkMessage(Unknown Source)
E/AndroidRuntime(17744):    at com.arellomobile.android.push.fragment.PushFragment.access$000(Unknown Source)
E/AndroidRuntime(17744):    at com.arellomobile.android.push.fragment.PushFragment$1.onRegisterActionReceive(Unknown Source)
E/AndroidRuntime(17744):    at com.arellomobile.android.push.utils.RegisterBroadcastReceiver.onReceive(Unknown Source)
E/AndroidRuntime(17744):    at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:866)
E/AndroidRuntime(17744):    ... 8 more

I simply followed the Fragment documentation, registered my device as a test one, and sent a push.

App crash at startup, I have absolutely no idea on how to debug this as I only see arellomobile code in my stacktrace.

NoClassDefFoundError in version 3.1.0

Hellow! After migrate to new version (use this guide - http://docs.pushwoosh.com/docs/android-sdk-fragments), get error (Device Sony C6503, Android 4.4.4)

08-18 17:45:06.720 12366-12366/? E/Parcel﹕ Class not found when unmarshalling: com.google.android.gms.iid.MessengerCompat
java.lang.ClassNotFoundException: com.google.android.gms.iid.MessengerCompat
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:251)
at android.os.Parcel.readParcelableCreator(Parcel.java:2165)
at android.os.Parcel.readParcelable(Parcel.java:2129)
at android.os.Parcel.readValue(Parcel.java:2045)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2346)
at android.os.Bundle.unparcel(Bundle.java:249)
at android.os.Bundle.containsKey(Bundle.java:299)
at android.content.Intent.hasExtra(Intent.java:4456)
at com.pushwoosh.thirdparty.gms.iid.zzc.zze(Unknown Source)
at com.pushwoosh.thirdparty.gms.iid.zzc$1.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:212)
at android.app.ActivityThread.main(ActivityThread.java:5135)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: com/google/android/gms/iid/MessengerCompat
            at java.lang.Class.classForName(Native Method)
            at java.lang.Class.forName(Class.java:251)
            at android.os.Parcel.readParcelableCreator(Parcel.java:2165)
            at android.os.Parcel.readParcelable(Parcel.java:2129)
            at android.os.Parcel.readValue(Parcel.java:2045)
            at android.os.Parcel.readArrayMapInternal(Parcel.java:2346)
            at android.os.Bundle.unparcel(Bundle.java:249)
            at android.os.Bundle.containsKey(Bundle.java:299)
            at android.content.Intent.hasExtra(Intent.java:4456)
            at com.pushwoosh.thirdparty.gms.iid.zzc.zze(Unknown Source)
            at com.pushwoosh.thirdparty.gms.iid.zzc$1.handleMessage(Unknown Source)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:212)
            at android.app.ActivityThread.main(ActivityThread.java:5135)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
            at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.iid.MessengerCompat" on path: DexPathList[[zip file "/data/app/com.rwgg.reworld-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.rwgg.reworld-2, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
            at java.lang.Class.classForName(Native Method)
            at java.lang.Class.forName(Class.java:251)
            at android.os.Parcel.readParcelableCreator(Parcel.java:2165)
            at android.os.Parcel.readParcelable(Parcel.java:2129)
            at android.os.Parcel.readValue(Parcel.java:2045)
            at android.os.Parcel.readArrayMapInternal(Parcel.java:2346)
            at android.os.Bundle.unparcel(Bundle.java:249)
            at android.os.Bundle.containsKey(Bundle.java:299)
            at android.content.Intent.hasExtra(Intent.java:4456)
            at com.pushwoosh.thirdparty.gms.iid.zzc.zze(Unknown Source)
            at com.pushwoosh.thirdparty.gms.iid.zzc$1.handleMessage(Unknown Source)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:212)
            at android.app.ActivityThread.main(ActivityThread.java:5135)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
            at dalvik.system.NativeStart.main(Native Method)
08-18 17:45:06.720 12366-12366/? W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x4163fd88)
08-18 17:45:06.941 12366-12366/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.rwgg.reworld, PID: 12366
android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.google.android.gms.iid.MessengerCompat
at android.os.Parcel.readParcelableCreator(Parcel.java:2179)
at android.os.Parcel.readParcelable(Parcel.java:2129)
at android.os.Parcel.readValue(Parcel.java:2045)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2346)
at android.os.Bundle.unparcel(Bundle.java:249)
at android.os.Bundle.containsKey(Bundle.java:299)
at android.content.Intent.hasExtra(Intent.java:4456)
at com.pushwoosh.thirdparty.gms.iid.zzc.zze(Unknown Source)
at com.pushwoosh.thirdparty.gms.iid.zzc$1.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:212)
at android.app.ActivityThread.main(ActivityThread.java:5135)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
at dalvik.system.NativeStart.main(Native Method)

Push custom handler

I want to customize push behaviour if the application is opened or if its closed showing or not the notification.
So to do this, i have followed the tutorial on how to implement a Custom Push Broadcast Receiver, but when i receive a push, this is not handled by this Broadcast, even if i have set correctly the meta in the AndroidManifest.

I do not understand why this.

Thanks

Gradle support

Could you please make your library available through gradle?

unregisterForPushNotifications() bugged.

After calling this method (when user logs out for example), even if i call

onStartup()
sendTags()
registerForPushNotifications()

device doesn't receive push messages anymore.
Happens on many different devices and emulators.

The only one solution is to remove app and install it again.
As a temporary solution i don't call unregisterForPushNotifications() on user logout, but you need to fix it asap.

java.lang.NoClassDefFoundError: com/amazon/device/messaging/ADMMessageReceiver

If you try to run Robolectric tests, you'll get this exception:

java.lang.NoClassDefFoundError: com/amazon/device/messaging/ADMMessageReceiver
    at java.lang.ClassLoader.defineClass1(Native Method)
     at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
     at java.lang.ClassLoader.defineClass(ClassLoader.java:642)
     at org.robolectric.internal.bytecode.InstrumentingClassLoader.findClass(InstrumentingClassLoader.java:153)
     at org.robolectric.internal.bytecode.InstrumentingClassLoader.loadClass(InstrumentingClassLoader.java:95)
     at java.lang.Class.forName0(Native Method)
     at java.lang.Class.forName(Class.java:264)
     at org.robolectric.internal.Shadow.newInstanceOf(Shadow.java:15)
     at org.robolectric.shadows.ShadowApplication.registerBroadcastReceivers(ShadowApplication.java:148)
     at org.robolectric.shadows.ShadowApplication.bind(ShadowApplication.java:137)
     at org.robolectric.shadows.CoreShadowsAdapter.bind(CoreShadowsAdapter.java:99)
     at org.robolectric.internal.ParallelUniverse.setUpApplicationState(ParallelUniverse.java:121)
     at org.robolectric.RobolectricTestRunner.setUpApplicationState(RobolectricTestRunner.java:433)
     at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:240)
     at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:188)
     at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:54)
     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
     at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
     at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:152)
     at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
     at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
     at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
     at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
     at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at java.lang.reflect.Method.invoke(Method.java:497)
     at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
     Caused by: java.lang.ClassNotFoundException: com.amazon.device.messaging.ADMMessageReceiver
     at org.robolectric.internal.bytecode.InstrumentingClassLoader.getByteCode(InstrumentingClassLoader.java:168)
     at org.robolectric.internal.bytecode.InstrumentingClassLoader.findClass(InstrumentingClassLoader.java:123)
     at org.robolectric.internal.bytecode.InstrumentingClassLoader.loadClass(InstrumentingClassLoader.java:95)
     ... 32 more

Robolectric version: 3.0
Pushwoosh version: 4.6.1

Workaround:
In your test forlder create a package com.amazon.device.messaging with two classes:

public class ADMMessageHandlerBase {
}

public class ADMMessageReceiver extends android.content.BroadcastReceiver {

    public ADMMessageReceiver(Class<?> clazz) {

    }

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

    }
}

Unmarshalling unknown type code

Since update to 4.+ version (from 3.+) I am getting this error message.

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.my.app/com.pushwoosh.PushHandlerActivity}: java.lang.RuntimeException: Parcel android.os.Parcel@d3fa3ae: Unmarshalling unknown type code 6881384 at offset 4944
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
       at android.app.ActivityThread.-wrap11(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:148)
       at android.app.ActivityThread.main(ActivityThread.java:5417)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by java.lang.RuntimeException: Parcel android.os.Parcel@d3fa3ae: Unmarshalling unknown type code 6881384 at offset 4944
       at android.os.Parcel.readValue(Parcel.java:2340)
       at android.os.Parcel.readArrayMapInternal(Parcel.java:2614)
       at android.os.BaseBundle.unparcel(BaseBundle.java:221)
       at android.os.BaseBundle.getBoolean(BaseBundle.java:659)
       at com.pushwoosh.internal.PushManagerImpl.preHandlePush(PushManagerImpl.java:102)
       at com.pushwoosh.internal.PushManagerImpl.onHandlePush(PushManagerImpl.java:59)
       at com.pushwoosh.PushHandlerActivity.handlePush(PushHandlerActivity.java:29)
       at com.pushwoosh.PushHandlerActivity.onCreate(PushHandlerActivity.java:24)
       at android.app.Activity.performCreate(Activity.java:6251)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
       at android.app.ActivityThread.-wrap11(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:148)
       at android.app.ActivityThread.main(ActivityThread.java:5417)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

getLaunchNotification returns notification all the time

getLaunchNotification returns notification even if the application is not opened in response to push notification.
It's seems like it is returning the latest push notification that has been received.
Even if I call clearNotificationCenter the first time I receive a notification, it returns the latest push next time a call getLaunchNotification

@Override
protected void onStart() {
    super.onStart();

    String launchNotification = PushManager.getInstance(this).getLaunchNotification();
    if (launchNotificatin != null)
    {
        Log.d(“trace", "onStart Launch notification received: " + launchNotificatin);
         // Show alert dialog and stuff
        PushManager.clearNotificationCenter(this);
    }
    else
    {
        Log.d("trace", "onStart No launch notification received");
    }
}

java.io.FileNotFoundException: http://cp.pushwoosh.com/json/1.3/registerUser

I am getting following error:

E/Pushwoosh﹕ [RequestManager] ERROR: http://cp.pushwoosh.com/json/1.3/registerUser. Response = null
java.io.FileNotFoundException: http://cp.pushwoosh.com/json/1.3/registerUser at com.android.okhttp.internal.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:197)
at com.pushwoosh.internal.request.RequestManager.makeRequest(Unknown Source)
at com.pushwoosh.internal.request.RequestManager.sendRequestSync(Unknown Source)
at com.pushwoosh.PushManager.registerUserInternal(Unknown Source)
at com.pushwoosh.PushManager.access$000(Unknown Source)
at com.pushwoosh.PushManager$1.run(Unknown Source)

Does anyone knows what could be a problem?

Received: Bundle[{CMD=RST_FULL, from=google.com/iid, android.support.content.wakelockid=1}]

We started to notice some push notification coming in that look like the following and happen only on (first?) app start:

Received: Bundle[{CMD=RST_FULL, from=google.com/iid, android.support.content.wakelockid=1}]

I found the following post on StackOverflow: http://stackoverflow.com/questions/30479424/weird-push-message-received-on-app-start

I assume that there is a change needed in the PushWoosh SDK due to this new GCM behavior. Could you please have a look at this?

GeoLocationService crashes

Hello,

I am using pushwoosh library v. 2.9.11 for Android and I have encountered following random crashes in my app.



    java.lang.NullPointerException
           at android.location.Location.distanceTo(Location.java:428)
           at com.arellomobile.android.push.GeoLocationService.onLocationChanged()
           at android.location.LocationManager$ListenerTransport._handleMessage(LocationManager.java:255)
           at android.location.LocationManager$ListenerTransport.access$000(LocationManager.java:184)
           at android.location.LocationManager$ListenerTransport$1.handleMessage(LocationManager.java:200)
           at android.os.Handler.dispatchMessage(Handler.java:99)
           at android.os.Looper.loop(Looper.java:176)
           at android.app.ActivityThread.main(ActivityThread.java:5419)
           at java.lang.reflect.Method.invokeNative(Method.java)
           at java.lang.reflect.Method.invoke(Method.java:525)
           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
           at dalvik.system.NativeStart.main(NativeStart.java)


java.lang.RuntimeException: Error receiving broadcast Intent { act=com.tenforwardconsulting.cordova.bgloc.SINGLE_LOCATION_UPDATE_ACTION flg=0x10 (has extras) } in com.arellomobile.android.push.GeoLocationService$1@413dedb0
       at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:737)
       at android.os.Handler.handleCallback(Handler.java:605)
       at android.os.Handler.dispatchMessage(Handler.java:92)
       at android.os.Looper.loop(Looper.java:137)
       at android.app.ActivityThread.main(ActivityThread.java:4519)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:511)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:561)
       at dalvik.system.NativeStart.main(NativeStart.java)
Caused by: java.lang.NullPointerException
       at android.location.Location.distanceTo(Location.java:413)
       at com.arellomobile.android.push.GeoLocationService.onPollStationaryLocation()
       at com.arellomobile.android.push.GeoLocationService.access$000()
       at com.arellomobile.android.push.GeoLocationService$1.onReceive()
       at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:728)
       at android.os.Handler.handleCallback(Handler.java:605)
       at android.os.Handler.dispatchMessage(Handler.java:92)
       at android.os.Looper.loop(Looper.java:137)
       at android.app.ActivityThread.main(ActivityThread.java:4519)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:511)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:561)
       at dalvik.system.NativeStart.main(NativeStart.java)
    


java.lang.RuntimeException: Unable to create service com.arellomobile.android.push.GeoLocationService: java.lang.RuntimeException: Init failed
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2382)
at android.app.ActivityThread.access$1600(ActivityThread.java:131)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4754)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(NativeStart.java)
Caused by: java.lang.RuntimeException: Init failed
at android.media.ToneGenerator.native_setup(ToneGenerator.java)
at android.media.ToneGenerator.(ToneGenerator.java:740)
at com.arellomobile.android.push.GeoLocationService.onCreate()
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2372)
at android.app.ActivityThread.access$1600(ActivityThread.java:131)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4754)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(NativeStart.java)


All of above unfortunately come from the inside of the GeoLocationService class and it does not seem that I can do anything about it in my app.

Basing on the first two stacktraces I presume that there is null Location object passed to the Location#distanceTo() method.

Regarding last stacktrace I might have found a solution here:
http://stackoverflow.com/questions/13439051/tonegenerator-crash-android/13868360

If there's more data that I should provide, please let me know.
Is there any fix that I can apply on the app's side? Perhaps above problems had been already fixed in the newest library release?

Cheers

Cancel a local notification with local id

After showing a local notification i want to cancel it at a particular action.
So how i tried to retrieve local id of the push notification generated locally. But i tried below code

NotificationManager nMgr = (NotificationManager) getSystemService(ns); nMgr.cancel(local_push_id);

It didn't work for me as the ids were different

Hence i had to find a work around

ArrayList<String> arrayList = PushManager.getInstance(getContext()).getPushHistory(); JSONObject lastNotification = new JSONObject(arrayList.get(arrayList.size()-1)); int message_id = lastNotification.getInt("message_id");

Now i get last message_id from above code. But u need to have a function which gives us the message_id
directly.

Also u need to give us a direct way to clear a particular notification by local id.

Application not found

I am getting following exception in all of my apps on request https://cp.pushwoosh.com/json/1.3/registerUser
But request https://cp.pushwoosh.com/json/1.3/registerDevice is working ok.

java.lang.Exception: {"status_code":210,"status_message":"Application not found"}
at com.pushwoosh.internal.request.RequestManager.sendRequestSync(Unknown Source)
at com.pushwoosh.PushManager.registerUserInternal(Unknown Source)
at com.pushwoosh.PushManager.access$000(Unknown Source)
at com.pushwoosh.PushManager$1.run(Unknown Source)

Deploy releases to a public maven repository

Please deploy the versioned releases (see #10) to a public maven repository like "jcenter" or "maven central". This way the library dependency can simply be defined in the project's configuration dependency block (e.g. build.gradle). The build system will handle everything else.

To many permissions needed

Hi!

After 4.3.0 version Pushwoosh SDK automaticaly added two new permissions:

  • android.permission.READ_PHONE_STATE
  • android.permission.GET_ACCOUNTS

Why?
As I remember well, they were optional before. Do we really need them? Our application got some 1 star rates in Google Play Store because they appeared after app update.

Where has the Android source code gone!?

What has happened to the Android SDK source code?

It was here last year and now it's gone. It's been replaced by jar, which is nice for some users, but not ideal for everyone else.

Improve getDeviceUUID() method.

Current method will return "unknown" for 90% of different chinece devices which is unacceptable.
Please improve it or use mine.

Current method (decompiled):

private static List<String> sWrongAndroidDevices = new ArrayList();
static {
        sWrongAndroidDevices.add("9774d56d682e549c");
    }

@SuppressLint({"WorldWriteableFiles"})
    public static String getDeviceUUID(Context var0) {
        String var1 = Secure.getString(var0.getContentResolver(), "android_id");
        if(null != var1 && !sWrongAndroidDevices.contains(var1)) {
            return var1;
        } else {
            try {
                String var2 = ((TelephonyManager)var0.getSystemService("phone")).getDeviceId();
                if(null != var2) {
                    return var2;
                }
            } catch (RuntimeException var5) {
                ;
            }

            SharedPreferences var6 = var0.getSharedPreferences("com.pushwoosh.deviceid", 2);
            String var3 = var6.getString("deviceid", (String)null);
            if(null != var3) {
                return var3;
            } else {
                var3 = UUID.randomUUID().toString();
                Editor var4 = var6.edit();
                var4.putString("deviceid", var3);
                var4.commit();
                return var3;
            }
        }
    }

Improved method (class):

import android.content.Context;
import android.os.Build;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.text.TextUtils;

import java.util.UUID;

public abstract class DeviceUtils {
    private static final String EMULATOR_ANDROID_ID = "9774d56d682e549c";
    private static final String[] BAD_SERIAL_PATTERNS = {"1234567", "abcdef", "dead00beef", "unknown"};

    /**
     * Generating deviceId based on available data
     * @param context ApplicationContext
     * @return deviceId string
     */
    public static String getDeviceId(final Context context) {
        String deviceId;

        /**
         * A hardware serial number, if available. Alphanumeric only, case-insensitive.
         */
        final String androidSerialId = android.os.Build.SERIAL;
        if (!TextUtils.isEmpty(androidSerialId) && !Build.UNKNOWN.equals(androidSerialId) && !isBadSerial(androidSerialId)) {
            deviceId = androidSerialId;
        } else {
            /**
             * A 64-bit number (as a hex string) that is randomly
             * generated when the user first sets up the device and should remain
             * constant for the lifetime of the user's device. The value may
             * change if a factory reset is performed on the device.
             * <p class="note"><strong>Note:</strong> When a device has <a
             * href="{@docRoot}about/versions/android-4.2.html#MultipleUsers">multiple users</a>
             * (available on certain devices running Android 4.2 or higher), each user appears as a
             * completely separate device, so the {@code ANDROID_ID} value is unique to each
             * user.</p>
             */
            final String androidSecureId = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
            if (!TextUtils.isEmpty(androidSecureId) && !EMULATOR_ANDROID_ID.equals(androidSecureId) && !isBadDeviceId(androidSecureId)
                    && androidSecureId.length() == EMULATOR_ANDROID_ID.length()) {
                deviceId = androidSecureId;
            } else {
                String telephonyDeviceId = null;
                try {
                    /**
                     * Returns the unique device ID, for example, the IMEI for GSM and the MEID
                     * or ESN for CDMA phones. Return null if device ID is not available.
                     *
                     * <p>Requires Permission:
                     *   {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
                     */
                    telephonyDeviceId = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId();
                } catch (RuntimeException e) {
                    e.printStackTrace();
                }
                if (!TextUtils.isEmpty(telephonyDeviceId)) {
                    deviceId = telephonyDeviceId;
                } else {
                    /**
                     * Returns generated UUID if all other data is unavailable
                     * Can be modified by user
                     */
                    String prefDeviceId = PrefUtils.getDeviceId(context);
                    if (TextUtils.isEmpty(prefDeviceId)) {
                        prefDeviceId = UUID.randomUUID().toString();
                        PrefUtils.saveDeviceId(context, prefDeviceId);
                    }
                    deviceId = prefDeviceId;
                }
            }
        }
        return UUID.nameUUIDFromBytes(deviceId.getBytes()).toString();
    }

    private static boolean isBadDeviceId(String id) {
        // empty or contains only spaces or 0
        return TextUtils.isEmpty(id) || TextUtils.isEmpty(id.replace('0', ' ').replace('-', ' ').trim());
    }

    private static boolean isBadSerial(String id) {
        if (!TextUtils.isEmpty(id)) {
            id = id.toLowerCase();
            for (String pattern : BAD_SERIAL_PATTERNS) {
                if (id.contains(pattern)) {
                    return true;
                }
            }
        } else {
            return true;
        }
        return false;
    }
}

How to turn on/off push notification?

I tried to turn on/off push notification from a Setting menu.

BUT it doesn't work.

Because we always run PushFragment.init on the main activity which always register for push notification.

If I don't call that, but PushFragment.getFragment, then call register, it failed with NullPointerException.

Plz advice.

Custom AbsNotificationFactory not working after restart

Hi,
I have an issue with a custom AbsNotificationFactory that I've created. When I restart the device or when my application stays closed for a long time, then the notifications that I receive don't take into account any of the customizations that I make in my custom AbsNotificationFactory.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.