GithubHelp home page GithubHelp logo

onesignal / onesignal-android-sdk Goto Github PK

View Code? Open in Web Editor NEW
586.0 66.0 359.0 26.9 MB

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native Android or Amazon app with OneSignal. https://onesignal.com

License: Other

Java 2.73% Kotlin 97.23% Shell 0.04%
notification-service push-notifications sdk android-sdk java onesignal onesignal-notifications gcm fcm amazon

onesignal-android-sdk's Introduction

OneSignal Android Push Notification Plugin

Maven Central Build Status


⚠️ Migration Advisory for current OneSignal customers

Our new user-centric APIs and v5.x.x SDKs offer an improved user and data management experience. However, they may not be at 1:1 feature parity with our previous versions yet.

If you are migrating an existing app, we suggest using Android’s Phased Rollout capabilities to ensure that there are no unexpected issues or edge cases. Here is the documentation for each:

Google Play Staged Rollouts

If you run into any challenges or have concerns, please contact our support team at [email protected]


OneSignal is a free email, sms, push notification, and in-app message service for mobile apps. This plugin makes it easy to integrate your native Android or Amazon app with OneSignal.

Android Notification

Installation

See OneSignal's Android Native SDK Setup Guide for documentation.

API

See OneSignal's Android Native SDK API page for a list of all available methods.

Change Log

See this repository's release tags for a complete change log of every released version.

Support

Please visit this repository's Github issue tracker for feature requests and bug reports related specifically to the SDK. For account issues and support please contact OneSignal support from the OneSignal.com dashboard.

Demo Project

To make things easier, we have published demo projects in the /Examples folder of this repository.

Supports:

  • Tested from Android 5.0 (API level 21) to Android 14 (34)

onesignal-android-sdk's People

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  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  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

onesignal-android-sdk's Issues

Can not delete tag with number value

I have a tag that has number as it's value, and whenever I tried to delete the tag I got:

java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
at com.onesignal.OneSignalStateSynchronizer.generateJsonDiff(OneSignalStateSynchronizer.java:94)
at com.onesignal.OneSignalStateSynchronizer.generateJsonDiff(OneSignalStateSynchronizer.java:82)
at com.onesignal.OneSignalStateSynchronizer.sendTags(OneSignalStateSynchronizer.java:472)
at com.onesignal.OneSignal.sendTags(OneSignal.java:644)
at com.onesignal.OneSignal.deleteTags(OneSignal.java:716)

This only happen in newest version because at tags deletion you change the value to empty String (OneSignal.java:716) but also try to cast it into Number (OneSignalStateSynchronizer.java:94).

Add callback to sendTags method

Hey,

I'm using sendTags method to send tags to OneSignal but I want my app to move ahead once those tags are saved on OneSignal. Moreover the REST API implementation of sending tags provide a response.
I'm hoping to see a callback method for the sendTags method, something to similar to sendTags method callback function in Web Push

Action buttons are not displaying

Action buttons do not display if NotificationExtenderService isn't setup in the AndroidManifest.xml. This is a regression bug since 2.4.0.

I got error from fabric reported about NotificationBundleProcessor.java class

So right that i just said the error show on fabric the detail is about

Fatal Exception: java.lang.NullPointerException
com.onesignal.NotificationBundleProcessor.ProcessFromGCMIntentService (NotificationBundleProcessor.java:57)
com.onesignal.GcmIntentService.onHandleIntent (GcmIntentService.java:54)
android.app.IntentService$ServiceHandler.handleMessage (IntentService.java:65)
android.os.Handler.dispatchMessage (Handler.java:99)
android.os.Looper.loop (Looper.java:137)
android.os.HandlerThread.run (HandlerThread.java:61)

and it said NotificationBundleProcessor.java:57 : null pointer exception. so can you guys check about this class and the line of reported showing.

Android - POST Error thrown from network stack.

We are facing multiple errors while integrating onesignal in android.
First error -
W/OneSignal: POST Error thrown from network stack. javax.net.ssl.SSLException: Read error: ssl=0xafcab200: I/O error during system call, Connection reset by peer at com.android.org.conscrypt.NativeCrypto.SSL_read(Native Method) at com.android.org.conscrypt.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:699) at com.android.okio.Okio$2.read(Okio.java:113) at com.android.okio.RealBufferedSource.indexOf(RealBufferedSource.java:147) at com.android.okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:94) at com.android.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:179) at com.android.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:101) at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:628) at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:388) at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:332) at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:500) at com.android.okhttp.internal.http.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105) at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25) at com.onesignal.OneSignalRestClient.makeRequest(OneSignalRestClient.java:109) at com.onesignal.OneSignalRestClient.postSync(OneSignalRestClient.java:77) at com.onesignal.OneSignalStateSynchronizer.syncUserState(OneSignalStateSynchronizer.java:515) at com.onesignal.OneSignalStateSynchronizer$NetworkHandlerThread$1.run(OneSignalStateSynchronizer.java:440) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.os.HandlerThread.run(HandlerThread.java:61) 05-14 13:44:42.262 16816-16865/com.cognistx.monro W/OneSignal: Failed last request. statusCode: -1 response: null

