I am trying to implement a share button in my android app which shares one image from the app to any other app of users choice. When I click on the share button , I get a dialog saying "No apps can perform this action". I am getting my image using Picasso from a uri stored in Realtime Firebase.TIA
This is my code snippet:
share.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Intent shareIntent = new Intent();
shareIntent.setPackage("com.package");
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
shareIntent.setType("image/*");
startActivity(Intent.createChooser(shareIntent, "Share"));
}
});
Update:
I removed the line : shareIntent.setPackage("com.package");
And now it shows me the list of apps. But when i try to share the image usng whatsapp it says file format not supported.
Related
My app has many types of ads (banner, transitions, rewarded video etc) in it. I have developed my app with Android Studio.
I test them all ads with test IDs as Google says.
After being confident that ads are working, I have changed test IDs to real IDs.
When I run the app on a phone physiacally connected to my PC, the ads are not shown. Some documents say that "real unitIDs never work unless the app is downloaded from Play Store source". That means I have to upload my app to Play Console each time to test real IDs.
But, loading the app to Play Console for test puprpose is not applicable because;
It takes long time to come alive (review period)
If I even accept to wait for that review period, when the app become alive, the users may download the bugy app because it is for test purpose and not a confident version.
You may say, if the app works with test IDs then it will work with real IDs bu it is not true.
Because my app works well with test IDs. When I switch to real IDs, banners keeps working but rewarded video ads doesn't.
My admob account and all adUnits seems ok. This is not an issue about my adMob account.
So the question is that, is there a way to test my app with admob's real unitIDs without uploading the app to Play Console and download it from Play Store?
Thanks,
Yes, you can test your Live Ids.
put this block of code in your splash activity (first activity), run your app you will get something like this in log, test_id replace this in your code...
I/Ads: Use RequestConfiguration.Builder.setTestDeviceIds(Arrays.asList("test_id"))
List<String> testDeviceIds = Arrays.asList("test_id");
RequestConfiguration configuration =
new RequestConfiguration.Builder().setTestDeviceIds(testDeviceIds).build();
MobileAds.setRequestConfiguration(configuration);
ref:
https://developers.google.com/admob/android/test-ads
for Rewareded interstial ads try this code:
make your class... implements OnUserEarnedRewardListener.
if anything goes wrong you will get error message in onAdFailedToLoad, using loadAdError.getMessage();
private RewardedInterstitialAd rewardedInterstitialAd;
#Override
public void onUserEarnedReward(#NonNull RewardItem rewardItem) {
Log.i(TAG, "onUserEarnedReward");
// TODO: Reward the user!
}
public void loadRewardedAd() {
// Use the test ad unit ID to load an ad.
RewardedInterstitialAd.load(MainActivity.this, getString(R.string.rewarded_interstitial_id),
new AdRequest.Builder().build(), new RewardedInterstitialAdLoadCallback() {
#Override
public void onAdLoaded(RewardedInterstitialAd ad) {
rewardedInterstitialAd = ad;
rewardedInterstitialAd.setFullScreenContentCallback(new FullScreenContentCallback() {
/** Called when the ad failed to show full screen content. */
#Override
public void onAdFailedToShowFullScreenContent(AdError adError) {
Log.i(TAG, "onAdFailedToShowFullScreenContent");
}
/** Called when ad showed the full screen content. */
#Override
public void onAdShowedFullScreenContent() {
Log.i(TAG, "onAdShowedFullScreenContent");
}
/** Called when full screen content is dismissed. */
#Override
public void onAdDismissedFullScreenContent() {
Log.i(TAG, "onAdDismissedFullScreenContent");
}
});
}
#Override
public void onAdFailedToLoad(LoadAdError loadAdError) {
Log.e(TAG, "onAdFailedToLoad");
}
});
}
I am developing an app for radio streaming using exoplayer library. So, I want to clear(delete) exoplayer notification bar (with play/stop buttons) when I close the app(from recent apps e.t.c). Now, I close the app but the notification bar still appears and doesn't close with swipe left/right.
I tried the following source code but it doesn't work (i tried to run the lines of the source code separately from the methods but I can't solve the problem).
public class RadioService extends Service {
......
.......
......
public void onTaskRemoved(Intent rootIntent) {
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.cancel(NOTIFICATION_ID);
stopForeground(true);
notificationManager.cancelAll();
}
public void onDestroy() {
super.onDestroy();
stopForeground(true);
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.cancel(NOTIFICATION_ID);
}
}
I declared it in AndroidManifest.xml too.
Any help please?
Check this answer How to kill a foreground service along with the application and an example
https://androidwave.com/foreground-service-android-example/
at android 8 and above you have to use foreground service.
Add a small delay after the clear of notification and before killing the app or create a function that will inform you the notification is cleared
I have developed a windows phone 8 application. Now I want to display vserv ads to my application.
I have added the sdk to my application and also applied code to show ads:
public MainPage()
{
InitializeComponent();
VservAdControl VMB = VservAdControl.Instance;
VMB.DisplayAd(zoneID, LayoutRoot);
VMB.VservAdClosed += new EventHandler(VACCallback_OnVservAdClosing);
VMB.VservAdNoFill += new EventHandler(VACCallback_OnVservAdNoFill);
}
void VACCallback_OnVservAdClosing(object sender, EventArgs e)
{
MessageBox.Show("Ad close by user.");
}
void VACCallback_OnVservAdNoFill(object sender, EventArgs e)
{
if (adGrid != null)
adGrid.Visibility = Visibility.Collapsed;
}
But after closing the ad the application page goes blank, all content, application bar automatically goes blank. After using back arrow that quits my application, i try to relaunch my application but application stuck at the splash screen on the emulator.
Wrap ad control inside a grid. Ad control could have manipulated the grid
I encountered the same issue and they have updated their SDK several times. If you provide the stacktrace they will provide you a fix.
Apart from what you have seen, there are other issues with the SDK. I integrated it few weeks back. So issues could have been resolved after that.
Memory leak. Click the ad or navigate back and forth - you will see the memory ever growing. This is because of events not being detached (withing SDK). I was consistently able to see my app crash in 512 MB emulator when banner ad is loaded (after 4 - 5 times). They could have used weak listeners. You might need to tweak a lot to overcome this issue (In multi page app)
RequestAdCallback throws null pointer exception sometimes crashing
the app. When people use app, they will navigate fast - forcing the
webbrowser to unload. All callbacks should be null pointer exception
free. Make sure that you handle unhandled exception globally otherwise app will not pass certification
It reads WMAppManifest.xml as text not as XML. So I had App element commented in first line before the actual one. It picked title from commented XML element
Application bar is manipulated in many events in the SDK. So you have to make sure that app bar is built dynamically. Test all navigation paths.
SDK assumes user will click the left arrow button which fires ad closing event. Try pressing phone back button instead. The app bar still disappears
SDK documentation requests app to demand ID_CAP_REMOVABLE_STORAGE capability. I don't see a reason to request this capability but I didn't add this
I have emailed them all these details. May be their latest SDK could have resolved these issues. But please do thorough testing after integration.
Add a function to load applicationbar using code
private void BuildLocalizedApplicationBar()
{
// Set the page's ApplicationBar to a new instance of ApplicationBar.
ApplicationBar = new ApplicationBar();
ApplicationBar.Mode = ApplicationBarMode.Default;
ApplicationBar.Opacity = 1.0;
ApplicationBar.IsVisible = true;
ApplicationBar.IsMenuEnabled = false;
// Create a new button and set the text value to the localized string from AppResources.
ApplicationBarIconButton button1 = new ApplicationBarIconButton();
button1.IconUri = new Uri("/Images/sms.png", UriKind.Relative);
button1.Text = "sms";
ApplicationBar.Buttons.Add(button1);
}
and then in VACCallback_OnVservAdClosing event handler call the function
BuildLocalizedApplicationBar()
Please check the following link,
where to add application id and adUnitiD while integrating vserv ads sdk to windows phone 8 application, which is related to your question.
i try to open web browser apk, open one web page.
is it possible to ZOOM IN/OUT of this web page using robotium ?
and i try to open one docx file using open Office apk automation using robotium.
is it possible to ZOOM IN/OUT for this document page using robotium ?
Any one have solution then please help me.
As far i know there is no functionality like that in Robotium.
For a web page you can use the zoomIn() method of a webview that you have gotten a reference to using any number of the ways you can with robotium.
To be able to use this method you will have to cast the view you got from robotium to a WebView and to perform the zoom you will have to run on the uithread. The code would look something like:
final WebView webView = (WebView) Solo.getView(R.id.web_views_id);
instrumentation.runOnMainSync(new Runnable() {
#Override
public void run() {
webView.zoomIn()
}
});
can anyone tell me what are the ways to handle the postbacks in MVC4 Razor for Mobile.
I am new to MVC Development. I searched a lot but couldn't find any example that could run on my project.
Any helpful link will also be apprieciated.
Code in Controller:
//[HttpGet]
public ActionResult TestView()
{
return View();
}
[HttpPost]
public ActionResult TestView(string action, UserSelection objSelection)
{
if (!string.IsNullOrEmpty(action))
{
}
return View();
}
Edit:
In View : I have added two button with tag : Input having name=action, but different values.
When I click these button I get the "Error Loadin page" message.
Sorry: couldn't load the code due to Filter settings here.
The solution was I created the new project and merged the code in new project & bingo It worked.
But I couldn't findout the reason for that behaviour of first project.
But anyway my project has started handling the post-backs.