Rectangle 27 3

No actually you wont need to reboot our phone. When you copy an image and paste it to other location your newly copied media file is not added to the android's ContentResolver. So you should scan your data using the class MediaScannerConnection

Eg:

When you paste a file you have the file right ?

Modify as your wish, this works fine

private void scanImage(File targetLocation) {
    // Scans the media to load images
    String mimetype = Utility.getMimeType(targetLocation.getAbsolutePath());
    if(mimetype.contains("image"))
    {
        MediaScannerConnection.scanFile(context, new String[] { targetLocation.getPath() }, new String[] { "image/jpeg" }, this);
    }
}

either you can implement OnScanCompletedListener in your class and add unimplemented method, So you can pass this as callback OR you can use

OnScanCompletedListener listener = new OnScanCompletedListener() {

    @Override
    public void onScanCompleted(String path, Uri uri) {
        // you will get the callback here

    }
};

and pass listener as callback

It says that a callback is required for the MediaScannerConnection.scanFile method

Sorry i have implemented the method in the class itself , updated the code

java - Why does it require a reboot after copy/cutting/pasting a file/...

java android performance
Rectangle 27 2

My suspicion would be that ties are not broken by the app installed first but the app which is run first. In the case where you are manually installing and uninstalling applications you are manually controller the execution order. Then, when you reboot, the execution order is relinquished to Android's launch behavior. It would be easy to test if this occurs alphabetically: build a quick test app name aaa and see if it maintains priority after reboot. If the boot order does not change alphabetically, comment and I'll go work out how launch order is setup.

sorry for the late response. With my research; I've found out a broadcast receiver with the class name, activity name, package name of "aaa" gets overridden by the facebook messenger app much like the original app. And, to prove the concept of installed first being the higher priority; the original app took priority over the test app. However, I'm still facing the problem of the facebook messenger taking highest priority regardless of installation time between the 3 apps.

java - Facebook's "Messenger" has a SMS Broadcast Receiver that takes ...

java android facebook broadcastreceiver
Rectangle 27 3

If the user downloads your app before facebook, then your receiver will take precedence although both have the priority 2147483647. After a reboot, Facebook's receiver takes precedence although both have the same priority and yours was installed before. Therefore, for sure, the trick is in their BootReceiver.

  • As a first step, add a boot receiver with the same priority 2147483647 (although priority has no effect but just add it) to your app. Try to install your app before facebook's app and restart the phone. It might be related to the fact that your process starts before facebook in this case and your sms receiver will start before facebook's.
  • Do the same thing but rename your package name to a.a.a just to have precedence over facebook Alphabetically.
  • In your Boot Receiver, try to add the following code: ComponentName component; component=new ComponentName(this, SmsReceiver.class); getPackageManager().setComponentEnabledSetting(component, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); component = new ComponentName(this, SmsReceiver.class); getPackageManager().setComponentEnabledSetting(component, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);

It might be useful to try to know whether your boot receiver is taking precedence over facebook's boot receiver. I am not sure if that is possible.

Finally, there is the process which can be differentiated in the manifest but am not sure if that can be handy in anyway.

your code snippet disables the receiver. without the disable line, it still doesn't beat facebook's priority... package names don't seem to do it either... :(

java - Facebook's "Messenger" has a SMS Broadcast Receiver that takes ...

java android facebook broadcastreceiver
Rectangle 27 1

This reveals some bug in Android mechanism since the number you think they are putting in the manifest isn't really the number. 2147483647 is really (-1) which is 2^31. Why do you think that it is matter which application installed first?

It matters because before a device reboot, if my app is installed first I can abort the broadcast. If Facebook messenger is installed first, they abort the broadcast (still writing it to the content provider).

2147483647 is the largest signed 4 byte integer (0x7FFFFFFF). Adding one to that gives you 0x80000000 which is the smallest 4 byte signed integer (-2147483648) which is also equivalent to 2^31.

2147483647 is not -1 nor is it 2^31. 2^31 is -2147483648.

java - Facebook's "Messenger" has a SMS Broadcast Receiver that takes ...

java android facebook broadcastreceiver
Rectangle 27 1

  • no need to reboot or log out, Maven picks up the change straight away.

java - JAVA_HOME on OSX with Eclipse and Maven - Stack Overflow

java eclipse osx maven java-home
Rectangle 27 1

  • no need to reboot or log out, Maven picks up the change straight away.

java - JAVA_HOME on OSX with Eclipse and Maven - Stack Overflow

java eclipse osx maven java-home
Rectangle 27 9