Second error -
W/OneSignal: POST Error thrown from network stack. java.io.EOFException at com.android.okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:95) at com.android.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:179) at com.android.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:101) at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:628) at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:388) at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:332) at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:500) at com.android.okhttp.internal.http.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105) at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25) at com.onesignal.OneSignalRestClient.makeRequest(OneSignalRestClient.java:109) at com.onesignal.OneSignalRestClient.postSync(OneSignalRestClient.java:77) at com.onesignal.OneSignalStateSynchronizer.syncUserState(OneSignalStateSynchronizer.java:515) at com.onesignal.OneSignalStateSynchronizer$NetworkHandlerThread$1.run(OneSignalStateSynchronizer.java:440) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.os.HandlerThread.run(HandlerThread.java:61) 05-14 13:45:12.579 16816-16865/com.cognistx.monro W/OneSignal: Failed last request. statusCode: -1 response: null

This is very critical for us.
Need help ASAP.

Notification not delivered

I started developed an app with the one signal push notification service, but for some reasons in come devices when the app is removed from the history (slide away) the notifications is not showed anymore, but not the one signal panel the status of the notification is delivered...

It happens on a Asus Zendfone devices.

Anyone with the same problem ?

Fatal Exception: java.lang.NoSuchMethodError

Hello,

I have an application in production which uses the OneSignal SDK. I also have included Fabric/Crashlytics and it notifies me about a crash related to the SDK, that I can't reproduce :

Fatal Exception: java.lang.NoSuchMethodError: android.app.Activity.requestPermissions
at com.onesignal.AndroidSupportV4Compat$ActivityCompatApi23.requestPermissions(AndroidSupportV4Compat.java:66)
at com.onesignal.AndroidSupportV4Compat$ActivityCompat.requestPermissions(AndroidSupportV4Compat.java:57)
at com.onesignal.PermissionsActivity.requestPermission(PermissionsActivity.java:59)
at com.onesignal.PermissionsActivity.onCreate(PermissionsActivity.java:47)
at android.app.Activity.performCreate(Activity.java:5218)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2038)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2099)
at android.app.ActivityThread.access$600(ActivityThread.java:145)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
at android.os.Handler.dispatchMessage(Handler.java:119)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4873)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:528)
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)

This crash seems to be related with devices running Android L (5.1) or below.

Getting notificationId on opened

Hello,

Is there anyway we can get a notification id on opened or on received? I would like to have it for logging purpose. Otherwise, if possible, can I access to the database that OneSignal currently used to store notification history?

I cant't subscribe to One Signal .. why?

Hi... my project is completely similar to your github app but i included jar library file (v 2.0.8 ) because i wasn't able to compile your library via compile 'com.onesignal:OneSignal:2.+@aar'. and when i run my app nothing happen and there is no user in my dashboard! and i get a null pointer exeption (showing in logcat) in my application class on this line > OneSignal.startInit(this) (just like your sample project) and even during test setting my app in your site i get some error:
Verify that the OneSignal App ID is correct in your app or site.
fa175ba3-7403-495b-a5e9-596736775914
Run OneSignal.setLogLevel(OneSignal.LOG_LEVEL.DEBUG, OneSignal.LOG_LEVEL.DEBUG); before OneSignal initialization and check your ADB logcat for errors or warnings

