Android 12 bluetooth permissions in ionic sumsung phone - ionic-framework

I need assistance with the Bluetooth Serial plugin, when l check for bluetooth.isEnable it returns Ok or is Disabled which is correct. If l try to use any other functions for example List or discover Unpaired l get the error below
ERROR
Need android.permission.BLUETOOTH_SCAN permission for Attribution Source { urid = 10467, package Name = com.stier.com, attributional = null, token = android os BinderProxy#a208f16, next = null }: Starting discovery.
Below is my environment Ionic CLI:6.20.1 Ionic Framework:
#ionic/angular 6.2.2. #angular-devkit/build-angular : 13.0.4.
#angular-devkit/schematics : 13.0.4. #angular/cli : 13.0.4.
#ionic/angular-toolkit:5.0.3.

Related

How can I get android id using ADB and within Unity application?

I need to get the AndroidID using ADB and inside the unity application check if it's the same device using the AndroidID.
With this command, using ADB I have the AndroidID:
adb shell settings get secure android_id
>> a9822db857e4****
And inside the unity application, I'm using this code:
AndroidJavaClass clsUnity = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject objActivity = clsUnity.GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaObject objResolver = objActivity.Call<AndroidJavaObject>("getContentResolver");
AndroidJavaClass clsSecure = new AndroidJavaClass("android.provider.Settings$Secure");
string android_id = clsSecure.CallStatic<string>("getString", objResolver, "android_id");
>> android_id = 98ff3a034b16****
You may notice that the IDs are different.
Does anyone have a solution for this?
How can I get that same identifier using ADB and in unity ?
If your device runs Android version > Android 8.0 (API level 26), the ANDROID_ID string is unique to each app (more precisely, to each app-signing key - so more like unique to all your apps you signed with the same key). You can check out all the changes related to ANDROID_ID here.
If you are running Android version < 8.0, you might have multiple users and they will have separate ids - maybe you are getting root users' id via ADB and the whatever-user-launched-your-app id from code? (See here).

Signin failure for Huawei IAP via Unity Distribution Portal, in logs it says error code 907135001

We are trying to connect Huawei IAP via Unity Distribution Portal, but having an issue on “sign-in” stage w/ logs below. It says sign in failed w/ status 907135001. I tried to search on Huawei develop website but no any information for this error code. Any one can help?
2020-12-02 12:35:47.626 6980-6988/? I/UnityDistPlatform: [ HUAWEI] sign in failed , status : 997135001
2020-12-02 12:35:47.626 6980-6980/? I/UnityDistPlatform: [ HUAWEI] Setup finished.
2020-12-02 12:35:47.714 6982-6980/? I/UnityDistPlatform: [ HUAWEI] Init Fail: sign in failed
2020-12-02 12:35:47.721 6982-6980/? I/UnityDistPlatform: [ HUAWEI] UDP Version : v2.0.0
2020-12-02 12:35:47.722 6980-6980/? D/UnityDistPlatform: [ HUAWEI] DeviceId (android):c716ce5df161065a , Clientid : h2T5 - guv9QtkF095vyL5eQ
Old HMS core will have the issue. Please use the latest HMS Core version, which should resolve this issue. Please let me know if you still experience this issue with latest HMS Core.

When I run the command to build ionic app: ionic cordova build android --prod --verbose. I get the following error:

When I run the command to build ionic app: ionic cordova build android --prod --verbose.
I get the following error:
ERROR in : 'IonInput' is not a known element:
If 'IonInput' is an Angular component, then verify that it is part of this module.
To allow any element add 'NO_ERRORS_SCHEMA' to the '#NgModule.schemas' of this component.
(">Please enter the ip address of the server running machine</h3>
<h2>Example 192.168.0.118 </h2>
[ERROR ->]<IonInput value="custom" [(ngModel)]="ip_address"></IonInput>
<IonButton (click)="ipSave()" color="")
: 'IonButton' is not a known element:
If 'IonButton' is an Angular component, then verify that it is part of this module.
To allow any element add 'NO_ERRORS_SCHEMA' to the '#NgModule.schemas' of this component.
(" <h2>Example 192.168.0.118 </h2>
<IonInput value="custom" [(ngModel)]="ip_address"></IonInput>
[ERROR ->]<IonButton (click)="ipSave()" color="primary">Save</IonButton>
</ion-content>
")
src/app/layout/touring/touring.page.html(8,18): : Expected 0 arguments, but got 1.
[ERROR] An error occurred while running subprocess ng.
Any help is appreciated.
Thanks in advance.
You are mixing React Tags with Angular Directives. With your error message, I can safely assume your using Ionic/Angular. Make sure you are following the Angular Documentation.

Latency timeout using CosmosDB from Android Xamarin

I am developing an app using Xamarin using Visual Studio for Mac.
I am writing C# to target both iOS and Android.
We are also using CosmosDB on Microsoft Azure.
The problem comes about when trying to get Android to access CosmosDB. Please note that I am using the Mongo API for Cosmos.
The error message I get in Android is as follows:
A timeout occured after 30000ms selecting a server using
CompositeServerSelector{ Selectors = ReadPreferenceServerSelector{
ReadPreference = { Mode : Primary } }, LatencyLimitingServerSelector{
AllowedLatencyRange = 00:00:00.0150000 } }. Client view of cluster
state is { ClusterId : "2", ConnectionMode : "ReplicaSet", Type :
"ReplicaSet", State : "Disconnected", Servers : [{ ServerId: "{
ClusterId : 2, EndPoint :
"Unspecified/aspire-cosmosdb.documents.azure.com:10255" }", EndPoint:
"Unspecified/aspire-cosmosdb.documents.azure.com:10255", State:
"Disconnected", Type: "Unknown" }] }.
This is my code:
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using MongoDB.Driver;
string dsn = "mongodb://myusername:mypassword#mycosmosname.documents.azure.com:10255/?ssl=true&replicaSet=globaldb";
string databaseName = "mydatabasename";
Debug.WriteLine("Initializing Cosmos DB!");
MongoClientSettings settings = MongoClientSettings.FromUrl(new MongoUrl(dsn));
settings.SslSettings = new SslSettings() { EnabledSslProtocols = SslProtocols.Tls12 };
var mongoClient = new MongoClient(settings);
var db = mongoClient.GetDatabase(databaseName);
var databases = (await mongoClient.ListDatabasesAsync()).ToList();
foreach (var d in databases)
{
Debug.WriteLine(d.AsBsonDocument);
}
This works 100% fine on xamarin.ios. Connects everytime. The code is pretty much copy and paste from the CosmosDB Quick start on the Azure Portal. I have also taken this code and put it in a C# Console app and it ALSO works. However, same code doesn't work on Android. Why?
I've tried this both on the Android simulator and a real Android device and both times get this 30 second timeout. I've also enabled the Internet permission on Android, but no joy. Please help!
I've referenced the latest packages via Nuget at the time of writing:
MongoDB.Driver -2.4.4
MongoDB.Driver.Core - 2.4.4
MongoDB.Bson - 2.4.4
Note: I have obfuscated the personal details from the dsn but it should show you the rough format of it. The actual dsn is a direct copy and paste of the cosmosdb dsn connection string from the Azure portal.
Okay so after a LOT of headbanging, the solution is fairly simple.
CosmosDB ONLY supports TLS 1.2.
Go into your Droid project settings (Right click on project > Options) and go to Android Build > SSL/TLS Implementation.
Mine was set to 'default'. I guess 'default' at the time of writing does not support TLS 1.2. At least not on Xamarin for the Mac anyway. This is quite a gotcha. Switch it over to Native TLS 1.2+ and magically it just works! Now able to connect to CosmosDB via Android.

How to check connection in Intel XDK

My app need to detect if the device is connected to the internet or not. To do this I'm using the below script:
document.addEventListener("intel.xdk.device.connection.update",function(){
if(intel.xdk.device.connection == "none")
{
alert("Offline");
} else {
alert("Online");
}
},false);
intel.xdk.device.updateConnection();
This code work perfectly in the emulator, but not in my Moto G, using Intel XDK Preview tool or after install the apk generated using Cordova!
Didn't show any fail message, just do nothing!
Once you added Cordova Network plugin, you can detect network details as:
function checkConnection() {
var networkState = navigator.connection.type;
var states = {};
states[Connection.UNKNOWN] = 'Unknown connection';
states[Connection.ETHERNET] = 'Ethernet connection';
states[Connection.WIFI] = 'WiFi connection';
states[Connection.CELL_2G] = 'Cell 2G connection';
states[Connection.CELL_3G] = 'Cell 3G connection';
states[Connection.CELL_4G] = 'Cell 4G connection';
states[Connection.CELL] = 'Cell generic connection';
states[Connection.NONE] = 'No network connection';
alert('Connection type: ' + states[networkState]);
}
checkConnection();
Following links explain how to use Intel-xdk bridge to call different APIs
Intel XDK Cordova API Documentation
Intel XDK "legacy" API Documentation
Apache Cordova* API Documentation
https://software.intel.com/en-us/html5/xdkdocs#506911
Intel XDK Name Space API Plugin Details for Cordova Build Containers
Note that the APIs listed below augment the standard Cordova APIs, both APIs can and should be used in your application. In some cases there is overlap between the Cordova APIs and the intel.xdk APIs; in that case, we recommend you use the Cordova API first and then use the intel.xdk API when the Cordova API either does not provide the desired functionality or provides inadequate functionality.
Check this out, it will help you configure the plugin: Understanding the Intel® XDK Cordova Build Options