Custom share modal for sharing into Android app - android

How do you create a custom modal layout for sharing data into an application? For example, if you are on a page in Chrome and try and share into Facebook, the Facebook share modal pops up and lets you edit the data that gets passed into Facebook. The Android docs only cover the simple use case of launching an activity within the application and passing in the data. However, I don't want to launch the activity; I want this to be a separate modal altogether that just functions as an overlaid form and sends it to a backend much like Facebook's share function.

However, I don't want to launch the activity
Sharing is only done via activities.
I want this to be a separate modal altogether that just functions as an overlaid form and sends it to a backend much like Facebook's share function.
Then create a separate dialog-themed activity that has your ACTION_SEND <intent-filter>. That dialog-themed activity can collect information from the user, then forward that along to whatever inside of your app.

Related

Is it possible for a Flutter for Android activity to NOT be fullscreen? Or have no UI at all?

I'm building a somewhat basic app (only testing on Android for now) with multiple lists, one of which is an Inbox list. I can share text from other apps to my app, and it works well.
However, I would like the app to handle the intent without launching the full app UI. For example, if I share a URL from the browser to my app, I would like it to be handled in the background, save the URL to Firestore, and show a toast to the user indicating that it was successful.
Ideally, I would like to put two entries in the share menu, one to add to the Inbox and show a toast as described above, and a second entry that gives the user a modal dialog that floats above the sharing-from app, which allows the user to choose a different list to save to.
I think I'll have to make a (for example) ShareActivity.java, and add it to AndroidManifest.xml, but I have no idea where to go after that, or even if that's the right approach.

Get share content through accessibility in android app

I have an android app, which lets people share content from other apps to it. When it receives the shared data, it looks for the URL in the shared text and fetches the page and does processing on the data fetched. This is designed with specific purpose and not a generic for all apps.
It works fine, except that people have to click the share icon and then choose our app name. With accessibility we can reduce this work for the users. We are able to get the text displayed in the app.
Is it possible to get the content which we would get if we were to click the share button.
Or
Is it possible to trigger the share button and choose our app without disturbing the user in anyway
You could try that if it's only for 1 specific app. See question How to click button in settings using AccessibilityService? which clicks a button. This will not scale if you want to do this for more apps. You could however parse the text that is on the screen and look for http links and process them in a background service and then show a floating button like Link Bubble Browser
You can simply trigger the share activity of your app when you detect the text from the other app; but the question is how will you know when user is done typing the text?!
One way is you can place a system-wide floating button similar to Facebook Messenger and after user clicks it, the text can be shared. This will reduce number of clicks user has to do.
So,
1) Yes, its possible to get text content via AccessibilityService.
2) No, you cannot automate this action.

Send image to another application

I want to know if that is a way in the moment i take a picture, send it in background to other app, like a vault, keepsafe or appprotector?
Without the user has to go to gallery and click in share with others apps above . I would like that was automatic, without use "app chooser".
You would need to ask the authors of your proposed "vault, keepsafe or approtector" if they support some custom API for this. There are no conventions in Android for sending content to another app in the background. In the foreground, you are welcome to use ACTION_SEND, or ShareActionProvider, etc.

How to Dynamically Update Fragment (SlidingMenu) When View Created

I have application that uses the SlidingMenu library. It' is essentially a Fragment in the main Activity that goes in and out of view when user swypes (e.g Youtube, Google+, Facebook).
The top LinearLayout in this SlidingMenu has some Dynamic information in it. Such as Login and other info that changes as the users interacts within the app.
One example: The user opens app, that layout in SlidingMenu says "Log in". They go into overflow menu, start Login Activity (over MainFragmentActivity), signs in successfully, and Login Activity dissapears. Next time they swipe the menu open, they should see their user name, profile stats, profile picture, etc.
My question: How do I dynamically change this layout without using a refresh button?
Does this include using:
onCreateView() method in the fragment?
Note: Currently, it only updates when app starts. It starts an AsynTask to download things from MySQL. It seems like a waste of resources to hit the DB everytime user opens the panel, is there a more efficient way of using this?
You'll want to cache the content on the phone itself (probably in sqlite), you'll want check for new remote content at intervals when your application is in the foreground, and/or perhaps even use something like Google Cloud Messaging to ping your application in case the data needs to be refreshed rapidly -- but irregularly (like you would have to do with a chat application or a twitter client).
As Stephan mentioned, you can cache the data in SQLite, on top of that, you can use contentProvider, to return you a Cursor on the data stored such as login name.
Now the benefit here is that when the user logs in, you can call update in contentProvider, updating the value, and then call contentResolver.NotifyChange which will update the result in the cursor, in turn automatically update what is in the slidingMenu.

Set default browser from within app

I'm developing an app that we will put on Android tablets on be used by employees in the field. We want to lock down internet access as much as possible to minimize data usage (so that the employees can't go streaming Netflix movies or something and driving up our data usage). As part of that effort, I'd like to have http(s)?:// links open up in a custom activity I made. Now, I can easily do that by registering the activity with an intent filter on the http/https schemas, but I'd prefer not to have the user have to choose between browsers when opening a link, and I don't want my activity to become the default activity for every link (there may be situations in which the user should be using the Android browser).
Is there a way to set up my activity as the http handler...but only for links launched from my app?
Is there a way to set up my activity as the http handler...but only for links launched from my app?
If the links are from your app, just use startActivity() with an Intent identifying your activity, rather than some generic Intent like ACTION_VIEW.
If your issue is that you are displaying the Web content in a WebView and links clicked there lead to the browser, use setWebViewClient() along with a WebViewClient implementation that handles shouldOverrideUrlLoading().

Categories

Resources