But i did these steps :( can any body what's wrong in my app?
THanks in advance...

Indonesian language not correctly detected

We are having some issue on segmenting the android user (iPhone working fine). We tried to segment the user by Language Code. If the user device locale is Indonesian Bahasa, it is not registering for some reason. For Android Chinese language is also segmenting working. Could you please help on this issue.

SDK does not handle push token update on background

As ffar as I could understand of this project, the push token will not be updated if the app is not open for a while.
The token registration process is only triggered in the method onAppFocus, if the user does not open the app for a while, the push token will be invalidated by google and the user will stop receiving push notifications.
Use this link as samples to update the implementation:
https://github.com/googlesamples/google-services/tree/master/android/gcm/app/src/main/java/gcm/play/android/samples/com

DatabaseNotClosedException raised when notification arrives

I'm running the app in StrictMode. I get the following exception when notification comes on the app:

Finalizing a Cursor that has not been deactivated or closed. database = /data/data/com.patientapp/databases/OneSignal.db, table = notification, query = SELECT notification_id FROM notification WHERE notification_id = ?
12-02 17:20:45.025 4035-4044/com.patientapp E/StrictMode: android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
12-02 17:20:45.025 4035-4044/com.patientapp E/StrictMode: at android.database.sqlite.SQLiteCursor.(SQLiteCursor.java:98)
12-02 17:20:45.025 4035-4044/com.patientapp E/StrictMode: at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:50)
12-02 17:20:45.025 4035-4044/com.patientapp E/StrictMode: at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1314)
12-02 17:20:45.025 4035-4044/com.patientapp E/StrictMode: at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1161)
12-02 17:20:45.025 4035-4044/com.patientapp E/StrictMode: at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1032)
12-02 17:20:45.025 4035-4044/com.patientapp E/StrictMode: at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1200)
12-02 17:20:45.025 4035-4044/com.patientapp E/StrictMode: at com.onesignal.OneSignal.isDuplicateNotification(OneSignal.java:1263)
12-02 17:20:45.025 4035-4044/com.patientapp E/StrictMode: at com.onesignal.OneSignal.isValidAndNotDuplicated(OneSignal.java:1290)
12-02 17:20:45.025 4035-4044/com.patientapp E/StrictMode: at com.onesignal.NotificationBundleProcessor.Process(NotificationBundleProcessor.java:48)
12-02 17:20:45.025 4035-4044/com.patientapp E/StrictMode: at com.onesignal.GcmIntentService.onHandleIntent(GcmIntentService.java:66)
12-02 17:20:45.025 4035-4044/com.patientapp E/StrictMode: at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
12-02 17:20:45.025 4035-4044/com.patientapp E/StrictMode: at android.os.Handler.dispatchMessage(Handler.java:102)
12-02 17:20:45.025 4035-4044/com.patientapp E/StrictMode: at android.os.Looper.loop(Looper.java:136)
12-02 17:20:45.025 4035-4044/com.patientapp E/StrictMode: at android.os.HandlerThread.run(HandlerThread.java:61)

Exception thrown for apps without a Launcher Intent

The follow exception occurs when a notification is received on an app without a Launcher Intent.

java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.ComponentName android.content.Intent.getComponent()' on a null object reference 
at com.onesignal.shortcutbadger.ShortcutBadger.initBadger(ShortcutBadger.java:92) 
at com.onesignal.shortcutbadger.ShortcutBadger.applyCountOrThrow(ShortcutBadger.java:65) 
at com.onesignal.shortcutbadger.ShortcutBadger.applyCount(ShortcutBadger.java:50) 
at com.onesignal.BadgeCountUpdater.updateCount(BadgeCountUpdater.java:72) 
at com.onesignal.BadgeCountUpdater.update(BadgeCountUpdater.java:66) 
at com.onesignal.NotificationBundleProcessor.saveNotification(NotificationBundleProcessor.java:104) 
at com.onesignal.NotificationBundleProcessor.Process(NotificationBundleProcessor.java:58) 
at com.onesignal.NotificationBundleProcessor.ProcessFromGCMIntentService(NotificationBundleProcessor.java:51) 
at com.onesignal.GcmIntentService.onHandleIntent(GcmIntentService.java:54) 
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:136) 
at android.os.HandlerThread.run(HandlerThread.java:61)

POST Error thrown from network stack causes ConcurrentModificationException

This issue was caught developing the Xamarin SDK which builds on top of OneSignal-Android-SDK 2.1.1.

The issue appears to be occurring after DeleteTags.

DeleteTags was called to clean up any tags on the OneSignal server. It looks like the DeleteTags call did succeed, but a low-level Java exception was thrown in the process:

