Problem to integrate Jitsi Meet Sdk with linphone - android

I am using JItsi meet api for video call on linphone android app open source project. I have followed jitsi meet handbook for integrating on linphone.
Here is my sample code:
public class JitsiActivity extends AppCompatActivity {
#Override
protected void onCreate(#Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
URL serverURL;
try {
serverURL = new URL("https://meet.jit.si");
} catch (MalformedURLException e) {
e.printStackTrace();
throw new RuntimeException("Invalid server URL!");
}
JitsiMeetConferenceOptions defaultOptions =
new JitsiMeetConferenceOptions.Builder()
.setServerURL(serverURL)
.setWelcomePageEnabled(false)
.build();
JitsiMeet.setDefaultConferenceOptions(defaultOptions);
JitsiMeetConferenceOptions options =
new JitsiMeetConferenceOptions.Builder().setRoom("linphone").build();
JitsiMeetActivity.launch(this, options);
finish();
}
}
I have successfully made a call on debug mode, after making an apk on release mode, It refresh activity when I attempt to make a video call and go to home page. can you give me a guideline to solve this problem. I have tested apk on Android 10 OS.
--After Debugging on release mode I have found this error
020-09-24 16:50:12.383 10364-10364/org.linphone E/AndroidRuntime: FATAL EXCEPTION: main
Process: org.linphone, PID: 10364
java.lang.IllegalArgumentException: reportSizeConfigurations: ActivityRecord not found for: Token{2329006 ActivityRecord{cf5fae1 u0 org.linphone/.activities.JitsiActivity d-1 s-1 t-1 f}}
at android.os.Parcel.createException(Parcel.java:1967)
at android.os.Parcel.readException(Parcel.java:1931)
at android.os.Parcel.readException(Parcel.java:1881)
at android.app.IActivityManager$Stub$Proxy.reportSizeConfigurations(IActivityManager.java:8621)
at android.app.ActivityThread.reportSizeConfigurations(ActivityThread.java:3360)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3318)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:113)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:71)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2043)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7096)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:536)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:928)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.am.ActivityManagerService.reportSizeConfigurations(ActivityManagerService.java:10305)
at android.app.IActivityManager$Stub.onTransact$reportSizeConfigurations$(IActivityManager.java:12560)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2357)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3841)
at android.os.Binder.execTransact(Binder.java:750)

You need to provide a stacktrace to for anyone to help you debug it, however, this code can be simplified greatly which would lead to easier debugging..
You are supplying Jitsi with it's own default server url "https://meet.jit.si" which isn't necessary as Jitsi will use it's own server anyway. If you were planning on using your own server you can still provide that easily in the JitsiMeetActivity::launch method as the room parameter...
JitsiMeetActivity.launch(context, "https://myserver.com/linphone")
Removing all the unnecessary boiler-plate will leave you with this:
#Override
protected void onCreate(#Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
JitsiMeetActivity.launch(this, "linphone");
}

Related

Failed to bind to the service

On the app launch, I need to check whether a new version is available on play store or not. To check I have implemented below code in Splash screen.
private void checkNewVersionAvailability() {
appUpdateManager = AppUpdateManagerFactory.create(getApplicationContext());
appUpdateInfo = appUpdateManager.getAppUpdateInfo();
appUpdateInfo.addOnCompleteListener(new OnCompleteListener<AppUpdateInfo>() {
#Override
public void onComplete(Task<AppUpdateInfo> task) {
if (task.isComplete()) {
if (task.getResult().updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE) {
checkVersion(task.getResult());
} else if (task.getResult().updateAvailability() == UpdateAvailability.UPDATE_NOT_AVAILABLE) {
if (StringUtils.isNullOrEmpty(ChevronApplication.deviceId)) {
new Handler().postDelayed(new Runnable() {
#Override
public void run() {
RegsiterDeviceHandler handler = new RegsiterDeviceHandler(SplashScreen.this);
handler.registerDevice(false);
handler.showNextScreen();
}
}, SLEEP_TIME);
} else {
new Handler().postDelayed(new Runnable() {
#Override
public void run() {
new RegsiterDeviceHandler(SplashScreen.this).showNextScreen();
}
}, SLEEP_TIME);
}
}
}
}
});
During testing on the device, I didn't get the issue. These crash logs are I found from the Pre-launch report in Playstore.
> FATAL EXCEPTION: main
Process: com.mac.app, PID: 19641
com.google.android.play.core.tasks.RuntimeExecutionException: com.google.android.play.core.internal.aa: Failed to bind to the service.
at com.google.android.play.core.tasks.k.getResult(Unknown Source)
at com.chevronrenaissance.app.activity.SplashScreen$2.onComplete(SplashScreen.java:113)
at com.google.android.play.core.tasks.a.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5538)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: com.google.android.play.core.internal.aa: Failed to bind to the service.
at com.google.android.play.core.internal.q.b(Unknown Source)
at com.google.android.play.core.internal.q.a(Unknown Source)
at com.google.android.play.core.internal.s.a(Unknown Source)
at com.google.android.play.core.internal.r.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.os.HandlerThread.run(HandlerThread.java:61)
There seems to be an issue with Google Play Core library with Android Virtual Devices. I had to add a try/catch statement so the Pre-launch testing passes. I think you may have to wrap al your AppUpdateManager calls so the exception is catched.
I was running a very similar issue using the in-app review component. It turned out one of the emulators I was developing with had not been signed into a Google Play account. You may want to ensure your emulator is signed into Google Play.
You can check task.isSuccessful().
In this case, when the task is not successful, you can get the exception use method task.getException()
Most likely that the Emulator you are using do not contain Google Play at all.
If you are running it in a emulator and if emulator is not signed for Google play, it will show the error that "PID: [6084] AppUpdateService : Failed to bind to the service."