You may have another instance of Tomcat already running in the background and using port 8080. Try shutting it down with shutdown.bat, or look for a java process in the Windows Task Manager. You can also reboot if you really want to be sure that there's no other instance running.

Thank you David for the response. I tried shutting down tomcat services. But it did not solve. I changed HTTP port number 8080 to different value. It started working

tomcat7 - Tomcat 7 startup.bat exception - Stack Overflow

tomcat7
Rectangle 27 2

I'm using Ubuntu 14.04 and I was facing a similar error, with the difference I don't have NDK. My solution was, after setting up Java 8 in project definition, reboot Android Studio, no more.

Check system Java version, in console "java -version", output should say something like this

java version "1.8.0_91"

@Maven theoretically you may set STUDIO_SDK variable which will be SDK path to run Android Studio (as said in Studio's config params tools.android.com/tech-docs/configuration). However, in my case I didn't setted that variable and IDE is running as expected.

You are right. I tried different things. It was indeed the problem of 1.8 not linked properly. This solved it stackoverflow.com/a/35935433/2369867. Thanks.

Android N requires the IDE to be running with Java 1.8 or later? - Sta...

android android-studio android-n
Rectangle 27 1

Your problem has two core parts. Can you reboot the phone programatically? Can you write a program to intercept incoming SMS? If you answered YES to both of your question, it is possible to do this.

I am not a Android developer but i think this should be quite possible.

I have no idea whether you can programatically reset the android phone using java... Someone else might answer you about that

EDIT: I guess according to the link Bill has posted, 3rd party applications are not permitted to do a reset

K.. We can't reboot but can we switch off android phone programmatically ??

@Kanika: I honestly do not know whether it is possible as I am not an Android developer :(

sms - How to boot android phone programmatically? - Stack Overflow

android sms reset
Rectangle 27 1

Your problem has two core parts. Can you reboot the phone programatically? Can you write a program to intercept incoming SMS? If you answered YES to both of your question, it is possible to do this.

I am not a Android developer but i think this should be quite possible.

I have no idea whether you can programatically reset the android phone using java... Someone else might answer you about that

EDIT: I guess according to the link Bill has posted, 3rd party applications are not permitted to do a reset

K.. We can't reboot but can we switch off android phone programmatically ??

@Kanika: I honestly do not know whether it is possible as I am not an Android developer :(

sms - How to boot android phone programmatically? - Stack Overflow

android sms reset
Rectangle 27 36

This is actually not an Eclipse-specific issue; it's a general Java-on-Windows issue. It's because of how the JVM allocates memory on Windows; it insists on allocating a contiguous chunk of memory, which often Windows can't provide, even if there are enough separate chunks to satisfy the allocation request. There are utilities that will try to help Windows "defrag" its memory, which would, in theory, help this situation; but I've not really tried them in earnest so can't speak to their effectiveness. One thing that I've heard sometimes that might help is to reboot Windows and, before starting any other apps, launch the Java app that needs the big chunk of memory. If you're lucky, Windows won't have fragmented its memory space yet and Java will get the contiguous block that is asks for.

Somewhere out on the interwebs there are more technical explanations and analyses of this issue, but I don't have any references handy.

In my case, your answer seems work. I did not restart windows but I tried closing other apps in my windows and then run java and it was able to kick up the VM.

you have saved my world from being ruined.

java - “Error occurred during initialization of VM; Could not reserve ...

java eclipse jvm jvm-arguments
Rectangle 27 2

Even though max priority value is 1000, Facebook used largest integer value as priority to be first. So, I would say you should also keep the same (2147483647) if you want to have a chance. Alert users to uninstall and install Facebook after your app is installed.

To get precedence after rebooting: You can't set priority for boot_completed so, try to Explore android source-code especially SystemServer.java and see once SystemServer is up and running & once booting is completed, what order is used to start apps that are registered for boot_completed.

java - Facebook's "Messenger" has a SMS Broadcast Receiver that takes ...

java android facebook broadcastreceiver
Rectangle 27 1

If you look at the source code, you'll see it's handled internally (PhoneWindowManager.java and GlobalActions.java). There is no interface whatsoever through the API. In short: Can't be done.

If you have the REBOOT permission, you can reboot the phone directly with PowerManager.reboot(), but it is very unlikely that a public app would need this functionality. I wouldn't trust an app with the REBOOT permission.

Thank you very much,Jigar and EboMike. I wouldn't trust an app with the REBOOT permission too and understand "In short: Can't be done". I will just show warning message "please reboot bra bra bra..." on my application.

java - How to call power off,reboot dialog from application? - Stack O...

java android keycode android-softkeyboard
Rectangle 27 1

It is not possible programatically due to security restriction

Funny though, you can directly reboot the device (without any confirmation) if you have the REBOOT permission. That said, I'm not sure if that dialog the OP is asking for is hooked up to an intent, or if the intent if part of the API. It may not be, meaning that each manufacturer could have its own custom solution.

java - How to call power off,reboot dialog from application? - Stack O...

java android keycode android-softkeyboard
Rectangle 27 1

Standard HTTP Cookie and Servlet Session behavior is what is going on.

The restart of the server doesn't cause the client provided Cookies to no longer work. You'll want to configure your Cookie and Session behavior to suit your needs (search on SessionCookieConfig and its ilk).

java - Jetty: programmatically authentication not working after reboot...

java jetty embedded-jetty
Rectangle 27 1

UPDATE: That a reboot helped was coincidental (I hoped so, hooray!). The real cause of the problem was this: When Gradle is directed to use a specific keystore, that keystore must also contain all the official root certificates. Otherwise it cannot access libraries from regular repositories. What I had to do was this:

keytool -import -trustcacerts -alias myselfsignedcert -file /Users/me/Desktop/selfsignedcert.crt -keystore ./privateKeystore.jks

Add the official root certificates:

keytool -importkeystore -srckeystore <java-home>/lib/security/cacerts -destkeystore ./privateKeystore.jks

Maybe the Gradle daemon also got in the way. Might be worth killing all running daemons found with ./gradlew --status if things start looking bleak.

Nobody will believe this, I know. Still, if all else fails, give it a try: After a reboot of my Mac the problem was gone. Grrr.

I am stuck with a self-signed certificate, saved from browser, imported in privateKeystore.jks. Then instructed Gradle to work with privateKeystore.jks:

org.gradle.jvmargs=-Djavax.net.debug=SSL -Djavax.net.ssl.trustStore="/Users/me/IntelliJ/myproject/privateKeystore.jks"  -Djavax.net.ssl.trustStorePassword=changeit

As mentioned, this only worked after a reboot.

ssl - Java: sun.security.provider.certpath.SunCertPathBuilderException...

java ssl https ssl-certificate
Rectangle 27 1

UPDATE: That a reboot helped was coincidental (I hoped so, hooray!). The real cause of the problem was this: When Gradle is directed to use a specific keystore, that keystore must also contain all the official root certificates. Otherwise it cannot access libraries from regular repositories. What I had to do was this:

keytool -import -trustcacerts -alias myselfsignedcert -file /Users/me/Desktop/selfsignedcert.crt -keystore ./privateKeystore.jks

Add the official root certificates:

keytool -importkeystore -srckeystore <java-home>/lib/security/cacerts -destkeystore ./privateKeystore.jks

Maybe the Gradle daemon also got in the way. Might be worth killing all running daemons found with ./gradlew --status if things start looking bleak.

Nobody will believe this, I know. Still, if all else fails, give it a try: After a reboot of my Mac the problem was gone. Grrr.

I am stuck with a self-signed certificate, saved from browser, imported in privateKeystore.jks. Then instructed Gradle to work with privateKeystore.jks:

org.gradle.jvmargs=-Djavax.net.debug=SSL -Djavax.net.ssl.trustStore="/Users/me/IntelliJ/myproject/privateKeystore.jks"  -Djavax.net.ssl.trustStorePassword=changeit

As mentioned, this only worked after a reboot.

ssl - Java: sun.security.provider.certpath.SunCertPathBuilderException...

java ssl https ssl-certificate
Rectangle 27 0

This problem happens when older versions of java still on your system disrupt any new versions installed. To stop this problem you need to first remove all java software using - Control Panel + Remove Programs + then uninstall java. (At this stage, I recommend cleaning out your registry using CCleaner using their Registry option or similar program to ensure a clean sweep then reboot) After rebooting reinstall the most recent version of java and all will be well.

Run local java applet in browser (chrome/firefox) "Your security setti...

java security ubuntu applet updates
Rectangle 27 0

To reboot an EC2 Instance, you have to call the method rebootInstances of your AWS EC2 Java client.

amazon web services - How to reboot and change termination protection ...

amazon-web-services amazon-ec2 cloud amazon multiple-instances
Rectangle 27 0

Unless your app is signed by the system key, no.

Is there any way to take screenshot of current device screen, from application?

On most non rooted devices this isn't possible, but on some you may be able to parse the framebuffer if it is accessible (it isn't on the majority of devices).

java - reboot android and take screenshot of current screen programmat...

java android screenshot reboot