• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

android app to send image via email fails with file not found or permissions

I am creating an android app to send an email with attached image. The mail arrives with no attachment. I have tried three ways to create the file. and three ways to send. the code returns exception "filenotfound" or some permission error. Below is an extraction of the code.
manifest has:
<code>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

private File storeImage(Bitmap image) {
File pic = new File("picdefulet.png");
String filename = "pic.png";
try {
switch (1) {
case 1:
pic = new
File(Environment.getExternalStorageDirectory(),
filename);
break;
case 2:
try {
File dirFile = getCacheDir();
boolean result = dirFile.mkdir();
pic = new File(getCacheDir(), filename);
} catch( Exception e){
Log.e("BROKEN", e.getMessage());
}
break;
case 3:
pic = new File(filename);
break;
}
try {
FileOutputStream out = new FileOutputStream(pic);
boolean result = image.compress(Bitmap.CompressFormat.PNG, 100, out);
out.flush();
out.close();
} catch( Exception e){
Log.e("BROKEN", e.getMessage());
}
}
catch (Exception e) {
Log.e("BROKEN", e.getMessage());
}
return pic;
} // end storeImage
String msgtext = "#22 Please warn/fine/terminate the user \\n\\n";
Bitmap photo = (Bitmap) data.getExtras().get("data");
File fileThing = storeImage(photo);

Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setType("multipart/alternative;");
String[] recipient = new String[2];
recipient[0] = "roySpin@royweil.com";
recipient[1] = "roysoin2@royweil.com";
emailIntent.putExtra(Intent.EXTRA_EMAIL,recipient); // recipients
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Scooter Illegaly Parked");
emailIntent.putExtra(Intent.EXTRA_TEXT, msgtext);
if (!fileThing.getPath().isEmpty()) {
switch (1) {
case 1:
Uri pngUri = Uri.parse("file://" + fileThing);
break;
case 2:
Uri pngUri = Uri.fromFile ( fileThing);
break;
case 3:
pngUri = FileProvider.getUriForFile(
getApplicationContext(),
getApplicationContext().getPackageName() + ".provider",
fileThing);
break;
default:
throw new Exception("Invalid case for assigning pngUri");
}
mailIntent.putExtra(Intent.EXTRA_STREAM, pngUri);
gtartActivity(emailIntent);
</code>

All Links Text Display as 'Followed' in Bing Search Results

I have Galaxy Tablet and am using Bing to search in Opera Browser.
All result links color is the followed color. And I do mean all.
It seems to be only when using Bing in Opera.

I would like to continue to use Opera because it has a Night Mode feature
which utilizes a dark background everywhere which I can't find on an other Android browser.



Any ides why this is happening?

James

Incoming Calls

I tried that, but it didn't work. Probably because my phone isn't plugged in when in the car playing music. I already have an app called "no screen off" which is always turned on. But yet, when I recieve a phone call and hang up… still goes to lock screen. If I make the call myself, after the call is ended, the phone doesn't go.to lock screen and returns to regular open screen. However… every once in a while, when I make a call, it will go to lock screen. And having to log back in to control music ir use assistance, while driving is too dangerous. Thanks for the proposes ootiin though. To.me, this feature.is stupid if you wanna remain "hands off" while driving.

Moto G Power (2020) Phone App/Calling Randomly Stops Working

It sounds like you might be expwriencing a type of throttling by Verizon.

As Straight Talk is renting tower space from Verizon, during busy times Verizon will give preferential service to their own customers at the expense of other carriers renting from them.

This issue can be more apparent when Verizon is still using their antiquated (for some time) CDMA cellular system, as it can support less users than the TDMA/GMS system that AT&T (and who rents from them) use.

Help How to fix 'Encryption Unsuccessful' error in LYF wind 6?

Phone model : LYF LS-5009 (wind 6)
Problem : Unable to boot in system due to Encryption Unsuccessful Error

Things i tried to solve this problem : 1) Reset the phone from recovery mode ( wipe all data)
2) Wipe all cache
3) Installed Software again ( firmware flashed)

I saw one more error in recovery mode UI : E: Failed to mount /cache (Invalid argument)
E: Can't mount /cache/recovery/log
E: Can't open /cache/recoveryg

Etc............
I am attaching all the photos of problem here.