[libc] getaddrinfo called from pid =19367
[libc] getaddrinfo called from pid =19367
[libc] dnsproxy getaddrinfo returns 0
[OneSignal] POST Error thrown from network stack. 
[OneSignal] java.util.ConcurrentModificationException
[OneSignal]     at java.util.HashMap$HashIterator.nextEntry(HashMap.java:806)
[OneSignal]     at java.util.HashMap$KeyIterator.next(HashMap.java:833)
[OneSignal]     at com.onesignal.OneSignalStateSynchronizer$UserState.persistStateAfterSync(OneSignalStateSynchronizer.java:313)
[OneSignal]     at com.onesignal.OneSignalStateSynchronizer$UserState.access$600(OneSignalStateSynchronizer.java:150)
[OneSignal]     at com.onesignal.OneSignalStateSynchronizer$2.onSuccess(OneSignalStateSynchronizer.java:454)
[OneSignal]     at com.onesignal.OneSignalRestClient.makeRequest(OneSignalRestClient.java:117)
[OneSignal]     at com.onesignal.OneSignalRestClient.postSync(OneSignalRestClient.java:76)
[OneSignal]     at com.onesignal.OneSignalStateSynchronizer.syncUserState(OneSignalStateSynchronizer.java:436)
[OneSignal]     at com.onesignal.OneSignalStateSynchronizer$NetworkHandlerThread$1.run(OneSignalStateSynchronizer.java:361)
[OneSignal]     at android.os.Handler.handleCallback(Handler.java:733)
[OneSignal]     at android.os.Handler.dispatchMessage(Handler.java:95)
[OneSignal]     at android.os.Looper.loop(Looper.java:136)
[OneSignal]     at android.os.HandlerThread.run(HandlerThread.java:61)
[OneSignal] Failed last request. statusCode: 200

Request: Add push message id "i" to NotificationOpenedHandler

I am trying to make a link between the push message that was clicked and background data that I received. In background data I can use the push message "i" index, but this is not available in additional data. Would it be possible to add this?

Getting Two Push Notification.

I have Implemented my own Push receiver class. But I am getting two push notification. One is my and the other one is default with the messages which I am sending from OneSignal.
I have declared my Receiver in the manifest.
Please help.
device-2016-04-11-164321

UNEXPECTED TOP-LEVEL EXCEPTION

I got this error after linking the library with the Android project (React Native)

Unknown source file : UNEXPECTED TOP-LEVEL EXCEPTION:
Unknown source file : com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzas;
Unknown source file :   at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
Unknown source file :   at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
Unknown source file :   at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
Unknown source file :   at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
Unknown source file :   at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
Unknown source file :   at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
Unknown source file :   at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
Unknown source file :   at com.android.dx.command.dexer.Main.run(Main.java:277)
Unknown source file :   at com.android.dx.command.dexer.Main.main(Main.java:245)
Unknown source file :   at com.android.dx.command.Main.main(Main.java:106)

gradle?

Have you tried jar file on android studio? It seems that it doesn't work. Would you please add the library to maven?

Stacking the notifications - icons

We are implementing the push notifications for some user messaging and we were trying to stack the messages nicely.
Each message can have different large icon and in this case when they stack on eachother, the icon should be changed into app icon. As on example from your documentation:

Image

We couldnt find a way to make it - it seems there is always an icon from the last notification shown. Is it possible to achieve that?

onPause NPE

Hi,

I'm trying to share some content with ACTION_SEND intents. Before share dialog (chooser) is shown application crashes with following exception:

java.lang.RuntimeException: Unable to pause activity {cz...../cz.....activity.MainActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3086)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3041)
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3019)
at android.app.ActivityThread.access$1000(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1216)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5179)
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:798)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:614)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.onesignal.OneSignal.getGcmPreferences(OneSignal.java:760)
at com.onesignal.OneSignal.GetUnsentActiveTime(OneSignal.java:744)
at com.onesignal.OneSignal.onPaused(OneSignal.java:268)
at cz.something.something.activity.MainActivity.onPause(MainActivity.java:77)
at android.app.Activity.performPause(Activity.java:5350)
at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1233)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3072)
            at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3041)
            at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3019)
            at android.app.ActivityThread.access$1000(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1216)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5179)
            at java.lang.reflect.Method.invokeNative(Native Method)

@Override
protected void onResume() {
    super.onResume();
    OneSignal.onResumed();
    App.bus().register(this);
}

@Override
protected void onPause() {
    super.onPause();
    OneSignal.onPaused(); // < -- line 77
    App.bus().unregister(this);
}

Sharing:
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/jpeg");
share.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(imageFile));
context.startActivity(Intent.createChooser(share, "Share"));

Thanks for every suggestion.

Badge icon number - Count out of sync after reboot

After Android is rebooted OneSignal notifications do not reappear so the badge count value is no longer in sync with the number of notifications. Notifications should reappear or the counter should reset on boot.

May also be an issue when notifications are cleared programmatically.

Potentially dangerous cast inside Onesignal.Log method

https://github.com/one-signal/OneSignal-Android-SDK/blob/b05676b9f4844bac4658bab5021ed0b94dd997f1/OneSignalSDK/onesignal/src/main/java/com/onesignal/OneSignal.java#L378

