I am working with a bluetooth hardware device and I am trying to get it to interface with my Trigger.IO application. It seems as though it is not possible, even though technically it should. Here are my steps so far:
Used the Trigger.IO module functionality to create a module which was able to successfully send and receive messages between the Trigger.IO app and native Java code
Created a native Android application which successfully communicated with the bluetooth hardware device
Ported my native Android bluetooth code over into my Trigger.IO module
At this point the custom module is included in the Trigger app and seems to starting correctly, but when I make a call that should initiate the bluetooth device connection logic I am getting errors about bluetooth permissions. I ensured that my module has the necessary bluetooth permissions within its AndroidManifest.xml, but my fear is that the base Trigger app does not have the required permissions.
These are logs that output within the LogCat when the attempting to start the bluetooth connection:
D/Forge: Native call module.startDevicePolling with task.params: {}
D/BluetoothManagerService: Message: 20
D/BluetoothManagerService: Added callback: Android.bluetooth.IBluetoothManagerCallback$Stub$Proxy#41f84218:true
W/dalvikvm: threadid=25: thread exiting with uncaught exception (group=0x41612ba8)
I/Process: Sending signal. PID: 11967 SIG: 9
E/AndroidRuntime: FATAL EXCEPTION: Incoming Data Thread
E/AndroidRuntime: Process: io.trigger.forge42a1430afae511e2a0e61231392b77b0, PID: 11967
E/AndroidRuntime: java.lang.SecurityException: Need BLUETOOTH permission: Neither user 10230 nor current process has android.permission.BLUETOOTH.
Looking at the AndroidManfiest.xml at the root of the deployed .APK it looks as though Trigger only has permissions for INTERNET and ACCESS_NETWORK_STATE. Anyone else run into this? I think if I can get the BLUETOOTH permission into the root AndroidManifest.xml that things will work, but that file is encoded to not make that easy.
Trigger.io does support the ability for module's to add permissions - see Changing build configuration
In summary:
Add a build steps file in android/build_steps.json
For your scenario, update the build steps file with: [ { "do": { "android_add_permission": { "permission": "android.permission.BLUETOOTH" } } } ]
After changing the build steps for either Android or iOS it is important to update the inspector project
I was able to solve my problem by changing the local trigger android template to give me the permission I needed. This is obviously not ideal. It would be ideal to have the Trigger logic look at the native modules, derive the required permissions, and update their master AndroidManifest.xml accordingly.
Related
I am trying to implement a dialogsystem (Google Dialogflow CX) into an Android App. I am trying to connect via REST. Appparently, CX doesn't support API keys and the library commonly used is not supported in Android either, so I am facing problems.
With the credentials available in raw (implementation as previously used with dialogflow ES), I get the following error message:
07-09 12:10:27.841 2600-2600/com.softbankrobotics.jokeswithdialogflow E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.softbankrobotics.jokeswithdialogflow, PID: 2600
java.lang.NoClassDefFoundError: Failed resolution of: Ljava/time/Duration;
at com.google.auth.oauth2.OAuth2Credentials.<clinit>(OAuth2Credentials.java:70)
at com.google.auth.oauth2.ServiceAccountCredentials.fromStream(ServiceAccountCredentials.java:475)
at com.softbankrobotics.jokeswithdialogflow.data.DialogflowDataSource.<init>(DialogflowDataSource.kt:17)
at com.softbankrobotics.jokeswithdialogflow.MainActivity.onCreate(MainActivity.kt:52)
at android.app.Activity.performCreate(Activity.java:6257)
...
It seems the first error refers to the min SDK having to be at 26. Unfortunately, I need 23 for my app to run on pepper robot - so I can't alter this.
I would like to authenticate once (e.g. with my own Google account), with validity for all the test users. Safety aspects can be disregarded here, as the implementation is intended for testing in a scientific study, only.
Thank you in advance - any help is appreciated!
My goal is to be able to make my Android TV Mi Box S (Oreo 8.1) transcode properly Dolby Digital+ (EAC3) sounds to Dolby Digital (AC3) and output it to, my AVR through SPDIF.
This transcodindg is possible with Kodi 18.1 applicition but is not proposed by other application or Android 8.1 settings. As Kodi is able to do it I reverse engineered Android stack. My conclusion are : - Android Oreo embeds any necessary codecs ans other stuff to do this transcoding but does not propose the settings to configure this - Android Pie proposes the wanted surround sound setting (output Dolby Digital on SPDIF)
So my goal is to backport Android TvSettings application from Pie to Oreo
I first tryed to generate TvSettings with Android Studio. I hacked the application resources but stopped when I understood that I would have to generate platfom dependacies (for instance SettingsLib.jar)
My second trial is to generate the entire Android platform. The build is complete and I can deploy TvSettings application on a x86 TV simulation BUT when I launched the TvSettings appplication I get this error :
--------- beginning of crash
2019-04-01 12:21:04.976 3987-3987/com.android.tv.settings
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.android.tv.settings, PID: 3987
java.lang.RuntimeException: Unable to get provider android.support.v4.content.FileProvider:
java.lang.ClassNotFoundException: Didn't find class
"android.support.v4.content.FileProvider" on path: DexPathList[[zip
file
"/data/app/com.android.tv.settings-2DkaCncwGQ874WP-kx3G4Q==/base.apk"],nativeLibraryDirectories=[/data/app/com.android.tv.settings-2DkaCncwGQ874WP-kx3G4Q==/lib/x86,
/system/lib, /vendor/lib]]
I searched this error on internet and it seems that it deals with multidex feature. This multidex feature is well documented for clean developped Android appliacation but nor reaally for applications extracted from Android platform and deployed with adb.
This problem is related to java libraries loading.
I found threads referring Android multidex feature but only for applications buils with Android Studio/Gradle and my app was build with Android platform
What can I do?
have you included fileProvider in your manifest?
Well there seems to be a root error during deployment of my TvSettings application. Here is its log :
E/dex2oat: Invalid version number in dex file header. File: base.apk
I read several pages and found this one very interesting : https://source.android.com/devices/tech/dalvik/configure
So, due to different optimizations, platform apps are not generated with the same file format that apps generated above platform API
My idea is to generate the whole platform including TvSettings app and to deploy TvSettings with adb. So the apk format may be wrong.
My next step is to add in TvSettings/Settings/Android.mk the flag below :
LOCAL_DEX_PREOPT := false
I'm using khttp to perform HTTP requests in my Android app, but every time I start adding breakpoints to my app in Android Studio 3.1, I'm getting this really annoying Illegal State Exception, at which point I them need to restart Android Studio. Here's an example of the exception thrown:
E/AndroidRuntime: FATAL EXCEPTION: Thread-4
Process: com.sbrl.peppermint, PID: 10777
java.lang.IllegalStateException: Cannot access request header fields after connection is set
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getRequestProperties(HttpURLConnectionImpl.java:232)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getRequestProperties(DelegatingHttpsURLConnection.java:182)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getRequestProperties(Unknown Source:0)
at com.android.tools.profiler.support.network.httpurl.TrackedHttpURLConnection.getRequestProperties(TrackedHttpURLConnection.java:204)
at com.android.tools.profiler.support.network.httpurl.TrackedHttpURLConnection.trackPreConnect(TrackedHttpURLConnection.java:63)
at com.android.tools.profiler.support.network.httpurl.TrackedHttpURLConnection.connect(TrackedHttpURLConnection.java:126)
at com.android.tools.profiler.support.network.httpurl.HttpsURLConnection$.connect(HttpsURLConnection$.java:366)
at khttp.responses.GenericResponse.openRedirectingConnection$khttp(GenericResponse.kt:125)
at khttp.responses.GenericResponse.getConnection(GenericResponse.kt:163)
at khttp.responses.GenericResponse.getRaw(GenericResponse.kt:207)
at khttp.responses.GenericResponse.getContent(GenericResponse.kt:216)
at khttp.responses.GenericResponse.init$khttp(GenericResponse.kt:377)
at khttp.KHttp.request(KHttp.kt:61)
at khttp.KHttp.request$default(KHttp.kt:59)
I know that this question explains why this is happening, but my question is this:
How can I black-box the khttp library (similar to the way that Chrome allows you to black-box a JS source file), such that the Android debugger does not inspect it - throwing this exception?
Migrated application from 6.2 to 7.0. Server MobileFirst version: 7.0.0.00.20150312-0731
The application itself works great. When push new wlapp to server, the device see's update is available. Proceed to install update and fails.
logCat
W/PluginManager(11315): THREAD WARNING: exec() call to WLDirectUpdatePlugin.start blocked the main thread for 20ms. Plugin should use CordovaInterface.getThreadPool().
W/HardwareRenderer(11315): Attempting to initialize hardware acceleration outside of the main thread, aborting
W/PluginManager(11315): THREAD WARNING: exec() call to WLDirectUpdatePlugin.showProgressDialog blocked the main thread for 44ms. Plugin should use CordovaInterface.getThreadPool().
E/com.worklight.androidgap.directupdate.WLDirectUpdateDownloader( 9466): WLDirectUpdateDownloader.validateZipFileIntegrity in WLDirectUpdateDownloader.java:129 :: Invalid direct update zip file, original file might have been altered or replaced.
7.0.0.00.20150312-0731 is an awfully old build of MFPF 7.0; many fixes, including to Direct Update took place since.
I suggest that you will update to latest available iFix from IBM Fix Central to confirm this issue still happens to you.
This is an issue in which the content type of returned direct update zip is not "application/zip" as it should be.
Note that Worklight server returns "application/zip" content type for android direct update. We have a test fix right now where we just log the different content type and continue the direct update process since it can be correct zip and content type can be changed by firewall for example.
If you create a PMR, we can give you a test fix to test (just drop worklight-android.jar into Android project -> deploy onto device). Once we confirm that it works we can deliver it to production builds. When submitting the PMR please link them to this StackOverflow question to give full background of issue.
Guys. I need some help with WebRTC. I am developing an Android app that streams from a Service to a AngularJS client using Node.Js and Express as a signaling server. And I am using libjingle packaged by pristine.
Every time I stop the peer from the client it gives me the following error:
09-10 01:43:06.161 5935-5935/org.myapp E/rtc﹕ #
# Fatal error in ../../talk/app/webrtc/java/jni/peerconnection_jni.cc, line 956
# Check failed: 0 == (reinterpret_cast<MediaStreamTrackInterface*>(j_p))->Release() (0 vs. 1)
# Unexpected refcount.
#
I have absolutely no idea of what's going. I have spoken with one developer from pristine and he said that this error is not really seen frequently.
Did anybody ever run into it?
Tracing back: The call site invokes CHECK_RELEASE, which verifies that the last reference is being released. So, it looks like you've got an extra reference to the MediaStreamTrackInterface.