Android launch application with custom credentials - android

I try to explain what I mean: as asked and replyied here you can launch an application from your own.
The problem is the following: I don't need only to run an application from mine, but I also need to run it with different credentials from the same application installed in my phone, so I need to run it with a different account.
For example:
With my application I want to run Facebook. Fine, I run my code by starting an intent with fb package name.
My problem is that I don't want to run facebook and find myself logged with my profile(the one logged in my phone) but I want facebook to be run as if it was a new and clear installation (it must prompt me for login with my credentials) and this must not remove my credential from my application in my home screen.
It's like creating another user on your phone and using an app on both users. The difference is that I want to do it with my app instead of with another user.
Probably my explaination is not perfect, I tried my best but it's hard to explain what I'm looking for. I know it is possible because this application does it, but I can't figure out how.
Thanks all for the help!

Related

User sign-up process

For my app, users are invited by email to join.
Currently, the link in the email is opening the web-browser to a page where the user creates his password. Then, the user has to install the app, open the app, and log in with his email and the password he created.
I am trying to make the process easier. I am thinking that in the invitation email, the link can point to "an app link". I know iOS has "Universal Links". The app will most probably not be installed, so on iOS, it will open the App Store app to install the app.
I am thinking to create the registration process in the app. But the issue is after the user installs and opens the app, the "app link" is lost.
The "App Store" app does not pass the original link to the app when the user opens the app first time after install.
Without the information from the link, I am not able to know in the app the email for which the user needs to create the password. I could ask the user for email also, but I was hoping not having to ask him about that.
I guess it's the same for Android.
Any thoughts how to make sign-up process easier?
EDIT: I chose a correct answer but to anybody who might be looking for an answer, I don't think Firebase or anyone else has a 100% reliable way of making a connection between the device where the link was clicked and the device where the app is installed. All the libraries are using some accuracy value and asks you to check it in code. If you think about it, it makes sense, because when the link is clicked and gets open (and that can be in any web-browser app) the JS code needs to compute some hash of the device and it will try to compare it to the hash of the device computed by the app's code when app is open after install.
You can use Firebase Dynamic Links to achieve this.
Please refer Firebase Dynamic Links
i think you have to use Webview for this
You can do this with Appsflyer SDK.
Checkout the documentation https://www.appsflyer.com/blog/app-installation-referral-conversion-tracking/

Writing tests for an Android app that logs into Facebook

My Android app uses FacebookSDK for login. It's the first screen, and you can't do anything unless you login.
I want to write some Espresso tests to be ran on Greenhouse Continuous integration server.
I searched and I found FBSDKTestUsersManager on iOS, but nothing similar on Android.
What I plan to do is create a flavor of test and when that flavor is selected instead of a normal Facebook login button, I'd display a button that gets a test access token for the user, then brings them to the homepage of the app. However, I can't do that cause FBSDKTestUsersManager doesn't exist on Android.
Any suggestions?
The solution is to involve UIAutomator in your tests together with Espresso for Android. It will be possible to go outside of your app under test context and perform some actions on Facebook login dialog. Similar question here and the example in my blog post.

how to test Facebook Login for my mobile app

I am adding Facebook login to my app so to get permission to post photos for users. Having created the code, I now want to test that it works. So naturally I am using my own Facebook again to see that the system works. The first time I went through, I found some stuff I didn't like. So I made the changes. Now that I want to test again using my Facebook again, when I login, Facebook keeps telling me that I already gave the app permission. I tried uninstalling the app and then re-install, just in case it was caching locally. But that didn't help. So my question is: how do I get to reuse my account to login and request the permissions again? I hope the question is clear. If not, please ask for clarification.
I am experiencing this problem with android. But I am guessing it's similar for iOS, so I use both tags.
Open the following page in your browser: https://www.facebook.com/settings?tab=applications
Your App should be in that list, just remove it to test the authorization again.

One facebook app for multiple android apps

i know this question looks like been asked several times.
But there aint a clarity of answer .
Share a Facebook app ID across apps Android
My requirement is i already have a app with the bundle id [com.mycompanyname.app1]
Im going to push a lite version of the same app by the name com.mycompanyname.app2]
I already have a facebook app for app1.
i don want to create another fb app for app2 as it would divide the user access.
If this is doable let me know how i can do it ?
Thank you guys
Actually, it's very simple. You just need to use the same keys and credentials that you used for your first android app in your next app. It will work. When you go to Firebase settings, you can see that you can add another android app, but authentication settings are common for both your apps. So you do not need to change anything. As mentioned in comment, app package that you specify in Facebook console, is used only for deep linking. It does not matter for authentication.

More advanced android facebook example

I'm having some problems with facebook integration on my android app. I've looked at the examples that come with the api and i can do the things shown in those ok. But i'm having problems with other things such as getting single sign on to work properly, authentication across multiple activities in the app and loading a facebook page (non-api call) without being asked to log in again.
Anyone have examples that show these?
When making API calls, you usually need to include the access_token parameter that was issued when the user authenticated. This is how facebook knows who you are when you make requests.
Similarly, when loading facebook pages (not using the API), you have to remember to send the cookies Facebook sent when the user logged in. Normally the browser keeps track of these automatically, but in your program or app you might have to handle them manually.
I don't have experience with Android specifically, and I don't know what you're using to load and render facebook pages, but knowing how facebook is keeping track of logged-in users should give you an idea of where to start. A google search or two should get you on your way.
Go to facebook.java class and change package name com.facebook.katana to com.facebook.katanaaa or any one of your own choice. This worked for me .

Categories

Resources