getContentResolver().delete() throws IllegalArgumentException sporadically

We released a beta of our product, it works for most users, but one user with OnePlus 5T/Android 8.1 reports a sporadic exception:
java.lang.RuntimeException: Unable to resume activity {com.ourproduct/com.ourproduct.MainActivity}: java.lang.IllegalArgumentException: Unknown URL content://com.ourproduct.data/delete
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3726)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3766)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1737)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6753)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:482)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by:java.lang.IllegalArgumentException: Unknown URL content://com.ourproduct.data/delete
at android.content.ContentResolver.delete(ContentResolver.java:1745)
<... here is our code stacktrace ...>
I contacted the user and got some additional info: the issue does not happen every time he uses the operation, just sometimes.
The content provider is defined in the same application.
The code is trivial, just for completeness of the question:
protected void unsetValue(final String group, final String name) {
myContext.getContentResolver().delete(
uri("delete"), null, new String[] { group, name }
);
}
private Uri uri(String location) {
return Uri.parse("content://com.ourproduct.data/" + location);
}
Any ideas? Maybe I can ask the user for some additional info?

TransactionTooLargeException when trying to send binary content, using Intents [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I need to send binary content from my app to whatever app opens that file type in the device.
I'm following these instructions:
https://developer.android.com/training/sharing/send.html#send-binary-content
Here's my code:
final FileType fileType
final File file;
final Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.putExtra(Intent.EXTRA_STREAM, FileProvider.getUriForFile(AncestryApplication.getAppContext(), AncestryApplication.getAppContext().getApplicationContext().getPackageName() + ".provider", file));
intent.setType(fileType.getMimeType());
startActivity(intent);
A few things:
If I change the intent action from ACTION_VIEW to ACTION_SEND, I get the wrong possible list of apps to open my file
ACTION_SEND seems to work, but only with small file sizes
intent.setDataAndType() seems to work fine on devices OS M and lower. On N I get the same TransactionTooLargeException
At the end, this is what I need to accomplish:
I already have a file saved, and it is stored at file:///storage/emulated/0/Download/TempFile.html
Since the file may be too large, I need to send just the location of the file to a third party app (like adobe pdf reader) to open the file
No issues on M or lower, tons of issues on N
Any ideas on what I may be doing wrong? I've been trying to solve this for a few days and I've read a ton of tutorials and SO suggestions, without any final answer.
Thanks.
EDIT: here's my stacktrace:
AndroidRuntime: FATAL EXCEPTION: main
Process: com.myapp.android.apps.myapp, PID: 26785
java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 27943540 bytes
at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3752)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: android.os.TransactionTooLargeException: data parcel size 27943540 bytes
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:615)
at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:3606)
at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3744)
at android.os.Handler.handleCallback(Handler.java:751) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6077) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
EDIT 2: Added onSaveInstanceState() code from base fragment:
#Override
public void onSaveInstanceState(final Bundle outState) {
mSaveInstanceStateCalled = true;
outState.putBoolean(KEY_PROCESSING_SAVE, mSaveInProgress);
}
The exception in the logcat you posted is caused by packing too much data into the Bundle processed by onSaveInstanceState.
Here is the method from the Android source where it is thrown, if the build version is N or greater:
private static class StopInfo implements Runnable {
ActivityClientRecord activity;
Bundle state;
PersistableBundle persistentState;
CharSequence description;
#Override public void run() {
// Tell activity manager we have been stopped.
try {
if (DEBUG_MEMORY_TRIM) Slog.v(TAG, "Reporting activity stopped: " + activity);
ActivityManagerNative.getDefault().activityStopped(
activity.token, state, persistentState, description);
} catch (RemoteException ex) {
if (ex instanceof TransactionTooLargeException
&& activity.packageInfo.getTargetSdkVersion() < Build.VERSION_CODES.N) {
Log.e(TAG, "App sent too much data in instance state, so it was ignored", ex);
return;
}
throw ex.rethrowFromSystemServer(); // <<-- exception thrown here
}
}
}
I am posting this in the form of an answer because it's too long for a comment. It is not meant as a complete answer to the question, because there is not enough information in the question to answer it.

