[android-developers] Service dies when no internet connectivity
Hi all, I have developed an app which steams music live in a service. The service is started with an intent from the activity. It works fine. Basically, I am using media player object, which plays music in the service (which I started with intent). But when I was driving thru some remote hilly area, where there is no internet connectivity, the service stopped playing music. When I checked later, the service has stopped. What is the concept behind this ? What can be the best/established way of handling this situation ? Thanks in advance -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[android-developers] Re: Image is being oriented differently once uploaded to server, why?
I think it's a stack effect over ftp client ...See the first answer of Matt Gibson , from your link tutorial ... - Found at this link: http://stackoverflow.com/questions/24629584/image-orientation-changes-while-uploading-image-to-server ... http://www.google.com/url?q=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F24629584%2Fimage-orientation-changes-while-uploading-image-to-serversa=Dsntz=1usg=AFQjCNH6Q3idbwXFE30Hv7wZ5pJ6YRX_hg http://www.google.com/url?q=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F24629584%2Fimage-orientation-changes-while-uploading-image-to-serversa=Dsntz=1usg=AFQjCNH6Q3idbwXFE30Hv7wZ5pJ6YRX_hg also you need to set the property of image, also will be set by default - and size . On Sunday, April 12, 2015 at 8:00:41 AM UTC+3, Dan Cha wrote: So within my app, i have the ability to allow the user to take a pic, see a thumbnail within the app and once the form is submitted, its uploaded to the server. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [android-developers] Re: Where in code would i resize an image taken using intent?
Daniel, In my case, the large image is read from storage resized then saved to storage. Dave Truby On Apr 12, 2015 12:37 AM, Daniel Chacon cuban...@gmail.com wrote: So what you are doing is resizing before or after being saved or uploaded? On Sat, Apr 11, 2015 at 6:59 AM, Dave Truby detr...@gmail.com wrote: Dan, I am doing the following in my Over Time app. Maybe it helps you. File aThumbnail = new File(pDir, TbsFile.THUMBNAIL_FILENAME); final float aRatio = (float) pPictureWidth / (float) pPictureHeight; final int aThumbnailWidth = Math.round(pThumbnailHeight * aRatio); final BitmapFactory.Options anOptions = new BitmapFactory.Options(); anOptions.inJustDecodeBounds = false; anOptions.inSampleSize = this.calculateInSampleSize(pPictureWidth, pPictureHeight, aThumbnailWidth, pThumbnailHeight); Bitmap aBitmap = BitmapFactory.decodeFile(pImageToMakeThumbnail.getAbsolutePath(), anOptions); Bitmap aScaledBitmap = Bitmap.createScaledBitmap(aBitmap, aThumbnailWidth, pThumbnailHeight, true); this.saveThumbnail(pContext, aThumbnail, aScaledBitmap); aScaledBitmap.recycle(); } private int calculateInSampleSize(final int pPictureWidth, final int pPictureHeight, final int pThumbnailWidth, final int pThumbnailHeight) { int aInSampleSize = 1; if (pPictureHeight pThumbnailHeight || pPictureWidth pThumbnailWidth) { final int aHeightRatio = Math.round((float) pPictureHeight / (float) pThumbnailHeight); final int aWidthRatio = Math.round((float) pPictureWidth / (float) pThumbnailWidth); aInSampleSize = aHeightRatio aWidthRatio ? aHeightRatio : aWidthRatio; } return aInSampleSize; } private void saveThumbnail(final Context pContext, final File pThumbnail, final Bitmap pScaledBitmap) { boolean isCreated = false; FileOutputStream anOutputStream = null; try { anOutputStream = new FileOutputStream(pThumbnail); pScaledBitmap.compress(Bitmap.CompressFormat.JPEG, TbsCreateThumbnailAsyncTask.JPEG_COMPRESSION, anOutputStream); isCreated = true; } catch (IOException anIoEx) { this.error(saveThumbnail(), anIoEx); } catch (Exception anEx) { this.error(saveThumbnail(), anEx); } finally { if (null != anOutputStream) { try { anOutputStream.close(); } catch (IOException e) { // nothing } } if (isCreated) { MediaScannerConnection.scanFile(pContext, new String[] { pThumbnail.getAbsolutePath() }, null, new MediaScannerConnection.OnScanCompletedListener() { @Override public void onScanCompleted(final String pPath, final Uri pUri) { TbsCreateThumbnailAsyncTask.this.info(onScanCompleted(), Scanned thumbnail + pPath + TbsLog.PERIOD); } }); } } } On Friday, April 10, 2015 at 5:27:42 PM UTC-4, Dan Cha wrote: So ive been reading a few posts some using Bitmap.createScaledBitmap, some using .compress feature and each one i try, never throws an exception or error, but file never gets resized. I found this routine, but it doesnt do anything as far as the image taken. So basically within my app i allow the user to take a pic to attach to the submission. When you take the image, it displays a thumbnail on the screen, at this point the image is already saved to the phones gallery. I need to resize it (without changing the proportions) to make sure that the image is no larger than 200px wide or high because once you submit the form, im uploading the image to our server. public Bitmap getResizedBitmap(Bitmap bm, int newWidth, int newHeight) { int width = bm.getWidth(); int height = bm.getHeight(); float scaleWidth = ((float) newWidth) / width; float scaleHeight = ((float) newHeight) / height; // CREATE A MATRIX FOR THE MANIPULATION Matrix matrix = new Matrix(); // RESIZE THE BIT MAP matrix.postScale(scaleWidth, scaleHeight); // RECREATE THE NEW BITMAP Bitmap resizedBitmap = Bitmap.createBitmap(bm, 0, 0, width, height, matrix, false); return resizedBitmap;} When the user clicks the image button on the screen, the camera opens and allows them to take the pic, ive tried to call the above routine within this event after everything so that i know the file is created and exists. Here is the event for that: private ImageButton.OnClickListener takePicture_Button_listener = new ImageButton.OnClickListener() { public void onClick(View v) { StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() .detectDiskReads() .detectDiskWrites() .detectNetwork() .penaltyLog() .build()); // create Intent to take a picture and return control to the calling application Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); //User fileUri for full path to image taken. fileUri =
Re: [android-developers] Re: Image is being oriented differently once uploaded to server, why?
Yea that i had found and attempted to implement within my existing code, but everything works fine within the phone/device, but not when uploaded. int rotate = 0; try { BitmapFactory.Options options = new BitmapFactory.Options(); options.inSampleSize = 10; getContentResolver().notifyChange(fileUri, null); File imageFile = new File(fileUri.getPath()); ExifInterface exif = new ExifInterface(imageFile.getAbsolutePath()); int orientation = exif.getAttributeInt( ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); switch (orientation) { case ExifInterface.ORIENTATION_ROTATE_270: rotate = 270; break; case ExifInterface.ORIENTATION_ROTATE_180: rotate = 180; break; case ExifInterface.ORIENTATION_ROTATE_90: rotate = 90; break; } final Bitmap bitmap = BitmapFactory.decodeFile(fileUri.getPath(),options); Matrix matrix = new Matrix(); matrix.postRotate(rotate); Bitmap rotImage = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix,true); imgThumb.setImageBitmap(rotImage); } catch (Exception e) { e.printStackTrace(); } On Mon, Apr 13, 2015 at 1:21 AM, catafest catalinf...@gmail.com wrote: I think it's a stack effect over ftp client ...See the first answer of Matt Gibson , from your link tutorial ... - Found at this link: http://stackoverflow.com/questions/24629584/image- orientation-changes-while-uploading-image-to-server ... http://www.google.com/url?q=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F24629584%2Fimage-orientation-changes-while-uploading-image-to-serversa=Dsntz=1usg=AFQjCNH6Q3idbwXFE30Hv7wZ5pJ6YRX_hg http://www.google.com/url?q=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F24629584%2Fimage-orientation-changes-while-uploading-image-to-serversa=Dsntz=1usg=AFQjCNH6Q3idbwXFE30Hv7wZ5pJ6YRX_hg also you need to set the property of image, also will be set by default - and size . On Sunday, April 12, 2015 at 8:00:41 AM UTC+3, Dan Cha wrote: So within my app, i have the ability to allow the user to take a pic, see a thumbnail within the app and once the form is submitted, its uploaded to the server. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [android-developers] Trying to better understand how to add menu's to the pages within my app
It also seemed like you have dialogs and that from those dialogs you want to be able to navigate to the other screens in the app. If I read that correctly, please don't do that. :-) On Thu, Apr 9, 2015 at 9:35 PM TreKing treking...@gmail.com wrote: On Wed, Apr 8, 2015 at 4:07 PM, Daniel Chacon cuban...@gmail.com wrote: Looking at the Up vs. Back portion within the dev section that was provided, it seems back is the way, but having the ability to jump right back would be great You probably want a NavigationDrawer https://developer.android.com/design/patterns/navigation-drawer.html instead of a menu with dropdown items. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.