Attachments

  • IMG_20211001_094347.jpg
    IMG_20211001_094347.jpg
    311 KB · Views: 399
  • IMG_20211001_094351.png
    IMG_20211001_094351.png
    2.4 MB · Views: 284
  • IMG_20211001_094544.jpg
    IMG_20211001_094544.jpg
    350.6 KB · Views: 376
  • VID_20211001_094417.mp4
    VID_20211001_094417.mp4
    4.8 MB · Views: 299

Help Finding a Lost Phone

Thanks for the replies. I just "spoke" with a Samsung agent using their text chat system and was told that if I registered my Google account before I registered my Samsung account when I first set up my phone (2½ years ago!) that I'd need to use the Google app rather than the Samsung app. But I could "fix" this if I deleted my Google account. Fat chance of that happening! So guess I'll be using Find My Device, although it wasn't already on my phone. I just downloaded it from the Play Store.

You could delete the Google account from the device, set up the Samsung Find My Mobile, and then re-add the Google account.

You are only removing the Google account from the device, not deleting anything in the account or the account itself.
(You can have the same Google account on many different devices at the same time, or not.)

Even if none of your devices have the account on them, the account still exists- unless you actually delete the account from Google.
(Even then, it is dubious if they actually delete your info from themselves...)

This means that you can shed the account from any device, and then put it back on whenever you choose.

Firebase authentication succeeds and yet doesn't work

Hello, I've ran into this problem today and it drives me nuts, any help would be appreciated.

I'm using Firebase authentication with email and password, the user is created and appears in the Firebase console, but FirebaseAuth.getCurrentUser() as well as task.getResult().getUser() returns some Default user and not the one just created.

I've checked the currentUser immediately after registering a new user, after registering and moving to a different fragment, after putting the app in the background, after killing and restarting the app, after using firebase sign in method...

Everything seemingly works otherswise, the firebase methods (sign in and register with email and password) result success and as I said the user shows up on the firebase console.

I tried deleting the Firebase project and creating a new on for the app, it didn't help.

There's nothing in the logcat whatsoever that indicates something is going wrong in the process. The only firebase related logs I see after registering\logging in are:
2021-10-01 18:48:44.409 11933-11977/com.app.app D/FirebaseAuth: Notifying id token listeners about user ( Ap5hU8qtQdcTdO4KwQbqA3xxrvV2).
2021-10-01 18:48:44.410 11933-11977/com.app.app D/FirebaseAuth:Notifying auth state listeners about user (Ap5hU8qtQdcTdO4KwQbqA3xxrvV2 ).

Loose micro USB socket

Not very relevant, but I had a port problem over some months with a Nokia 7 Plus, where I had to hold or prop the cable and USB C plug at an increasingly critical angle to get it to charge.

Turns out, after a search, this was a common problem for this and 1 or 2 other models because the metal of the port was sub standard and prone to warping or expanding.

Within the 2 year warranty Nokia were terrific and arranged DHL to collect and deliver to Hungary! from London. Overall about 7 days, but necessitating a cheap phone purchase which I struggled to afford at the time.

They replaced a whole charging board, which sits across / attaches to the bottom of the main motherboard. It also came back with a few other features so they must have flashed the whole thing.

aar api

Hi, I got a .aar with java to create my app.
The documentation says
"
This is the base class for apps that which to interface with running instances of XXX to consumer its API. The overriding class will be executed as a remote service, on which hooks will be called by the plugin host. As it is a service, the class needs to be exposed in the AndroidManifest.xml as a service with export set to true.
"

Is it possible for a second app to call the methods of the app that contains this class?
How can i expose the class in the manifest? thanks all.

Nexus 10 Auto Power-off

Hi,

I hope someone can help. I recently had to replace the battery in my Nexus 10. I followed a YouTube video and successfully replaced the battery, charged it up and switch on the Nexus 10, OK so far.

Trouble is, the system auto powered-odd when the battery was still at about 65%. It only took around 3 hours to fully recharge, and the same thing happened again, at about 65%.

Does any know how or where the level at which the system auto powers-off can be reset to a lower value. The "settings" pages are of no help, and neither is the manual. Any help would be appreciated.

Regards,

Mike042

Hmmm...

I get the security massively of protecting my mug and others around me, but almost every time I live stream on FB, makes my entire house distorted in pixels, could be my wide screen monitor hahaaa :) Makes everything super huge :) So just wondering if there was a way how to expand on the pixels...

Filter

Back
Top Bottom