unifiedpush / android-connector Goto Github PK
View Code? Open in Web Editor NEWUnifiedPush connector library
License: Apache License 2.0
UnifiedPush connector library
License: Apache License 2.0
The current message distribution system relies on Android's BroadcastReceiver
and registering only the application package name. The causes problems if the target app (the one that should receive a notification from the UP implementor) has not been started, has been manually killed or has been reclaimed by the system. Then, there's no way, using BroadcastReceiver
s and Context.sendBroadcast()
, to bring an application back to life, which defeats a bit the pupose of UP.
The protocol should rely on a system that is able to start an app, whether is exists in memory or not. The only system I can think of, is creating a dedicating an empty activity for that, registering that activity (instead of the application package name) and start it whenever a UP implementor should distribute a notification, using Context.startActivity()
. This is how Android's sharing system works.
It is probably necessary to add the QUERY_ALL_PACKAGES
permission to AndroidManifest due to Android 11 restriction
Like the application names registerAppWithDialog
uses.
https://toot.martyn.berlin/@martyn/108520436299324159
[email protected] - @ Tusky One piece of feedback though is that the fallback should be "quieter". Every time I open tusky after not using it for a while I get a pop-up for "No distributor found". "I know that, I haven't made a decision yet, so please don't bug me" isn't an option ;-)
Idk how this could be achieved without the app having a setting to clear it, though
Also opening a flutter-connector issue since the concept applies to both
Acquire and release wakelock before and after onMessage/onNewEndpoint
I tried adding the android-connector
library to the mastodon-android
gradle files as per https://unifiedpush.org/developers/android/
However, I am unable to build the project. I get CIRCULAR REFERENCE: com.android.tools.r8.kotlin.H
My changes are pretty simple so far. Changes can be found here: konradmoesch/mastodon-android@d21008d
error log:
> Task :mastodon:mergeExtDexDebug
AGPBI: {"kind":"error","text":"com.android.tools.r8.kotlin.H","sources":[{}],"tool":"D8"}
com.android.tools.r8.kotlin.H
AGPBI: {"kind":"error","text":"com.android.tools.r8.kotlin.H","sources":[{}],"tool":"D8"}
> Task :mastodon:mergeExtDexDebug FAILED
Execution failed for task ':mastodon:mergeExtDexDebug'.
> Could not resolve all files for configuration ':mastodon:debugRuntimeClasspath'.
> Failed to transform android-connector-2.2.0.aar (com.github.UnifiedPush:android-connector:2.2.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for DexingNoClasspathTransform: /home/km/.gradle/caches/transforms-3/5a9184e11a929640a46f8b4374be810e/transformed/android-connector-2.2.0-runtime.jar.
> Error while dexing.
> Failed to transform kotlin-stdlib-1.9.10.jar (org.jetbrains.kotlin:kotlin-stdlib:1.9.10) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for DexingNoClasspathTransform: /home/km/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.9.10/72812e8a368917ab5c0a5081b56915ffdfec93b7/kotlin-stdlib-1.9.10.jar.
> Error while dexing.
* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':mastodon:mergeExtDexDebug'.
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:38)
[.....](shortened for the issue)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
Cause 1: org.gradle.api.internal.artifacts.transform.TransformException: Failed to transform android-connector-2.2.0.aar (com.github.UnifiedPush:android-connector:2.2.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
at org.gradle.api.internal.artifacts.transform.TransformingAsyncArtifactListener$TransformedArtifact.lambda$visit$2(TransformingAsyncArtifactListener.java:232)
[.....](shortened for the issue)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
Caused by: org.gradle.api.internal.artifacts.transform.TransformException: Execution failed for DexingNoClasspathTransform: /home/km/.gradle/caches/transforms-3/5a9184e11a929640a46f8b4374be810e/transformed/android-connector-2.2.0-runtime.jar.
at org.gradle.api.internal.artifacts.transform.DefaultTransformerInvocationFactory$1.lambda$mapResult$3(DefaultTransformerInvocationFactory.java:159)
[.....](shortened for the issue)
at org.gradle.internal.execution.steps.IdentityCacheStep.lambda$executeDeferred$1(IdentityCacheStep.java:47)
... 25 more
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
at Version.fakeStackEntry(Version_4.0.52.java:0)
[.....](shortened for the issue)
... 115 more
Caused by: com.android.tools.r8.kotlin.H
at com.android.tools.r8.kotlin.j.a(R8_4.0.52_5a340ca2823c7e792fe09805c75f749b9d398d230bc0518bb54ae9b6b50addbe:42)
[.....](shortened for the issue)
at com.android.tools.r8.internal.vk.a(R8_4.0.52_5a340ca2823c7e792fe09805c75f749b9d398d230bc0518bb54ae9b6b50addbe:24)
... 118 more
Suppressed: java.lang.RuntimeException: java.util.concurrent.ExecutionException: com.android.tools.r8.kotlin.H
at com.android.tools.r8.D8.d(R8_4.0.52_5a340ca2823c7e792fe09805c75f749b9d398d230bc0518bb54ae9b6b50addbe:174)
[.....](shortened for the issue)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.util.concurrent.ExecutionException: com.android.tools.r8.kotlin.H
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:566)
[.....](shortened for the issue)
at com.android.tools.r8.D8.d(R8_4.0.52_5a340ca2823c7e792fe09805c75f749b9d398d230bc0518bb54ae9b6b50addbe:154)
... 125 more
Caused by: [CIRCULAR REFERENCE: com.android.tools.r8.kotlin.H]
Cause 2: org.gradle.api.internal.artifacts.transform.TransformException: Failed to transform kotlin-stdlib-1.9.10.jar (org.jetbrains.kotlin:kotlin-stdlib:1.9.10) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
at org.gradle.api.internal.artifacts.transform.TransformingAsyncArtifactListener$TransformedArtifact.lambda$visit$2(TransformingAsyncArtifactListener.java:232)
[.....](shortened for the issue)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.gradle.api.internal.artifacts.transform.TransformException: Execution failed for DexingNoClasspathTransform: /home/km/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.9.10/72812e8a368917ab5c0a5081b56915ffdfec93b7/kotlin-stdlib-1.9.10.jar.
at org.gradle.api.internal.artifacts.transform.DefaultTransformerInvocationFactory$1.lambda$mapResult$3(DefaultTransformerInvocationFactory.java:159)
[.....](shortened for the issue)
at org.gradle.internal.operations.DefaultBuildOperationQueue$WorkerRunnable.run(DefaultBuildOperationQueue.java:191)
... 5 more
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.
at com.android.builder.dexing.D8DexArchiveBuilder.getExceptionToRethrow(D8DexArchiveBuilder.java:183)
[.....](shortened for the issue)
at org.gradle.internal.execution.steps.IdentityCacheStep.lambda$executeDeferred$1(IdentityCacheStep.java:47)
... 28 more
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
at Version.fakeStackEntry(Version_4.0.52.java:0)
[.....](shortened for the issue)
at com.android.builder.dexing.D8DexArchiveBuilder.convert(D8DexArchiveBuilder.java:120)
... 120 more
Caused by: com.android.tools.r8.kotlin.H
at com.android.tools.r8.kotlin.j.a(R8_4.0.52_5a340ca2823c7e792fe09805c75f749b9d398d230bc0518bb54ae9b6b50addbe:42)
[.....](shortened for the issue)
at com.android.tools.r8.internal.vk.a(R8_4.0.52_5a340ca2823c7e792fe09805c75f749b9d398d230bc0518bb54ae9b6b50addbe:24)
... 123 more
Suppressed: java.lang.RuntimeException: java.util.concurrent.ExecutionException: com.android.tools.r8.kotlin.H
at com.android.tools.r8.D8.d(R8_4.0.52_5a340ca2823c7e792fe09805c75f749b9d398d230bc0518bb54ae9b6b50addbe:174)
... 125 more
Caused by: java.util.concurrent.ExecutionException: com.android.tools.r8.kotlin.H
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:566)
[.....](shortened for the issue)
at com.android.tools.r8.D8.d(R8_4.0.52_5a340ca2823c7e792fe09805c75f749b9d398d230bc0518bb54ae9b6b50addbe:154)
... 125 more
Caused by: [CIRCULAR REFERENCE: com.android.tools.r8.kotlin.H]
The dialog to pick the distributor would be more understandable with application name instead of package_name.
If we send a registration request, and the distributor dies (does not respond within n seconds), pressing register with dialog again should allow picking a different distributor.
See: https://matrix.to/#/!vwmBiTqilorqNCbGab:matrix.org/$BdW3S_8WmDczVoTzNaXRXL6-47pWNnHuxb7Ktd81Kt0?via=libera.chat&via=t2bot.io&via=matrix.org
I can reproduce this too
I am working on adding support for D-Bus as a Linux backend to the flutter connector.
I am running into troubles because the Android API exposed here hides the token behind an instance
chosen name instead, and store a mapping for that.
It complicated a lot of things when trying to abstract it, and I think staying closer to the specification and letting this to be handled by the user, or to some helpers instead, is perhaps not a bad idea.
What do you think ? The main problem is that we would break the API. I am however happy to propose something.
Currently the text displayed to users in dialogs is hardcoded. It would be cool if they were Android string resources so client apps can override them and/or provide additional translations. Ideally the connector already comes with translations in common languages.
So it can be used by flutter-connector
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.