Since context here is Context type, (Activity)context can raise RuntimeException if caller passes non-Activity context as argument. OneSignal.Log method is public, so anyone can call it.

I believe right approach here is implement own runOnUiThread method, rather than relying on Activity's method. Following is part of platform code, and as you can see runOnUiThread method can be implemented with a few lines of code.

   public final void runOnUiThread(Runnable action) {
        if (Thread.currentThread() != mUiThread) {
            mHandler.post(action);
        } else {
            action.run();
        }
    }

Another separate but related issue is that, OneSignal.init method requires Activity as argument. I feel like this should be Context as you don't really need Activity here especially after you fix this bug.

NotificationExtenderService - NumberFormatException

Error assigning OSNotificationPayload values! is being logged from NotificationExtenderService when it is turned on.

Error assigning OSNotificationPayload values!
java.lang.NumberFormatException: Invalid int: "null"
    at java.lang.Integer.invalidInt(Integer.java:137)
    at java.lang.Integer.parseInt(Integer.java:354)
    at java.lang.Integer.parseInt(Integer.java:331)
    at com.onesignal.NotificationExtenderService.processIntent(NotificationExtenderService.java:122)
    at com.onesignal.NotificationExtenderService.onHandleIntent(NotificationExtenderService.java:95)
    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:136)
    at android.os.HandlerThread.run(HandlerThread.java:61)

This is preventing some properties like additionalData from being assigned when onNotificationProcessing is called.

Work around.
Set android_visibility to 1 or 0 from the create notification REST API POST call

Gray second icon and no badge in API21

On Android 4.x badges appear and notif icon is fine.
But in Android 5.1 two problems:

  1. Why there a small gray icon in the right bottom corner? Yes, this is my gray icon for notification, but why here?
  2. No badge on screen. (exists on Android 4.x)

Notification is not delivered

I have done sample app for push notification. I am able to get the UserID and Google Registration Id. It shows correctly. But When sent message from the OneSingle. I am unable to get the notification.Please help me to solve this ?

SyncService keeping process in memory

The SyncService class is keeping the app's process in memory is some cases. This doesn't appear to be consuming any CPU or other system resources.

Error:(46, 21) java: package com.onesignal does not exist

Hi I'm trying to use this plugin to push notification to Android device,I created the Cordova app (v 6.1.1) and installed all the required SDK extras but when I try to compile the project I get the error
Error:(46, 21) java: package com.onesignal does not exist , all I find out that I might be missing some SDKs but I'm not sure which one, I've installed Google Play Services 29.00 , Google Repository 25.0.0 , Android Support Repository 31.0.0, Intel x86 Emulator 6.0.1

I'm using android:targetSdkVersion="23" and Android Studio

Unable to cancel a summary notification

Hi, i'm using 2.4.1 SDK and i'm not able to cancel the notification by the id that returns from OSNotificationDisplayedResult.

From the debug i can see that 2 notificationId are generated (one for the summary notification and the other for individual notification). In the OSNotificationDisplayedResult object that returns i have only the notificationId used for individual notifications and if i try to cancel the notification from that id it doesn't work, but if i try to cancel it using the notificationId of the summary notification that i previously seen in the debug it works.

Option to handle notification display missing

It'd be awesome to be able to manually handle the notification display on the app side. Maybe you could implement something like the touch event handled pattern, where we return true and it means that the notification has already been displayed and the library doesn't need to display it again.

Addition of Notification Id in Notification for cancellation of OneSignal Notification

There may be a case when user receives a notification for some information. And user does not click on the notification instead user opens the application from menu normally and view the information received via notification, in this case there is no use of that notification . I want to clear that single notification from notification drawer.

I want to use below code

NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancel(NOTIFICATION_ID);

For this i need NOTIFICATION_ID to be set by your SDK while creating notification.
So please do this enhancement..
Thanks

Gradle configuration

Hey..I have my android project. I created 2 applications in OneSignal...Staging and Production...
How can I setup 2 different onesignal_app_id: for different build types in my project.

android {
    defaultConfig {
        manifestPlaceholders = [manifestApplicationId: "${applicationId}",
                                onesignal_app_id: "b2f7f966-d8cc-11e4-bed1-df8f05be55ba",
                                onesignal_google_project_number: "703322744261"]
    }
 }

One Signal Android SDK getTags can't get all tags from server

When using the getTags function, the return json only return one value for every first time i open the app(uninstall and install). For example in the dashboard, i saw that i already consists three tags, after i called the getTags, it only return me the first tag.
Is it a bug?

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.