"GoogleApiClient is not connected yet" exception in Cast application

I'm developing an Android application that casts content to Chromecast.
Sometimes in my com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks implementation in the onConnected method, I get a
java.lang.IllegalStateException: GoogleApiClient is not connected yet.
exception.
Here is the stack trace:
FATAL EXCEPTION: main
Process: com.joaomgcd.autocast, PID: 13771
java.lang.IllegalStateException: GoogleApiClient is not connected yet.
at com.google.android.gms.internal.eg.a(Unknown Source)
at com.google.android.gms.common.api.GoogleApiClient.b(Unknown Source)
at com.google.android.gms.cast.Cast$CastApi$a.launchApplication(Unknown Source)
at com.joaomgcd.autocast.media.MediaConnectionCallbacks.onConnected(MediaConnectionCallbacks.java:37)
at com.google.android.gms.internal.dx.b(Unknown Source)
at com.google.android.gms.common.api.GoogleApiClient.bn(Unknown Source)
at com.google.android.gms.common.api.GoogleApiClient.f(Unknown Source)
at com.google.android.gms.common.api.GoogleApiClient$2.onConnected(Unknown Source)
at com.google.android.gms.internal.dx.b(Unknown Source)
at com.google.android.gms.internal.dx.bT(Unknown Source)
at com.google.android.gms.internal.dw$h.b(Unknown Source)
at com.google.android.gms.internal.dw$h.b(Unknown Source)
at com.google.android.gms.internal.dw$b.bR(Unknown Source)
at com.google.android.gms.internal.dw$a.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
This only seems to happen if I had already connected to the GoogleApiClient before and am connecting for a second time. Between the 2 calls I disconnect from the api client with the code below.
My guess is that this is a bug. Am I correct? Since I'm in the onConnected method, the GoogleApiClient should already be connected.
What can I do to get around it? Should I just wait for a while until the GoogleApiClient is really connected?
I am doing this in a service and here are the relevant bits:
when the service starts:
mMediaRouter.addCallback(mMediaRouteSelector, mediaCallback, MediaRouter.CALLBACK_FLAG_PERFORM_ACTIVE_SCAN);
mediaCallback has this code:
#Override
public void onRouteAdded(MediaRouter router, RouteInfo route) {
super.onRouteAdded(router, route);
if (route.getDescription().equals("Chromecast")) {
...
mSelectedDevice = com.google.android.gms.cast.CastDevice.getFromBundle(route.getExtras());
...
castClientListener = new CastListener(context, apiClient);
Cast.CastOptions.Builder apiOptionsBuilder = Cast.CastOptions.builder(mSelectedDevice, castClientListener);
...
apiClient.set(new GoogleApiClient.Builder(context).addApi(Cast.API, apiOptionsBuilder.build()).addConnectionCallbacks(connectionCallback).addOnConnectionFailedListener(new MediaConnectionFailedListener(context)).build());
apiClient.get().connect();
}
}
connectionCallback has this code:
#Override
public void onConnected(final Bundle arg0) {
...
Cast.CastApi.launchApplication(apiClient, UtilAutoCast.CHROMECAST_APP_ID, false).setResultCallback(connectionCallback);
...
}
The code above is the part where the crash happens.
And when I stop the service I run this code:
if (mMediaRouter != null) {
mMediaRouter.removeCallback(mediaCallback);
mMediaRouter = null;
}
if (apiClient != null) {
Cast.CastApi.stopApplication(apiClient);
if (apiClient.isConnected()) {
apiClient.disconnect();
apiClient = null;
}
}
Thanks in advance.
Google APIs for Android > GoogleApiClient
You should instantiate a client object in your Activity's onCreate(Bundle) method and then call connect() in onStart() and disconnect() in onStop(), regardless of the state.
The implementation of the GoogleApiClient appears designed for only a single instance. It's best to instantiate it only once in onCreate, then perform connections and disconnections using the single instance.
I would guess that only one GoogleApiClient can be actually be connected, but multiple instances are receiving the onConnected callback.
In your case it's probably fine to not call connect in onStart, but only in onRouteAdded.
I think this issue is very similar to Fatal Exception: java.lang.IllegalStateException GoogleApiClient is not connected yet
Have you declare following <meta> tag
<application ...>
...
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
...
</application>
I just forgot to write so may you also stuck with this reason.
Thank you.
From showcase app (Googlecast Github Sample CastHelloText-android ) receiver app is launched onRouteSelected (not onRouteAdded as you are doing in your code). I would try to change that. In case it does not work, I would add log lines in every method related to connection & session, and see what is happening.
Another tip: I have had crash with stopping the application (in case chromecast device is physically plugged out from power). Solution is to putCast.CastApi.stopApplication(apiClient); inside if (apiClient.isConnected()).
It seems like you are calling GoogleApiClient before it is connected
move this line in onCreate()
// First we need to check availability of play services
if (checkPlayServices()) {
// Building the GoogleApi client
//buildGoogleApiClient();
try {
mGoogleApiClient = new GoogleApiClient.Builder(this).addConnectionCallbacks(this).addOnConnectionFailedListener(this).addApi(LocationServices.API).build();
mGoogleApiClient.connect();
}catch (IllegalStateException e)
{
Log.e("IllegalStateException", e.toString());
}
createLocationRequest();
}
Hope it helps you.

