Permalink
Browse files

use MediaScannerConnection istead of sendBroadcast

  • Loading branch information...
phunehehe committed Feb 23, 2014
1 parent d87ce32 commit 9b93001648eb8e486653cd47e95577c3393c6ebc
@@ -0,0 +1,9 @@
<component name="libraryTable">
<library name="protocol-1.0.4">
<CLASSES>
<root url="jar://$PROJECT_DIR$/fooCam/lib/protocol-1.0.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
@@ -0,0 +1,9 @@
<component name="libraryTable">
<library name="sentry-0.1.4">
<CLASSES>
<root url="jar://$PROJECT_DIR$/fooCam/lib/sentry-0.1.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
View
@@ -70,28 +70,8 @@
<orderEntry type="jdk" jdkName="Android API 18 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="support-v4-18.0.0" level="project" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/protocol-1.0.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MODULE_DIR$/lib/protocol-1.0.4.jar!/" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/sentry-0.1.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MODULE_DIR$/lib/sentry-0.1.4.jar!/" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="library" exported="" name="sentry-0.1.4" level="project" />
<orderEntry type="library" exported="" name="protocol-1.0.4" level="project" />
</component>
</module>
@@ -1,10 +1,9 @@
package net.phunehehe.foocam;
import android.app.Activity;
import android.content.Intent;
import android.hardware.Camera;
import android.hardware.Camera.PictureCallback;
import android.net.Uri;
import android.media.MediaScannerConnection;
import android.os.Bundle;
import android.os.Environment;
import android.view.Display;
@@ -145,7 +144,7 @@ public void onPictureTaken(byte[] data, Camera camera) {
FileOutputStream fos = new FileOutputStream(pictureFile);
fos.write(data);
fos.close();
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.fromFile(pictureFile)));
MediaScannerConnection.scanFile(this, new String[]{pictureFile.toString()}, null, null);
} catch (IOException e) {
Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
}

3 comments on commit 9b93001

@programmin1

This comment has been minimized.

Show comment
Hide comment
@programmin1

programmin1 Mar 9, 2014

Greetings Hoang Xuan Phu, I was wondering if this is your app on Google Play? https://play.google.com/store/apps/details?id=net.phunehehe.foocam

The id is the same as your app.

programmin1 replied Mar 9, 2014

Greetings Hoang Xuan Phu, I was wondering if this is your app on Google Play? https://play.google.com/store/apps/details?id=net.phunehehe.foocam

The id is the same as your app.

@phunehehe

This comment has been minimized.

Show comment
Hide comment
@phunehehe

phunehehe Mar 9, 2014

Owner

@programmin1 OMG I didn't notice somebody submitted it on Google Play as a non-free app. It's not mine.

Owner

phunehehe replied Mar 9, 2014

@programmin1 OMG I didn't notice somebody submitted it on Google Play as a non-free app. It's not mine.

@phunehehe

This comment has been minimized.

Show comment
Hide comment
@phunehehe

phunehehe Mar 9, 2014

Owner

Thanks for the heads up! I have updated the README to clarify this.
See also https://phunehehe.net/foocam-useful-enough-copied/.

Owner

phunehehe replied Mar 9, 2014

Thanks for the heads up! I have updated the README to clarify this.
See also https://phunehehe.net/foocam-useful-enough-copied/.

Please sign in to comment.