blueshift-labs / blueshift-android-sdk Goto Github PK
View Code? Open in Web Editor NEWBlueshift Android SDK
Home Page: https://blueshift.com/
Blueshift Android SDK
Home Page: https://blueshift.com/
While migrating our app to target Android 12 (Api 31) all activities and broadcast receivers need to have the 'exported' tag set. This also applies to the merged manifest. Could you folks tag all your activity and broadcast receivers with this info. This saves us from a messy manifest where we have to manually merge the manifest for you with those tags.
Android reference:
https://developer.android.com/about/versions/12/behavior-changes-12#exported
This is the current workaround:
https://developer.android.com/studio/build/manifest-merge
Hi all,
After realizing that my prior bug (#53) was probably related to using an old SDK, I released another version into production this morning that uses version 1.0.4. Since then, Crashlytics is telling me there have been 48 crashes from 41 users on the following type:
Fatal Exception: java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:318)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
Caused by android.content.ReceiverCallNotAllowedException: BroadcastReceiver components are not allowed to register to receive intents
at android.app.ReceiverRestrictedContext.registerReceiver(ContextImpl.java:105)
at android.app.ReceiverRestrictedContext.registerReceiver(ContextImpl.java:94)
at com.blueshift.Blueshift.<init>(Blueshift.java:93)
at com.blueshift.Blueshift.getInstance(Blueshift.java:106)
at com.blueshift.httpmanager.request_queue.RequestQueue$sendRequestTask.doInBackground(RequestQueue.java:146)
at com.blueshift.httpmanager.request_queue.RequestQueue$sendRequestTask.doInBackground(RequestQueue.java:127)
at android.os.AsyncTask$2.call(AsyncTask.java:304)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
You can see the details of my implementation in the ticket referenced above (#53)
I found a problem.
If something happend that make the RequestDispatcher can not create/get the Handler, the dispatcher will invoke complete without makeQueueAvailable -> that's make every request behind will stuck.
In my case, whenever I set pushEnable to false, the problem appear.
Version 23.2.1 is available
Some push notifications do not work properly on Samsung devices. I can't reproduce these issues on Google Pixels or devices from other manufacturers. The notification padding is too small, background does not match other notifications, images don't load, and deep links don't work: although the app opens, no deep link is being passed to the extras bundle received in the activity.
On phone (Galaxy S8, first notification is from Blueshift):
On tablet (Galaxy Tab A, two notifications from Blueshift):
I just released my app into production with the Blueshift SDK installed and I'm seeing some crashes. Here's the stacktrace:
Fatal Exception: java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:299)
at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
Caused by java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:792)
at java.util.HashMap$EntryIterator.next(HashMap.java:829)
at java.util.HashMap$EntryIterator.next(HashMap.java:827)
at java.util.AbstractMap.putAll(AbstractMap.java:380)
at java.util.HashMap.putAll(HashMap.java:508)
at com.blueshift.Blueshift.getDeviceParams(Blueshift.java:106)
at com.blueshift.Blueshift.sendEvent(Blueshift.java:235)
at com.blueshift.Blueshift.access$200(Blueshift.java:45)
at com.blueshift.Blueshift$2.doInBackground(Blueshift.java:342)
at com.blueshift.Blueshift$2.doInBackground(Blueshift.java:338)
at android.os.AsyncTask$2.call(AsyncTask.java:287)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
Here is the app config :
'compileSdk': 33,
'minSdk' : 21,
'minSdkTv' : 21,
'targetSdk' : 31,
'buildTools': '30.0.2'
Blueshift Lib
'blueshiftSDK' : "com.blueshift:android-sdk:3.3.0"
Firebase Libs
'analytics' : "com.google.firebase:firebase-analytics:20.1.2",
'messages' : "com.google.firebase:firebase-messaging:20.2.4",
'crashlytics' : "com.google.firebase:firebase-crashlytics:18.2.5",
'perf' : "com.google.firebase:firebase-perf:20.0.4",
'core' : "com.google.firebase:firebase-core:18.0.1",
'database' : "com.google.firebase:firebase-database-ktx:19.3.0",
'remoteConfig' : "com.google.firebase:firebase-config:21.0.1"
With this config, blueshift notification work fine.
Recently when we tested on android 13 device and we have got this crash in Crashlytics.Here is the crash info -
Fatal Exception: java.lang.IllegalArgumentException: com.scripps.android.foodnetwork: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
at android.app.PendingIntent.checkFlags(PendingIntent.java:408)
at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:491)
at android.app.PendingIntent.getActivity(PendingIntent.java:477)
at android.app.PendingIntent.getActivity(PendingIntent.java:441)
at com.google.firebase.messaging.CommonNotificationBuilder.createContentIntent(CommonNotificationBuilder.java:125)
at com.google.firebase.messaging.CommonNotificationBuilder.createNotificationInfo(CommonNotificationBuilder.java:27)
at com.google.firebase.messaging.CommonNotificationBuilder.createNotificationInfo(CommonNotificationBuilder.java:9)
at com.google.firebase.messaging.DisplayNotification.handleNotification(DisplayNotification.java:27)
at com.google.firebase.messaging.FirebaseMessagingService.dispatchMessage(FirebaseMessagingService.java:76)
at com.google.firebase.messaging.FirebaseMessagingService.passMessageIntentToSdk(FirebaseMessagingService.java:55)
at com.google.firebase.messaging.FirebaseMessagingService.handleMessageIntent(FirebaseMessagingService.java:34)
at com.google.firebase.messaging.FirebaseMessagingService.handleIntent(FirebaseMessagingService.java:23)
I dont know the root cause of this whether Is it caused by blueshift sdk or firebase messaging libs. Since we are using latest blueshift SDK, I thought of updating the firebase messaging lib.
When I try to update firebase-messaging lib to firebase-messaging:23.1.2 and try to do blueShift.initialize(this), We get this exception:
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/iid/FirebaseInstanceId;
at com.blueshift.util.DeviceUtils.iidPkgNameCombo(DeviceUtils.java:96)
at com.blueshift.util.DeviceUtils.getDeviceId(DeviceUtils.java:83)
at com.blueshift.BlueshiftAttributesApp.sync(BlueshiftAttributesApp.java:397)
at com.blueshift.Blueshift.sendEvent(Blueshift.java:689)
at com.blueshift.Blueshift.access$200(Blueshift.java:62)
at com.blueshift.Blueshift$5.run(Blueshift.java:758)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.iid.FirebaseInstanceId" on path: DexPathList[[zip file "/data/app/~~zmqCzndJPd8r621RLR-Azw==/com.scripps.android.foodnetwork-6aD2XdwPhfFzQwcM15Sm6g==/base.apk"],nativeLibraryDirectories=[/data/app/~~zmqCzndJPd8r621RLR-Azw==/com.scripps.android.foodnetwork-6aD2XdwPhfFzQwcM15Sm6g==/lib/x86, /system/lib, /system_ext/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
Pls help
Thanks
Hey everyone,
is there any plan to release an Androidx version? It's one of the very few sdk I'm missing to be able to remove Jetifier
Recently we encountered a large number of crashes when using the Blueshift-Android-SDK
Caused by java.lang.IllegalStateException: Apps may not schedule more than 100 distinct jobs
at android.os.Parcel.readException(Parcel.java:1691)
at android.os.Parcel.readException(Parcel.java:1636)
at android.app.job.IJobScheduler$Stub$Proxy.schedule(IJobScheduler.java:158)
at android.app.JobSchedulerImpl.schedule(JobSchedulerImpl.java:42)
at com.blueshift.request_queue.RequestQueue.scheduleQueueSyncJob(RequestQueue.java:60)
at com.blueshift.Blueshift.initialize(Blueshift.java:288)
Ideas that might improve the situation:
com.blueshift.Blueshift#initialize
android.app.job.JobScheduler#cancel
to cancel com.blueshift.model.Configuration#networkChangeListenerJobId
and com.blueshift.model.Configuration#bulkEventsJobId
before calling com.blueshift.Blueshift#initialize
Any solutions to this?
Hello,
Google Play Console reports a security issue originating from the method scheduleNotifications
Security and trust
Implicit pending intent
Your app contains an implicit pending intent vulnerability. Please see this Google Help Centre article for details.
- com.blueshift.rich_push.NotificationFactory.scheduleNotifications
Although the issue doesn’t block publication of the apps, it would be good to fix it anyway. Please, also apply the fix to the Codrova plugin as well. Thanks!
Hi,
Seeing this crash in our production app:
Fatal Exception: java.lang.RuntimeException: Unable to start receiver com.blueshift.rich_push.RichPushBroadcastReceiver: java.lang.NullPointerException
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2325)
at android.app.ActivityThread.access$1500(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1287)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4847)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:535)
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.NullPointerException
at android.os.Bundle.putAll(Bundle.java:303)
at android.content.Intent.putExtras(Intent.java:5618)
at com.blueshift.rich_push.RichPushBroadcastReceiver.onReceive(RichPushBroadcastReceiver.java:64)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2312)
at android.app.ActivityThread.access$1500(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1287)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4847)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:535)
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)
Hello,
I see that the firebase core dependency is not up to date and causes issue in the builds.
Would be great if you could upgrade.
compile 'com.google.firebase:firebase-core:16.0.6'
Thanks.
I'm using the latest version of the Blueshift sdk (3.1.8); according to the relase notes this is migrated to androidx. But I can not remove jetifier from my project due to Blueshift's dependency on com.android.support:appcompat-v7:28.0.0
I checked with the tool "CanIDropJetifier" - https://github.com/plnice/can-i-drop-jetifier
With the command ./gradlew -Pandroid.enableJetifier=false my-module:canIDropJetifier
, and verbose=true
in its configuration, I got this result:
Cannot drop Jetifier due to following external dependencies:
* com.blueshift:android-sdk:3.1.8
\-- com.android.support:appcompat-v7:28.0.0
It looks like there is still a dependency to the support library here also:
https://github.com/blueshift-labs/Blueshift-Android-SDK/blob/main/android-sdk/build.gradle#L49
related issue:
#102
On class NotificationFactoty.java, function getNotificationClickPendingIntent, I found the problem here, because of TaskStackBuilder's behaviour, whenever user tap on a notification, app will destroy current activity and recreate the same activity instead of bring the existing one to front of activity's stack.
That behaviour will make so much inconvenience for user.
My suggestion is using regular Pending Intent instead of make a PendingIntent from TaskStackBuilder. Or atleast make that configurable
Hi,
thank you for the nice library. It would be nice to document, that the ACCESS_FINE_LOCATION
permission is optional, because as a user myself, it would creep me out to see that an app wants location permissions, even when the app is a simple content app.
Thank you very much! :)
cheers
In the documentation, it is suggested to use these versions of Firebase sdk:
implementation 'com.google.firebase:firebase-core:17.2.0'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
https://developer.blueshift.com/docs/setup-blueshifts-android-sdk
This led to an app crash for our application. After a fresh install, the app would crash on first launch. The app did not crash on subsequent launches. The crash could be re-created consistently on July 31st, but we can no longer re-create it as of August 5th.
This crash was only reported after we launched an inapp campaign on July 27th.
We are using Blueshift sdk version 3.1.2
.
Fatal Exception: java.lang.RuntimeException
Unable to bind to service com.blueshift.fcm.BlueshiftMessagingService@43fa0ce with Intent { act=com.google.firebase.MESSAGING_EVENT pkg=de.miamed.amboss.knowledge }: java.lang.NullPointerException
android.app.ActivityThread.handleBindService (ActivityThread.java:4234)
android.app.ActivityThread.access$1600 (ActivityThread.java:237)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1937)
android.os.Handler.dispatchMessage (Handler.java:106)
android.os.Looper.loop (Looper.java:223)
android.app.ActivityThread.main (ActivityThread.java:7656)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:592)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:947)
Caused by java.lang.NullPointerException
android.app.ActivityThread.handleBindService
com.google.firebase.messaging.zzc.onBind (zzc.java:3)
android.app.ActivityThread.handleBindService (ActivityThread.java:4219)
android.app.ActivityThread.access$1600 (ActivityThread.java:237)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1937)
android.os.Handler.dispatchMessage (Handler.java:106)
android.os.Looper.loop (Looper.java:223)
android.app.ActivityThread.main (ActivityThread.java:7656)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:592)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:947)
We fixed the crash by upgrading to these versions:
implementation 'com.google.firebase:firebase-core:17.4.4'
implementation 'com.google.firebase:firebase-messaging:20.2.4'
We would recommend to update the documentation to suggest more recent versions of the Firebase sdk.
Can't find the release 3.2.0.1
for android-sdk-x
.
On this topic, isn't the first time I see a new release done for android-sdk
but having some delay to be available for android-sdk-x
.
What would be an "expected" reasonable delay for a new version to be available for android-sdk-x
?
The method to fetch Android Advertising ID in class DeviceUtils
should run in the background thread.
Note: The getAdvertisingIdInfo() method is a blocking call, so you must not call it on the main (UI) thread. If called on the main thread, the method throws IllegalStateException.
You can find the above note here
Since IllegalStateException is thrown, the following catch block is getting executed:
catch (IllegalStateException | GooglePlayServicesNotAvailableException var6) {
Log.e(LOG_TAG, libNotFoundMessage);
installNewGooglePlayServicesApp(context);
}
It is trying to install Google Play Services although it is present and take the user to Google Play Store. This navigation is highly undesirable. Can this be fixed, please?
We've been seeing some crashes come in exclusively from Android 9 users, which seems to be coming from BlueshiftNotificationEventsActivity
. Stack trace:
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{[appId]/com.blueshift.pn.BlueshiftNotificationEventsActivity}: java.lang.IllegalStateException: Not allowed to start service Intent { act=[appId].ACTION_OPEN_APP cmp=[appId]/com.blueshift.pn.BlueshiftNotificationEventsService (has extras) }: app is in background uid UidRecord{967d203 u0a208 TPSL idle procs:1 seq(0,0,0)}
at android.app.ActivityThread.performLaunchActivity + 3131(ActivityThread.java:3131)
at android.app.ActivityThread.handleLaunchActivity + 3270(ActivityThread.java:3270)
at android.app.servertransaction.LaunchActivityItem.execute + 78(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks + 108(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute + 68(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage + 1986(ActivityThread.java:1986)
at android.os.Handler.dispatchMessage + 106(Handler.java:106)
at android.os.Looper.loop + 215(Looper.java:215)
at android.app.ActivityThread.main + 6952(ActivityThread.java:6952)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run + 493(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main + 870(ZygoteInit.java:870)
Caused by java.lang.IllegalStateException: Not allowed to start service Intent { act=[appId].ACTION_OPEN_APP cmp=[appId]/com.blueshift.pn.BlueshiftNotificationEventsService (has extras) }: app is in background uid UidRecord{967d203 u0a208 TPSL idle procs:1 seq(0,0,0)}
at android.app.ContextImpl.startServiceCommon + 1592(ContextImpl.java:1592)
at android.app.ContextImpl.startService + 1547(ContextImpl.java:1547)
at android.content.ContextWrapper.startService + 664(ContextWrapper.java:664)
at com.blueshift.pn.BlueshiftNotificationEventsActivity.startService + 88(BlueshiftNotificationEventsActivity.java:88)
at com.blueshift.pn.BlueshiftNotificationEventsActivity.processAction + 57(BlueshiftNotificationEventsActivity.java:57)
at com.blueshift.pn.BlueshiftNotificationEventsActivity.onCreate + 39(BlueshiftNotificationEventsActivity.java:39)
at android.app.Activity.performCreate + 7148(Activity.java:7148)
at android.app.Activity.performCreate + 7139(Activity.java:7139)
at android.app.Instrumentation.callActivityOnCreate + 1293(Instrumentation.java:1293)
at android.app.ActivityThread.performLaunchActivity + 3111(ActivityThread.java:3111)
at android.app.ActivityThread.handleLaunchActivity + 3270(ActivityThread.java:3270)
at android.app.servertransaction.LaunchActivityItem.execute + 78(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks + 108(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute + 68(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage + 1986(ActivityThread.java:1986)
at android.os.Handler.dispatchMessage + 106(Handler.java:106)
at android.os.Looper.loop + 215(Looper.java:215)
at android.app.ActivityThread.main + 6952(ActivityThread.java:6952)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run + 493(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main + 870(ZygoteInit.java:870)
[TEST] This is a test issue description
Our security alerts highlighted a new issue with GSON 2.8.6, on our dependency checks it pointed out BlueShift SDK is still using this version.
v1.0.8 of the SDK
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getAction()' on a null object reference
at com.blueshift.gcm.GCMBaseIntentService.onHandleIntent(GCMBaseIntentService.java:232)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.