Android Activity Recognition - Reconnecting following Disconnection

With Google Play Services' Activity Recognition, they recommend that if the service disconnects (which it might) then we should remove the client:
http://developer.android.com/training/location/activity-recognition.html
In some cases, Location Services may disconnect from the activity
recognition client before you call disconnect(). To handle this
situation, implement onDisconnected(). In this method, set the request
flag to indicate that a request is not in progress, and delete the
client
That's fine, but it gives no instructions for how to reconnect [safely]. I'm running this from a foreground service which needs to maintain activity recognition at all times, so following disconnection:
#Override
public void onDisconnected() {
mRecognitionEnabled = false;
mRequestInProgress = false;
mRecognitionClient = null;
//Re-initialise Activity Recognition if service is still running
if (sServiceRunning) {
triggerActivityRecognition();
}
}
I reinstantiate the client and reconnect:
private void triggerActivityRecognition() {
if (!mRequestInProgress ) {
mRequestInProgress = true;
mRecognitionClient = new ActivityRecognitionClient(this, this, this);
mRecognitionClient.connect();
}
}
But according to some of the bug reports I'm getting, there's an exception occurring as follows:
java.lang.NullPointerException
at com.google.android.gms.internal.bh.a(Unknown Source)
at com.google.android.gms.internal.k.f(Unknown Source)
at com.google.android.gms.internal.k$e.onServiceConnected(Unknown Source)
at com.google.android.gms.internal.l.a(Unknown Source)
at com.google.android.gms.internal.k.connect(Unknown Source)
at com.google.android.gms.location.ActivityRecognitionClient.connect(Unknown Source)
at com.myapp.MyService.triggerActivityRecognition(MyService.java:316)
at com.myapp.MyService.onDisconnected(MyService.java:407)
at com.google.android.gms.internal.k.A(Unknown Source)
at com.google.android.gms.internal.k$e.onServiceDisconnected(Unknown Source)
at com.google.android.gms.internal.l$a$a.onServiceDisconnected(Unknown Source)
The disconnection occurs rarely but results in the same stack trace every time.
So if this is being caused by Google Play Services, is there anything I can do to prevent it or is it a bug I need to log with Android?
This is what works for me:
Don't attempt the reconnect with the onDisconnect(), instead do nothing in the onDisconnect()
public void onDisconnected() {
//do nothing here
}
Simply use the client as before, but check if is connected
if (!mRecognitionClient.isConnected()) {
// Client is disconnected, reconnect now
mRecognitionClient.connect();
}
The PlayServices seems to reconnect very nicely.

Categories

Resources