I am able to run Jitsi video calling android sdk successfully when I add the main video calling activity as the launcher activity of the application, video is getting connected smooth and no worries . However when I changed to the code to calling the same activity from another activity it throws an activity not found exception .
Here is my manifest file
<activity
android:name=".activity.JitsiVideoCallActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize"
android:label="#string/app_name"
android:resizeableActivity="true"
android:supportsPictureInPicture="true"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="beta.hipchat.me"
android:scheme="https" />
<data
android:host="beta.meet.jit.si"
android:scheme="https" />
<data
android:host="chaos.hipchat.me"
android:scheme="https" />
<data
android:host="enso.me"
android:scheme="https" />
<data
android:host="hipchat.me"
android:scheme="https" />
<data
android:host="meet.jit.si"
android:scheme="https" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="org.jitsi.meet" />
</intent-filter>
</activity>
This is my activity which is supposed to do the video call
public class JitsiVideoCallActivity extends AppCompatActivity {
private JitsiMeetView view;
private static final String ADD_PEOPLE_CONTROLLER_QUERY = null;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
view = new JitsiMeetView(this);
Bundle config = new Bundle();
config.putBoolean("startWithAudioMuted", false);
config.putBoolean("startWithVideoMuted", false);
Bundle urlObject = new Bundle();
urlObject.putBundle("config", config);
urlObject.putString("url", "https://meet.jit.si/wizcounsel");
view.loadURLObject(urlObject);
setContentView(view);
}
This is how I launch the intent
#OnClick(R.id.call)
void call() {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO)
!= PackageManager.PERMISSION_GRANTED) {
// Permission is not granted
askForAudioPermission();
} else
startActivity(new Intent(this, JitsiMeetActivity.class),);
}
I have added JAVA 8 compatibility in my app level gradle file and dependencies on both the gradle files
What I have tried
changing launch mode to singletask App crashes
Making the video call activity the launcher App works
Extend AppCombactActivity and / or JitsiMee Activity App crashes
This is my crash log
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.star.star*, PID: 26197
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.star.star/org.jitsi.meet.sdk.JitsiMeetActivity}; have you declared this activity in your AndroidManifest.xml?
If any more info is needed , let me know, thanks in advance, Kindly help
initialize it in oncreate method.In any activity.
void connectCall() {
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)
.build();
JitsiMeet.setDefaultConferenceOptions(defaultOptions);
}
now call this method where you want. Example onclick listener
public void onVideoCall(String text) {
if (text.length() > 0) {
// Build options object for joining the conference. The SDK will merge the default
// one we set earlier and this one when joining.
JitsiMeetConferenceOptions options
= new JitsiMeetConferenceOptions.Builder()
.setRoom(text)
.setWelcomePageEnabled(false)
.build();
// Launch the new activity with the given options. The launch() method takes care
// of creating the required Intent and passing the options.
JitsiMeetActivity.launch(activity, options);
}
I think you forgot to register your activity in AndroidManifest.xml. You should register your activity in <application> tag as below.
<activity
android:name=".YourActivity"/>
Related
I'm working on an image editor app and I want to have my app being in the 'Open With ...' list when the user clicks on an image from file manager or ... (Like how 'Photo Editor' app did) :
Click to see the example (Edited)
And the problem is that I don't know how to do such a thing.
I have researched in youtube and I found that it's about the intent filter in the Manifest.xml file.
I already tried adding some <action/> to my intent filter by random but it didn't worked.
Go to the Manifest file and search for your LAUNCHER activity for example SplashActivity
like this
<activity
android:name=".SplashActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
//this below code help you to get image from other apps if shared
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="image/*" />
</intent-filter>
</activity>
And To get that data in your SplashActivity do this :
Intent intent = getIntent();
String action = intent.getAction();
String type = intent.getType();
//this will check that you are getting only image type not text
boolean isImage = Intent.ACTION_SEND.equals(action) && "image/*".equals(type);
if(getIntent().getData() != null && isImage){
// here you got the data and you can send this data or uri
// to your image editor activity
Uri imageUri = intent.getData();
}
And you can send that image to the next activity by doing this
you can store the URI as a string
Intent nextIntent = new Intent(this, EditorActivity.java);
nextIntent.putExtra("imageUri", imageUri.toString());
startActivity(nextIntent)
and then just convert the string back to URI like this in your (EditorActivity)
Uri myUri = Uri.parse(getIntent().getStringExtra("imageUri"));
i have 2 issues:
the major issue is that if the app is not installed on my phone (android), then the branch link sents me to install it via play store, but then after i install and open it from there i dont have the deep link data.
if the app is already installed and i click the branch link, i need to choose between to open it via chrome or via app,
if i choose chrome -> again no deep link data.
this is the source code:
MainApp.java
public class MainApp extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
#Override public void onStart() {
super.onStart();
try {
Branch.sessionBuilder(this).withCallback(new Branch.BranchReferralInitListener() {
#Override
public void onInitFinished(JSONObject referringParams, BranchError error) {
if (error == null) {
// option 3: navigate to page
Intent intent = new Intent(MainApp.this, Main2Activity.class);
startActivity(intent);
} else {
Log.i("BRANCH SDK", error.getMessage());
}
}
}).withData(this.getIntent().getData()).init();
}
catch (Exception e) {
e.printStackTrace();
}
}
#Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
try {
setIntent(intent);
// if activity is in foreground (or in backstack but partially visible) launching the same
// activity will skip onStart, handle this case with reInitSession
Branch.sessionBuilder(this).withCallback(branchReferralInitListener).reInit();
}
catch (Exception ignored) { }
}
private Branch.BranchReferralInitListener branchReferralInitListener = new Branch.BranchReferralInitListener() {
#Override
public void onInitFinished(JSONObject linkProperties, BranchError error) {
// do stuff with deep link data (nav to page, display content, etc)
}
};
}
Main2Activity.java
public class Main2Activity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
}
#Override public void onStart() {
super.onStart();
try{
// Branch logging for debugging
Branch.enableLogging();
// Branch object initialization
Branch.getAutoInstance(this);
}
catch (Exception e) {
e.printStackTrace();
}
}
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:usesCleartextTraffic="true">
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id" />
<activity
android:name=".MainApp">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- Branch URI Scheme -->
<intent-filter>
<data android:scheme="hello" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
<!-- Branch init -->
<meta-data android:name="io.branch.sdk.BranchKey" android:value="key_live_jeVWU2AYfrIjpJmslgNxZgjeAwcUzcqK" />
<meta-data android:name="io.branch.sdk.BranchKey.test" android:value="key_test_hlxrWC5Zx16DkYmWu4AHiimdqugRYMr" />
<meta-data android:name="io.branch.sdk.TestMode" android:value="false" /> <!-- Set to true to use Branch_Test_Key (useful when simulating installs and/or switching between debug and production flavors) -->
<activity android:name=".MainActivity" />
<activity android:name=".Main2Activity" >
<!-- Branch App Links (optional) -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="2rerz.app.link" />
<!-- example-alternate domain is required for App Links when the Journeys/Web SDK and Deepviews are used inside your website. -->
<data android:scheme="https" android:host="2rerz-alternate.app.link" />
</intent-filter>
</activity>
</application>
CustomApplication.java
import android.app.Application;
import io.branch.referral.Branch;
public class CustomApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
// Branch logging for debugging
//Branch.enableLogging();
// Branch object initialization
Branch.getAutoInstance(this);
}
}
The correct Manifest.xml file should be like this -
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id" />
<activity
android:name=".MainApp">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- Branch URI Scheme -->
<intent-filter>
<data android:scheme="hello" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<!-- Branch App Links (optional) -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="2rerz.app.link" />
<!-- example-alternate domain is required for App Links when the Journeys/Web SDK and Deepviews are used inside your website. -->
<data android:scheme="https" android:host="2rerz-alternate.app.link" />
</intent-filter>
</activity>
<!-- Branch init -->
<meta-data android:name="io.branch.sdk.BranchKey" android:value="key_live_jeVWU2AYfrIjpJmslgNxZgjeAwcUzcqK" />
<meta-data android:name="io.branch.sdk.BranchKey.test" android:value="key_test_hlxrWC5Zx16DkYmWu4AHiimdqugRYMr" />
<meta-data android:name="io.branch.sdk.TestMode" android:value="false" /> <!-- Set to true to use Branch_Test_Key (useful when simulating installs and/or switching between debug and production flavors) -->
<activity android:name=".MainActivity" />
<activity android:name=".Main2Activity" >
</activity>
Also, ensure that you are using the correct API Key with the links you are using. If it's a Live Link, then use the Live API key and vice versa.
I call an aidl method that calls me back after some logic, in this callback method I try to start an Activity, but the activity doesn't start and there are no exceptions. Interesting fact, it works on Android 9, but on 10 and 6 doesn't.
Manifest
<activity
android:name=".views.ReceiptsActivity"
android:launchMode="singleInstance"
android:windowSoftInputMode="stateHidden|adjustPan">
<intent-filter>
<action android:name="com.bifit.cashdesk.mobile.views.ReceiptsActivity" />
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
StartActivity() Method
private void showActivity() {
Intent intent = new Intent(context, context.getClass());
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
context.startActivity(intent);
}
Aidl callback method
aidlService.cancel(new IOperationResponse.Stub() {
#Override
public void onResponse(String resultCode, String responseData, String rrn, String billJson) {
showActivity();
}
}, "com.bifit.cashdesk.mobile.views.ReceiptsActivity", rrn);
I have tried to resolve this by user-permissions, but it haven't led to success
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
It was on the side of aidl app, this app didn't close when used callback. We resolved it by closing aidl app on callback on it's side
I want to use parse push notification feature in my android application.
I put my parse push notification code in my first activity (splash activity).
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import com.parse.ParseAnalytics;
import com.parse.ParseInstallation;
import com.parse.PushService;
public class SplashActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
ParseAnalytics.trackAppOpened(getIntent());
// inform the Parse Cloud that it is ready for notifications
PushService.setDefaultPushCallback(this, HomeActivity.class);
ParseInstallation.getCurrentInstallation().saveInBackground();
new Handler().postDelayed(new Runnable() {
#Override
public void run() {
Intent intent = new Intent(SplashActivity.this, HomeActivity.class);
startActivity(intent);
SplashActivity.this.finish();
}
}, 1000);
}
public void onBackPressed() {
}
}
and here is my ParseApplication :
import com.parse.Parse;
import com.parse.ParseACL;
import com.parse.ParseUser;
import android.app.Application;
public class ParseApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
// Add your initialization code here
Parse.initialize(this, " id", "id");
ParseUser.enableAutomaticUser();
ParseACL defaultACL = new ParseACL();
// If you would like all objects to be private by default, remove this line.
defaultACL.setPublicReadAccess(true);
ParseACL.setDefaultACL(defaultACL, true);
}
}
and here is my manifest:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<application
android:name="ParseApplication"
android:icon="#drawable/icon"
android:label="#string/app_name" >
<activity
android:name=".SplashActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".HomeActivity" ></activity>
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParseBroadcastReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
</application>
now I can easily send push notification in application with json like this:
{"title" : "my title",
"alert" : " my alert text",
"uri" :"http://Google.com"
}
here I can easily get my title & my alert but the problem is that it doesn't my uri at all when I click on it and it goes to my home activity.
what's my problem? I want to open my uri.
You need to add in the URI field the name of an activity.
For example:
.SplashActivity
In my case we have this Manifest:
...
<activity
android:name=".presenter.FooActivity"
android:label="#string/title_activity_foo"
android:parentActivityName=".presenter.fooParent">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="myapp" android:host="host" android:path="/path" />
</intent-filter>
</activity>
...
And the json for the Push using Parse is:
{"title" : "my title",
"alert" : " my alert text",
"uri" :"myapp://host/path"
}
If you want to open http://www.google.com you may need to have some code receeiving the Intent on your Activity and creating a new one to go to the URL. For that you will need to add a custom attribute for your json to pass the url you need. Something like:
{"title" : "my title",
"alert" : " my alert text",
"uri" :"myapp://host/path",
"customurl":"http://www.google.com"
}
and the code:
Bundle params = intent.getExtras();
if (params!=null)
{
String param = params.getString("com.parse.Data");
String url = funcThatGetsUrlFromData(param);
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
I have following code, I am truing to start an activity given certain condition is true. But over startActivity(controllerActivity); I am getting java.lang.NullPointerException
The controllerActivity variable at the stage contains a valid value of Intent { act=android.intent.action.Main }
Thread thr_authenticateUser = new Thread(new Runnable() {
#Override
public void run() {
…
Boolean _authenticationStatus = Boolean.valueOf(authenticationReplyValue);
if (_authenticationStatus) {
Intent controllerActivity = new Intent("android.intent.action.Main");
startActivity(controllerActivity); //NullPointerException
}
}
});
thr_authenticateUser.start();
Over further findings I found out that the exact place where it is failing is inside Main activitY’s `onCreate()
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
setContentView(R.layout.main_view); // HERE: java.lang.NullPointerException
However the view name main_view is correct and it exists.
Manifest:
<activity
android:name=".Main"
android:label="#string/app_name"
android:launchMode="singleInstance"
android:windowSoftInputMode="adjustPan" >
<intent-filter>
<action android:name="android.intent.action.Main" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Compelte stack trace:
java.lang.NullPointerException
at android.app.Activity.startActivityForResult(Activity.java:3370)
at android.app.Activity.startActivityForResult(Activity.java:3331)
at android.app.Activity.startActivity(Activity.java:3566)
at android.app.Activity.startActivity(Activity.java:3534)
at com.citypulse.citypulse.User$1.run(User.java:57)
at java.lang.Thread.run(Thread.java:856)
Get the context to start your activity
getBaseContext().startActivity(controlledActivity);
or
YourActivity.this.startActivity(controlledActivity);