SignalR giving problems in Android 9.0 - android

I need to start a connection using SignalR hubProxy class, everything works fine till API 25 but above 25 it gives this error:
Failed to finalize session : INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113
code I'm Using
HubConnection hubConnection = new HubConnection(hubUrl);
HubProxy hubProxy = hubConnection.createHubProxy("hubName");
try {
SignalRFuture<Void> awaitConnection;
awaitConnection = hubConnection.start(new ServerSentEventsTransport(hubConnection.getLogger()));
awaitConnection.get();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
I tried to resolve it by following this answer, but it does not provide hubProxy class. so I cannot use it.
Please tell me how to fix this error.

Related

how to implement smack for xmpp

I'm trying to have my android app to be able to send and receive xmpp message using smack but it does not work and the connect command does not return. I have seen several code example but Smack has new versions and the syntax has changed so I might be doing something wrong :
in my build.graddle file I use :
compile "org.igniterealtime.smack:smack-android-extensions:4.3.0"
compile "org.igniterealtime.smack:smack-tcp:4.3.0"
I'm trying to send a message from myaccount321#xabber.org to myaccount456#xabber.org
I'm trying to connect using hot-chilli.net (Idon't mind using some other server))
everything seems to go well until connection.connect() after which the script does not return without triggering any exception.
Please tell me what I'm doing wrong
TIA
public void sendxmpp(){
XMPPTCPConnectionConfiguration config = null;
try {
XMPPTCPConnectionConfiguration.Builder configbuilder = XMPPTCPConnectionConfiguration.builder();
configbuilder.setUsernameAndPassword("myaccount321","myaccount321pw");
DomainBareJid serviceName = JidCreate.domainBareFrom("hot-chilli.net");
configbuilder.setServiceName(serviceName);
configbuilder.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled)
configbuilder.setHost("jabber.hot-chilli.net");
configbuilder.setPort(8222);
config=configbuilder.build();
AbstractXMPPConnection connection = new XMPPTCPConnection(config);
try {
connection.connect();
}
catch (SmackException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}
catch (XMPPException e) {
e.printStackTrace();
}
catch (InterruptedException e) {
e.printStackTrace();
}
connection.login();
ChatManager chatManager = ChatManager.getInstanceFor(connection);
EntityBareJid jid = JidCreate.entityBareFrom("myaccount321pw#xabber.org");
Chat chat = chatManager.createChat(jid);
chat.sendMessage("Hello");
}
catch (Exception e) {
}
}
OK I got it, the connection process has to be done in its own thread.

ooVoo SDK initialization issue

I am having an issue in my project, when I am loading oovooLibrary in my app it is not responding for 5 seconds and then crashing without any error. Please help me in this.
My code is
ooVooClient.setContext(app);
ooVooClient.setLogger(this, LoggerListener.LogLevel.Debug);
try {
// I am getting no responce for this line
mConferenceCore = ooVooClient.sharedInstance();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
private ooVooClient sdk = null;
private ApplicationSettings settings = null;
if (!ooVooClient.isDeviceSupported()) {
return;
}
settings = new ApplicationSettings(this);
ooVooClient.setLogger(this, LogLevel.fromString(getSettings().get(ApplicationSettings.LogLevelKey)));
ooVooClient.setContext(this);
sdk = ooVooClient.sharedInstance();
Check this https://github.com/oovoodev/Android-SDK-Sample
I have fixed that issue, I was calling ooVooClient.setContext(app); from MainActivity class so it was not accepting that context - app (getApplicationContext()), So I initlialized it in MainApplication.java and stored that in static variable and used that in other classes.

Integrating Smack 4.1 in android

I have gone through smack 4.1 documentation as given https://github.com/igniterealtime/Smack/tree/master/documentation . But I'm not getting connected when try to connect to openfire server. Can anyone give me a working code. My openfire configuration is working. I have checked it using mac IM client.
I had the same issue when I tried exactly as in documentation.
But I found some changes needed after a research. Here is the code that I've used.
public void connect() throws IOException, XMPPException, SmackException {
XMPPTCPConnectionConfiguration.Builder config = XMPPTCPConnectionConfiguration.builder();
config.setUsernameAndPassword("username","password");
config.setServiceName(Config.XMPP_DOMAIN);
config.setHost(Config.XMPP_HOST);
config.setPort(Config.XMPP_PORT);
mConnection = new XMPPTCPConnection(config.build());
try {
mConnection.connect();
mConnection.login();
} catch (SmackException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (XMPPException e) {
e.printStackTrace();
}
//ChatManager.getInstanceFor(mConnection).addChatListener(this);
}
check out the link working example http://developer.samsung.com/technical-doc/view.do?v=T000000119

Android Emulator can not connect to SailsJs server via Socket.IO

I am developing an Android app. I would like it to communicate with a SailsJS server via SocketIO. I am using socket.io for Android(com.github.nkzawa:socket.io-client) as the socket.io library in the android app.
I run it on an emulator while doing the development. The initialization code is as below:
private Socket mSocket;
{
try {
mSocket = IO.socket(Config.SERVER_URL);
} catch (URISyntaxException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
Config.SERVER_URL is set to be "http://10.0.2.2:1337".
It always reports "connect_error". What should I do to get it connected?

Ad SDKs can't seem to get the Advertising info from the device

This is what we see from Mopub and other ad networks:
java.io.IOException: Connection failure
com.google.android.gms.ads.identifier.AdvertisingIdClient.g(Unknown
Source)
com.google.android.gms.ads.identifier.AdvertisingIdClient.getAdvertisingIdInfo(Unknown
Source)
They all seem to have the same problem.
The weird thing is that we have no problem getting the advertising id from our app whatsoever with the following source. We get the right advertising id and we have no error logs.
All the SDKs are hitting the same issue (Connection failure).
Any help appreciated.
private void getAdvertisingId(AdvertisingIdHolder receiver) {
AdvertisingIdClient.Info adInfo = null;
String id = null;
boolean isLAT = false;
try {
adInfo = AdvertisingIdClient.getAdvertisingIdInfo(App.getCtx());
id = adInfo.getId();
isLAT = adInfo.isLimitAdTrackingEnabled();
} catch (IOException e) {
SLog.e("error", e);
// Unrecoverable error connecting to Google Play services (e.g.,
// the old version of the service doesn't support getting AdvertisingId).
} catch (GooglePlayServicesNotAvailableException e) {
SLog.e("error", e);
// Google Play services is not available entirely.
} catch (GooglePlayServicesRepairableException e) {
e.printStackTrace();
}
receiver.receive(id, isLAT);
}
I went through trials and errors these days on getting advertising id. Finally I got it!
The connection error can be solved if we pass in getApplicationContext() instead of the context of current activity. Below is my working code:
private void getGaid() {
new Thread(new Runnable() {
#Override
public void run() {
try {
String gaid = AdvertisingIdClient.getAdvertisingIdInfo(
getApplicationContext()).getId();
if (gaid != null) {
Log.d("DEBUG", gaid);
// gaid get!
}
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (GooglePlayServicesRepairableException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (GooglePlayServicesNotAvailableException e) {
e.printStackTrace();
}
}
}).start();
}
getGaid() can be put in onCreate(), onResume(), or onClick() of a view, as long as the thread is called by the main ui thread.
Another thing you may need is to update google play services library to latest version. As the official document here mentioned, IOException is probably caused because the old version of the service doesn't support getting AdvertisingId.
Feel free to comment if there is any other questions.

Categories

Resources