i am trying to make a voice reminder which take a text to be remembered and on the time the application convert the text to say it in voice i did the code of the reminder and i create another class extend broad cast receiver and did the code to the reminder to fire in time but it run when i make it show a toast but when i write the code of the speech in the receiver to fire in the time set but it gives me " the application force to close" could you please answer me i wrote this in the onreceive but it doesn't work
public class ReadyToSpeak extends BroadcastReceiver
{
VoiceAlert voicealert= new VoiceAlert();
#Override
public void onReceive(Context context, Intent intent){
// TODO Auto-generated method stub
Intent scheduledIntent = new Intent(context,VoiceAlert.class);
scheduledIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(scheduledIntent);
Toast.makeText(context, "onresive", Toast.LENGTH_LONG).show();
// voicealert.speak();
voicealert.txs.speak("Hello", TextToSpeech.QUEUE_FLUSH, null);
}
}
I did the code all over again and didn't work and that is what appear in the logcat
10-27 10:23:06.920: WARN/KeyCharacterMap(127): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
10-27 10:23:12.671: WARN/KeyCharacterMap(119): No keyboard for id 0
10-27 10:23:12.671: WARN/KeyCharacterMap(119): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
10-27 10:23:14.081: DEBUG/dalvikvm(127): GC_EXPLICIT freed 2068 objects / 132776 bytes in 77ms
10-27 10:23:33.990: INFO/ActivityManager(58): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.anddev.android.speechreminder/.ReminderActivity }
10-27 10:23:34.470: INFO/ActivityManager(58): Starting activity: Intent { act=android.speech.tts.engine.CHECK_TTS_DATA cmp=com.svox.pico/.CheckVoiceData }
10-27 10:23:34.710: INFO/ActivityManager(58): Displayed activity org.anddev.android.speechreminder/.ReminderActivity: 577 ms (total 577 ms)
10-27 10:23:34.720: WARN/KeyCharacterMap(313): No keyboard for id 0
10-27 10:23:34.720: WARN/KeyCharacterMap(313): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
10-27 10:23:34.780: VERBOSE/TtsService(319): TtsService.onCreate()
10-27 10:23:34.830: VERBOSE/TtsService(319): About to load /system/lib/libttspico.so, applyFilter=true
10-27 10:23:34.910: VERBOSE/TtsService(319): TtsService.setLanguage(eng, USA, )
10-27 10:23:35.120: INFO/ActivityManager(58): Process com.android.alarmclock (pid 170) has died.
10-27 10:23:35.141: INFO/SVOX Pico Engine(319): loaded en-US successfully
10-27 10:23:35.141: INFO/SynthProxy(319): setting speech rate to 100
10-27 10:23:44.870: DEBUG/dalvikvm(296): GC_EXPLICIT freed 1918 objects / 108296 bytes in 159ms
10-27 10:23:49.990: WARN/KeyCharacterMap(114): No keyboard for id 0
10-27 10:23:50.001: WARN/KeyCharacterMap(114): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
10-27 10:24:18.050: WARN/InputManagerService(58): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#44fe6228
10-27 10:24:20.550: DEBUG/SntpClient(58): request time failed: java.net.SocketException: Address family not supported by protocol
Taghrid, It looks like you're getting a Stackoverflow error. This indicates that somewhere in your code you have Infinite recursion. It looks like it's VoiceAlert and ReadyToSpeak functions that keep calling one another. Are you sure the package your using, org.androiddev.android.test is of good quality? Are you using a release version of it?
Related
Following the "Five minute quick start" documentation for uploading a file from an Android device to Google Drive, I've written a test application that successfully uploads a file but my attempt at copying the relevant code to a larger application doesn't upload a file because its Google Account Picker is always getting canceled:
the onActivityResult() result code is 0 (i.e.,
RESULT_CANCELED),
the onActivityResult() intent argument is null, and
the logcat (shown below) reveals that "Activity is launching as a new task, so
cancelling activity result."
04-22 02:04:25.098: D/alsa_ucm(162): snd_use_case_set(): uc_mgr 0x40e59388 identifier _verb value HiFi Lowlatency
04-22 02:04:25.098: D/alsa_ucm(162): Set mixer controls for Speaker enable 1
04-22 02:04:25.098: D/ACDB-LOADER(162): ACDB -> send_afe_cal
04-22 02:04:25.098: I/ActivityManager(526): START u0 {act=com.google.android.gms.common.account.CHOOSE_ACCOUNT cmp=com.google.android.gms/.common.account.AccountPickerActivity (has extras)} from pid 3484
04-22 02:04:25.098: W/ActivityManager(526): Activity is launching as a new task, so cancelling activity result.
04-22 02:04:25.108: D/alsa_ucm(162): Set mixer controls for HiFi Lowlatency enable 1
04-22 02:04:25.108: D/ALSAModule(162): Device value returned is hw:0,14
04-22 02:04:25.118: D/ALSAModule(162): setHardwareParams: reqBuffSize 1024 channels 2 sampleRate 48000
04-22 02:04:25.118: D/ALSAModule(162): setHardwareParams: buffer_size 2048, period_size 1024, period_cnt 2
04-22 02:04:25.188: D/dalvikvm(526): GC_FOR_ALLOC freed 565K, 15% free 18562K/21684K, paused 71ms, total 71ms
04-22 02:04:25.248: D/overlay(159): Unset pipe=VG0 dpy=0; Unset pipe=VG1 dpy=0; Unset pipe=RGB1 dpy=0
04-22 02:04:25.248: W/InputMethodManagerService(526): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#41ebd7e0 attribute=null, token = android.os.BinderProxy#42018140
04-22 02:04:27.991: D/dalvikvm(526): GC_FOR_ALLOC freed 422K, 15% free 18564K/21684K, paused 65ms, total 66ms
04-22 02:04:28.011: I/ActivityManager(526): No longer want com.google.android.marvin.talkback (pid 5301): empty #17
04-22 02:04:28.241: D/overlay(159): Set pipe=RGB1 dpy=0; Set pipe=VG0 dpy=0; Set pipe=VG1 dpy=0;
04-22 02:04:28.672: D/overlay(159): Unset pipe=VG0 dpy=0; Unset pipe=VG1 dpy=0; Unset pipe=RGB1 dpy=0;
The code that launches the Google Account Picker is exactly the same in both applications but the picker gets canceled only in the larger application.
// Handle item selection
case R.id.action_select_account:
mCredential = GoogleAccountCredential.usingOAuth2(this, DriveScopes.DRIVE);
Intent intent2 = mCredential.newChooseAccountIntent();
showToast("intent extra: " + intent2.getStringExtra(AccountManager.KEY_ACCOUNT_NAME)); // TODO: remove after test
startActivityForResult(intent2, REQUEST_ACCOUNT_PICKER);
return true;
default:
return false;
The test application and the larger application are both debug versions, including the same jars (shown below), and running on the same device (Nexus 4, OS 4.2.2) but, as suggested in the five minute quickstart, each application has its own client ID generated by Google APIs Console.
The result of this cancellation is that the onActivityResult() runs as soon as the Google Account Picker gets drawn, well before an account is selected.
UPDATE:
After an approximately equal amount of trial and error, it turns out that removing the following from AndroidManifest.xml fixed the problem.
android:launchMode="singleInstance"
My initial question of why now shifts to why does the Google Account Picker in Android need to create multiple instances?
Thanks,
Greg
If you use singleInstance you permit no other activities to be part of its task. Use singleTask instead.
As stated on http://developer.android.com/guide/topics/manifest/activity-element.html#lmode
a few paragraphs down.
The "singleTask" and "singleInstance" modes also differ from each other in only one respect: A "singleTask" activity allows other activities to be part of its task. It's always at the root of its task, but other activities (necessarily "standard" and "singleTop" activities) can be launched into that task. A "singleInstance" activity, on the other hand, permits no other activities to be part of its task. It's the only activity in the task. If it starts another activity, that activity is assigned to a different task — as if FLAG_ACTIVITY_NEW_TASK was in the intent.
As described in the question's update, the account picker started working when I removed singleInstance launchMode from AndroidManifest.xml. I don't know if this single instance launch mode behavior is a bug or a lack of documentation, but I submitted it to the Android Issue Tracker: issue 54656
For some reason, the intent returned by account manager has singleTop set, which always causes your onActivityResult to fail immediately and return a 0 resultCode (Activity.RESULT_CANCELLED) or whatever. I had to zero-out the intent flags to prevent this
// prevent running AccountPicker as SingleTop which fails and calls onActivityResult immediately otherwise
intent.setFlags(0);
startActivityForResult(intent, AccountManagerUtils.GOOGLE_AUTH_REQUEST_CODE);
after searching i've found that some phones (like the Galaxy s) are affected by a strange bug or whatever that cause this error:
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:200)
at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)
at java.util.concurrent.FutureTask.setException(FutureTask.java:125)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
at java.lang.Thread.run(Thread.java:1019)
Caused by: android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
at android.view.ViewRoot.checkThread(ViewRoot.java:2934)
at android.view.ViewRoot.invalidateChild(ViewRoot.java:643)
at android.view.ViewRoot.invalidateChildInParent(ViewRoot.java:669)
at android.view.ViewGroup.invalidateChild(ViewGroup.java:2511)
at android.view.View.invalidate(View.java:5279)
at android.webkit.WebView.selectionDone(WebView.java:4470)
at android.webkit.WebView.clearHelpers(WebView.java:1295)
at android.webkit.WebView.loadDataWithBaseURL(WebView.java:1714)
at c.a(Unknown Source)
at c.doInBackground(Unknown Source)
at android.os.AsyncTask$2.call(AsyncTask.java:185)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
... 4 more
android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
at android.view.ViewRoot.checkThread(ViewRoot.java:2934)
at android.view.ViewRoot.invalidateChild(ViewRoot.java:643)
at android.view.ViewRoot.invalidateChildInParent(ViewRoot.java:669)
at android.view.ViewGroup.invalidateChild(ViewGroup.java:2511)
at android.view.View.invalidate(View.java:5279)
at android.webkit.WebView.selectionDone(WebView.java:4470)
at android.webkit.WebView.clearHelpers(WebView.java:1295)
at android.webkit.WebView.loadDataWithBaseURL(WebView.java:1714)
at c.a(Unknown Source)
at c.doInBackground(Unknown Source)
at android.os.AsyncTask$2.call(AsyncTask.java:185)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
at java.lang.Thread.run(Thread.java:1019)
And this is the logcat if needed and from here it seems that is problem of the swipe function:
10-27 19:19:20.329 I/InputReader( 166): dispatchTouch::touch event's action is 1
10-27 19:19:20.329 I/InputDispatcher( 166): Delivering touch to current input target: action: 1, channel '4096f5c8 ***PACKEGE_NAME***/***PACKEGE_NAME***.Game (server)'
10-27 19:19:20.749 I/InputReader( 166): dispatchTouch::touch event's action is 0
10-27 19:19:20.749 I/InputDispatcher( 166): Delivering touch to current input target: action: 0, channel '4096f5c8 ***PACKEGE_NAME***/***PACKEGE_NAME***.Game (server)'
10-27 19:19:21.689 I/InputReader( 166): dispatchTouch::touch event's action is 1
10-27 19:19:21.689 I/InputDispatcher( 166): Delivering touch to current input target: action: 1, channel '4096f5c8 ***PACKEGE_NAME***/***PACKEGE_NAME***.Game (server)'
10-27 19:19:21.689 W/webview ( 1125): Miss a drag as we are waiting for WebCore's response for touch down.
10-27 19:19:21.989 I/InputReader( 166): dispatchTouch::touch event's action is 0
10-27 19:19:21.989 I/InputDispatcher( 166): Delivering touch to current input target: action: 0, channel '4096f5c8 ***PACKEGE_NAME***/***PACKEGE_NAME***.Game (server)'
10-27 19:19:22.159 I/Ads ( 1125): Refreshing ad.
10-27 19:19:22.169 I/webclipboard( 1125): clipservice: android.sec.clipboard.ClipboardExManager#4051cb08
10-27 19:19:22.259 I/Ads ( 1125): adRequestUrlHtml: <html><head><script src="http://www.gstatic.com/afma/sdk-core-v40.js"></script><script>AFMA_buildAdURL({"preqs":15,"u_sd":1.0,"u_w":320,"slotname":"a14e098781b871d","msid":"***PACKEGE_NAME***","js":"afma-sdk-a-v4.0.4","isu":"F1B8EEEA64C5716BA996D22689C17557","format":"320x50_mb","net":"wi","app_name":"4.0.4.android.***PACKEGE_NAME***","hl":"pt","u_h":480,"u_so":"p","u_audio":1,"prl":792});</script></head><body></body></html>
10-27 19:19:22.449 I/InputReader( 166): dispatchTouch::touch event's action is 1
10-27 19:19:22.449 I/InputDispatcher( 166): Delivering touch to current input target: action: 1, channel '4096f5c8 ***PACKEGE_NAME***/***PACKEGE_NAME***.Game (server)'
10-27 19:19:22.449 W/webview ( 1125): Miss a drag as we are waiting for WebCore's response for touch down.
10-27 19:19:22.599 I/Ads ( 1125): Received ad url: <"url": "http://googleads.g.doubleclick.net:80/mads/gma?preqs=15&u_sd=1&u_w=320&slotname=a14e098781b871d&msid=***PACKEGE_NAME***&js=afma-sdk-a-v4.0.4&isu=F1B8EEEA64C5716BA996D22689C17557&format=320x50_mb&net=wi&app_name=4.0.4.android.***PACKEGE_NAME***&hl=pt&u_h=480&u_so=p&u_audio=1&prl=792&output=html®ion=mobile_app&u_tz=240&ex=1&client_sdk=1&askip=0", "afmaNotifyDt": "null">
10-27 19:19:22.609 I/InputReader( 166): dispatchTouch::touch event's action is 0
10-27 19:19:22.609 I/InputDispatcher( 166): Delivering touch to current input target: action: 0, channel '4096f5c8 ***PACKEGE_NAME***/***PACKEGE_NAME***.Game (server)'
10-27 19:19:23.339 W/dalvikvm( 1125): threadid=11: thread exiting with uncaught exception (group=0x40018578)
10-27 19:19:23.339 E/ACRA ( 1125): ACRA caught a RuntimeException exception for ***PACKEGE_NAME***. Building report.
10-27 19:19:23.339 D/ACRA ( 1125): Retrieve application default SharedPreferences.
10-27 19:19:23.349 V/webview ( 1125): ZoomScale 3 mPreserveZoom: false
10-27 19:19:23.489 I/ACRA ( 1125): READ_LOGS granted! ACRA can include LogCat and DropBox data.
10-27 19:19:23.519 D/ACRA ( 1125): Retrieving logcat output...
The only thing that can cause this error is a Timer that i use in my application in the game Intent, i tried to set up a handler but i saw a lot of crash in my ACRA log.
This is the content of my intent, i hope that someone should help me :)
startB.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
startB.setEnabled(false);
partiColTempo(tempox);
}
});
}
private void displayText(final String text){
this.runOnUiThread(new Runnable(){
//#Override
public void run() {
tempo.setText(text);
if (text.equals("Finished")){
eseguiSuono();
assegnaPunti();
startB.setEnabled(true);
//elapsed=0;
tempo.setText("Waiting");
}
}});
}
private void partiColTempo(int tempox) {
TIMEOUT=tempox*1000;
Log.w("tempo timer", ""+tempox);
elapsed=INTERVAL;
TimerTask task=new TimerTask(){
#Override
public void run() {
elapsed+=INTERVAL;
if(elapsed>TIMEOUT){
this.cancel();
displayText("Finished");
return;
}
//if(some other conditions)
// this.cancel();
displayText(getString(R.string.tempo_rim)+" " + (TIMEOUT-elapsed) / 1000);
}
};
Timer timer = new Timer();
timer.scheduleAtFixedRate(task, INTERVAL, INTERVAL);
Is the problem there? Because i can't find other place when i call asynctask.
You are clearly doing something with UI (i.e. View-derived objects) from AsyncTask.doInBackground(). That's not allowed, only the UI thread can touch UI objects.
If you need to update UI from your background/AsyncTask as it's running, you must call publishProgress() which will cause onProgressUpdate to run on the UI thread. You can also implement onPostExecute() which will also run on the UI thread once the background thread has finished.
This scenario generally occurs when AsyncTask thread is working in the
background but in the meanwhile, the UI activity class is destroy. So
after completion of the AsyncTask when we try to perform some UI task,
the above Exception will thrown.
In my application,showing video from sdcard folder or new taken video from Video intent in a VideoView in different Activity by passing file path of the video selected.
Now the problem is,
I have tested this app in my 2 devices LG Optimus Black and LG Optimus Me and it works like charm not problem no force close.
Now when i test this app in Samsung Fascinate 2.1 the video view shows the message "Can't Play Video" no matter i select existing video or take new one.
Remember the app is working fine with the above 2 devices.
In the ShowVideo activity i have button to upload the video, when i got the message "Can't Play Video" i been able to take video from the same path and upload it and can check that video at server side but video view didn't played that video.
So, the Video Path of the SDCard is not the problem thats for sure.
also the Video are of .3gp or .mp4 format only so the format is also supported by android
.
My Questions Are :
1)When the message "Can't Play Video" occurs?
2)What are the Solution for that?
and 3) What could be possible mistakes in my application?
here is the logcat output while i got that message but don't see any error/exception in that.
I/ActivityManager( 2227): Starting activity: Intent { cmp=com.zoodigapp.zoodig/com.zoodigapp.media.ShowVideo (has extras) }
V/SettingsProvider( 2227): system <- value=1.0 name=font_scale
V/SettingsProvider( 2227): property: sys.settings_system_version=26
V/SettingsProvider( 2227): notifying: content://settings/system/font_scale
D/HardwareService( 2227): Brightness NATIVE setBacklightBrightness running. light: 2bightness ==> 30 mode: 1
D/NetworkLocationProvider( 2227): onDataConnectionStateChanged 6
D/MobileDataStateTracker( 2227): default Received state= CONNECTING, old= CONNECTING, reason= (unspecified), apnTypeList= *
D/AGPSManagerService( 2227): state: CONNECTING apnName: Verizon reason: null
D/dalvikvm( 3326): GC freed 2472 objects / 140504 bytes in 73ms
I/File ( 3326): /sdcard/DCIM/Camera/video-2011-10-17-10-40-54.mp4
V/MediaStore( 3326): We probably run out of space, so create the thumbnail in memory.
I/MediaPlayerService( 2182): Use PV_PLAYER for url:/sdcard/DCIM/Camera/video-2011-10-17-10-40-54.mp4
E/MetadataDriver( 2182): MetadataDriver::setDataSource url file type is isAudiofile(0)
D/ ( 2182): SISO TEST registering PVMFRecognizerPluginFactory
D/ ( 2182): SISO TEST registering PVMFRecognizerPluginFactory success
E/MetadataDriver( 2182): isCommandSuccessful: Command id(0 and expected 0) and status (-17 and expected 1), data corruption (false) at state (4).
E/MetadataDriver( 2182): isCommandSuccessful: Command id(1 and expected 1) and status (-14 and expected 1), data corruption (false) at state (5).
E/MetadataDriver( 2182): captureFrame : time = 0
E/MetadataDriver( 2182): captureFrame : inputWidth = 0, inputHeight =0, bAspectratio=0, bResize=0
D/MediaUploader( 2492): UploadsQueue.getAllPending: elapsed msec=449
I/MediaUploader( 2492): UploadManager.uploadPendingItems: Found 1 items in queue.
I/Selected( 3326): =============Second
D/MediaUploader( 2492): isGphotosSynced: FALSE -- starting gphotos update refresh for -5709461173740324808
W/IInputConnectionWrapper( 3505): showStatusIcon on inactive InputConnection
I/copybit ( 2227): [createPP] fimc version : 50
I/MediaPlayerService( 2182): Use PV_PLAYER for url:/DCIM/Camera/video-2011-10-17-10-40-54.mp4
D/ ( 2182): SISO TEST registering PVMFRecognizerPluginFactory
D/ ( 2182): SISO TEST registering PVMFRecognizerPluginFactory success
D/ ( 2182): SISO TEST PVOMA1FFRecognizerFactory::CreateRecognizerPlugin()
D/ ( 2182): SISO TEST PVOMA1FFRecognizerFactory::CreateRecognizerPlugin() plugin found
D/ ( 2182): SISO TEST PVOMA1FFRecognizerFactory::DestroyRecognizerPlugin()
E/OsclDirectFileIO( 2182): [LargeFileSupport] OsclDirectFileIO::OpenFileOrSharedFd Error = -1
W/MediaPlayer( 3326): info/warning (1, 26)
E/PlayerDriver( 2182): Command PLAYER_SET_DATA_SOURCE completed with an error or info -4
E/MediaPlayer( 3326): SISO TEST MEDIA_ERROR
E/MediaPlayer( 3326): error (-4, -4)
W/PlayerDriver( 2182): PVMFInfoErrorHandlingComplete
V/MediaProvider( 2349): stopThumbWorkerSuspendTimer
V/MediaProvider( 2349): Resuming ThumbWorker
W/MediaProvider( 2349): Have message but no request?
I/System.out( 2647): interface name: null
I/MediaPlayer( 3326): Info (1,26)
E/MediaPlayer( 3326): Error (-4,-4)
D/VideoView( 3326): Error: -4,-4
D/MediaUploader( 2492): UploadManager.uploadPendingItems: Waiting for GPhotos sync
D/MediaUploader( 2492): UploadsQueue.getAllPending: elapsed msec=5
I/MediaUploader( 2492): UploadManager.uploadPendingItems: Found 1 items in queue.
I/POWER_OFF_TEST( 2227): mBatteryLevel = 38 mBatteryDecimalPoint = 1
D/MediaUploader( 2492): UploadsAsyncQueryHandler.notifiyDatabaseChangeListeners
D/MediaUploader( 2492): isGphotosSynced: FALSE -- update is in progress for -5709461173740324808
D/MediaUploader( 2492): UploadManager.uploadPendingItems: Waiting for GPhotos sync
D/MediaUploader( 2492): updateQueueState: RUNNING
I/GooglePlusOne( 2492): Starting new CAMERA_SYNC_CREATED request 1
I/ActivityManager( 2227): Displayed activity com.zoodigapp.zoodig/com.zoodigapp.media.ShowVideo: 1251 ms (total 1251 ms)
V/InputDevice( 2227): ID[0]=0 Dn (0=>1)
V/WindowManager( 2227): Dsptch >Window{47a67278 com.zoodigapp.zoodig/com.zoodigapp.media.ShowVideo paused=false}
D/dalvikvm( 2227): GC freed 4009 objects / 210024 bytes in 155ms
V/InputDevice( 2227): ID[0]=0 Up (1=>0)
V/WindowManager( 2227): Dsptch >Window{47a67278 com.zoodigapp.zoodig/com.zoodigapp.media.ShowVideo paused=false}
W/InputManagerService( 2227): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#47d89250
D/dalvikvm( 2492): GC freed 11952 objects / 682568 bytes in 171ms
D/dalvikvm( 2647): GC freed 7435 objects / 656456 bytes in 26ms
D/dalvikvm( 2647): GC freed 3079 objects / 498304 bytes in 60ms
I/System.out( 2647): interface name: null
I/GooglePlusOne( 2492): CAMERA_SYNC_CREATED request 1 completed with code=200
D/MediaUploader( 2492): onGphotosChange: sawError=false; errs=0; retry=Wed Dec 31 17:00:00 America/Boise 1969; expiry=Mon Oct 17 10:56:20 America/Boise 2011
D/MediaUploader( 2492): UploadsQueue.getAllPending: elapsed msec=17
I/MediaUploader( 2492): UploadManager.uploadPendingItems: Found 1 items in queue.
D/MediaUploader( 2492): isGphotosSynced: TRUE for -5709461173740324808
D/MediaUploader( 2492): existsInGphotos: false info=name=video-2011-10-17-10-40-54.mp4 fileUri=content://media/external/video/media/37 fileSize=2477915;
D/MediaUploader( 2492): UploadManager.uploadPendingItems: starting upload...
D/MediaUploader( 2492): UploadManager.upload: info=name=video-2011-10-17-10-40-54.mp4 fileUri=content://media/external/video/media/37 fileSize=2477915
I/NetworkStat( 2678): Network type: MOBILE
I/NetworkStat( 2678): -------- mobile data network is NOT available as of now
D/NotificationService( 2227): enqueueNotification :: notification.defaults = 0, Notification.DEFAULT_SOUND = 1, notification.sound = null
D/dalvikvm( 2492): GC freed 4032 objects / 238248 bytes in 49ms
I/dalvikvm-heap( 2492): Grow heap (frag case) to 6.708MB for 524304-byte allocation
D/dalvikvm( 2492): GC freed 291 objects / 13392 bytes in 58ms
D/MediaUploader( 2492): UploadsAsyncQueryHandler.notifiyDatabaseChangeListeners
D/MediaUploader( 2492): GlsAuthorizer.getAuthToken: authTokenType=lh2; account=dprichards#gmail.com;
D/MediaUploader( 2492): executeWithAuthRetry: starting httpClient.execute #1
D/dalvikvm( 2870): GC freed 555 objects / 24144 bytes in 269ms
I/System.out( 2492): interface name: null
V/InputDevice( 2227): ID[0]=0 Dn (0=>1)
V/WindowManager( 2227): Dsptch >Window{47cf6308 com.zoodigapp.zoodig/com.zoodigapp.media.ShowVideo paused=false}
V/InputDevice( 2227): ID[0]=0 Up (1=>0)
V/WindowManager( 2227): Dsptch >Window{47cf6308 com.zoodigapp.zoodig/com.zoodigapp.media.ShowVideo paused=false}
D/dalvikvm( 2647): GC freed 7301 objects / 659064 bytes in 78ms
I/System.out( 2647): interface name: null
I/System.out( 2647): interface name: null
I/System.out( 2647): interface name: null
D/dalvikvm( 2647): GC freed 2654 objects / 324016 bytes in 149ms
I/System.out( 2647): interface name: null
D/MediaUploader( 2492): getStatusCode: status=HTTP/1.1 200 OK
D/MediaUploader( 2492): getStatusCode: status=HTTP/1.1 200 OK
D/MediaUploader( 2492): UPLOAD_START: uploadUrl=https://picasaweb.google.com/data/upload/resumable/media/create-session/feed/api/user/default/albumid/camera-sync?xmlerrors=1&upload_id=AEnB2Uqe2bdvyx5p31Ta-sS4ytggj07_6-uiKG_hCOc6sT1u8eqhvr-8oZdUT1uPHxuAxXphUiJXyq-i_8YaJlT2YLholp__Sw
D/MediaUploader( 2492): UploadManager.onProgress
V/MediaUploader( 2492): UploadManager.progressUpdate: guid=1351689615505998240; bytes=0
D/dalvikvm( 2647): GC freed 920 objects / 202544 bytes in 53ms
D/dalvikvm( 2492): GC freed 7362 objects / 498448 bytes in 73ms
D/MediaUploader( 2492): UploadsAsyncQueryHandler.notifiyDatabaseChangeListeners
D/dalvikvm( 2492): GC freed 658 objects / 129232 bytes in 42ms
I/dalvikvm-heap( 2492): Grow heap (frag case) to 7.250MB for 262160-byte allocation
D/dalvikvm( 2492): GC freed 0 objects / 0 bytes in 41ms
D/dalvikvm( 2492): GC freed 92 objects / 135128 bytes in 30ms
I/dalvikvm-heap( 2492): Grow heap (frag case) to 7.621MB for 524304-byte allocation
D/dalvikvm( 2492): GC freed 0 objects / 0 bytes in 44ms
D/MediaUploader( 2492): executeWithAuthRetry: starting httpClient.execute #1
D/dalvikvm( 2647): GC freed 576 objects / 53240 bytes in 182ms
V/InputDevice( 2227): ID[0]=0 Dn (0=>1)
V/WindowManager( 2227): Dsptch >Window{47cf6308 com.zoodigapp.zoodig/com.zoodigapp.media.ShowVideo paused=false}
V/InputDevice( 2227): ID[0]=0 Up (1=>0)
V/WindowManager( 2227): Dsptch >Window{47cf6308 com.zoodigapp.zoodig/com.zoodigapp.media.ShowVideo paused=false}
I/ActivityManager( 2227): Starting activity: Intent { cmp=com.zoodigapp.zoodig/.WriteMessage (has extras) }
If you find anything not described well please comment below.
Additional details (moved from comments):
They are merely of 1 minutes and the last one I tested and failed on Samsung that was of only 20 seconds. and sizes are mostly in MB not more than 20 MB right now.
The video is taken from the same device and immediately after taking that video I try to show in my activity same way other already stored video are also fine...actually after uploading that video I can see that video and can download also
1)When the message "Can't Play Video" occurs?
Android usually gives out this message, when it is not able to play the media content. The reasons for this to happen can be anything like
Unsupported file format
Unsupported codecs
Erroneous content
to mention a few.
2)What are the Solution for that?
Unless you have your own Media Framework in your app, there is no solution from the application level
3) What could be possible mistakes in my application?
Very unlikely the mistake is in your application. If you read the logs, you will see that the error seems to originate from the DataSource of opencore (Which version of android are you running anyway? It is still using Opencore instead of StageFright). It is recognizing it as a large file (> 2GB) and hence giving out the error "E/OsclDirectFileIO( 2182): [LargeFileSupport] OsclDirectFileIO::OpenFileOrSharedFd Error = -1"
The other thing to note is certain phones have better multimedia capability than the other phones, since OEM's can themselves improve the multimedia capability. So there is no written guarantee that all files can be played on all devices, even though it conforms to the supported formats, codecs mentioned by Android.
Its all about format problem, Some phone record the video in mp4 format and some in 3gp format, but in almost all phones the default mediaplayer support 3gp format. So the solution is you need to convert it into 3gp at the time of playing. This thing is difficult to handle in android, So at server end you can do it easily and hence whatever the format of the video is being uploaded you can download it in one format .3gp and it will work fine.
Make sure that your video is in MP4 format , but if still does not play or shows same error then fault is not with the code. Fault is in the video resolution. just check height and width of you video and match it with you video view component. There are lot of free video compressors Online available. So just compress your video and test it.
It will work.
Cheers!!!
I kept getting the same "Can't Play Video" message while trying to play video from the phone itself. First I didn't input good path to a file but there was anther interesting issue.
I've type path from the root, example /videoFileName.mp4 and I should have type it with sdcard in between like /sdcard/videoFileName.mp4
My Sony Ercisson Xperia Arc was connected as a usb mass device storage at the same time I was running my app through adb, so internal sd card was unmounted and file could not be found. I've discovered this when I tryed same code on Samsung Galaxy S which behaves differently when connected.
If you have mp4 file having H.264 baseline encoding and still you are unable to play video in your android device then it might be problem in .htAccess file on server side. It might be zipping .mp4 file. few devices are able to play video by unzipping it and stream it but not in all device cases. You need to change .htAccess file on server side. Change in output filter and include file format .mp4 to exclude it from being zip at streaming time.
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|swf|mp4)$ \ no-gzip dont-vary
Google recently open-sourced Exoplayer after Google IO 2014.
My experience with video playing with it was good so far.
https://github.com/google/ExoPlayer
I could stream videos from Dropbox/AWS
Stream videos from youtube.
Things still depend upon codecs supported by the device.
I had this same issue while using VideoView, while i tried to check all things regarding the video the issue was in the AndroidManifest.xml File, It was regarding the permission to use EXTERNAL STORAGE give it a shot it might solve the issue.
I came across the same problem and what worked for is adding the Internet permission to the manifest file since I am getting video from url.
<uses-permission android:name="android.permission.INTERNET"/>
This is how I am populating listview of videos.
//assign video
mVideosListView = (ListView) findViewById(R.id.videoListView);
//create videos
Video riverVideo = new Video("https://s3.amazonaws.com/androidvideostutorial/862009639.mp4");
Video carsVideo = new Video("https://s3.amazonaws.com/androidvideostutorial/862013714.mp4");
Video townVideo = new Video("https://s3.amazonaws.com/androidvideostutorial/862014159.mp4");
Video whiteCarVideo = new Video("https://s3.amazonaws.com/androidvideostutorial/862014159.mp4");
Video parkVideo = new Video("https://s3.amazonaws.com/androidvideostutorial/862014834.mp4");
Video busyCityVideo = new Video("https://s3.amazonaws.com/androidvideostutorial/862017385.mp4");
mVideosList.add(riverVideo);
mVideosList.add(carsVideo);
mVideosList.add(townVideo);
mVideosList.add(whiteCarVideo);
mVideosList.add(parkVideo);
mVideosList.add(busyCityVideo);
/***populate video list to adapter**/
mVideoAdapter = new VideoAdapter(this, mVideosList);
mVideosListView.setAdapter(mVideoAdapter);
I faced the same issue once. In My case only issue was fie format. i Just changed the video format to .mp4 and it works like charm on all the devices and emulator i used.
my suggestion is to check your video format first and then try other solutions.
For me was a problem with the codec used by video.
I installed the Any Video Converter and converted the video using the settings for Google Android (x264).
Now I can play on every device.
My problem was I had saved it in .avi format instead of .m4v format, and it worked liked a charm on my Samsung...thanks for everyone's help!
Is it possible to switch the call ringer off silent dueing an incoming call?
I am able to change the phone to normal mode and set the volume of the ringer, but because the phone was in silent previously, it doesn't just start ringing after I change the settings.
What I am doing is, when the phone is in silent and I receive an incoming call, based on certain conditions I want the phone to actually ring.
As mentioned, I have changed the settings ok, so if I receive a subsequent call the ringer works, but the initial call (which triggered the change of settings) still continues to ring in silent mode... Is there a way to (after I set the ringer modes) to force the phone to "ring" with the new settings again?
Update:
I have set the ringer off silent and set to ring at max volume using the following:
AudioManager mAudioManager = (AudioManager)getSystemService(AUDIO_SERVICE);
int origionalVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_RING);
int maxVolume = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_RING);
mAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
mAudioManager.setStreamVolume(AudioManager.STREAM_RING, maxVolume, AudioManager.FLAG_SHOW_UI + AudioManager.FLAG_PLAY_SOUND);
I can see in the logs that when the ringer is actually playing, it logs out:
06-13 19:22:33.984: DEBUG/CallNotifier(126): RINGING... (new)
06-13 19:22:33.984: DEBUG/CallNotifier(126): onNewRingingConnection(): incoming: true state: INCOMING post dial state: NOT_STARTED
06-13 19:22:34.094: INFO/ActivityManager(59): Start proc android.process.acore for content provider com.android.providers.contacts/.ContactsProvider2: pid=294 uid=10000 gids={3003, 1015}
06-13 19:22:34.444: INFO/ActivityThread(294): Publishing provider com.android.social: com.android.providers.contacts.SocialProvider
06-13 19:22:34.494: INFO/ActivityThread(294): Publishing provider applications: com.android.providers.applications.ApplicationsProvider
06-13 19:22:34.594: WARN/CallNotifier(126): CallerInfo query took too long; manually starting ringer
06-13 19:22:34.594: WARN/CallNotifier(126): CallerInfo query took too long; falling back to default ringtone
06-13 19:22:34.594: DEBUG/Ringer(126): ring()...
06-13 19:22:34.664: INFO/ActivityManager(59): Start proc com.android.settings for broadcast com.android.settings/.widget.SettingsAppWidgetProvider: pid=301 uid=1000 gids={3002, 3001, 3003}
06-13 19:22:34.684: DEBUG/Ringer(126): mRingHandler: PLAY_RING_ONCE...
06-13 19:22:34.684: DEBUG/Ringer(126): creating ringtone: content://settings/system/ringtone
06-13 19:22:34.734: INFO/ActivityManager(59): Starting activity: Intent { act=android.intent.action.MAIN flg=0x10840000 cmp=com.android.phone/.InCallScreen }
06-13 19:22:35.374: DEBUG/InCallScreen(126): onCreate()... this = com.android.phone.InCallScreen#44f29ad0
06-13 19:22:35.504: INFO/ActivityThread(294): Publishing provider contacts;com.android.contacts: com.android.providers.contacts.ContactsProvider2
06-13 19:22:36.184: DEBUG/AudioHardwareInterface(34): setMode(RINGTONE)
Is there a way to call these functions manually at all?
You could consider when the phone is called, your application starts playing the default ring tone. Kinda hacky though
I think that you can make a broadcast receiver that senses the incoming call,So in its onReceive method you can change the settings of your phone ,hence this settings will take effects as soon as you got the call.
Hope this work.
Check out AudioManager and it shows the developing guide how to use it for changing ringing types dynamically in your application.
I,m trying to work through and test a Voice Recognition example based on the VoiceRecognition.java example at http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/VoiceRecognition.html
but when click on the button to create the activity, I get a dialog that says Connection problem. My Manifest file is using the Internet Permission, and I understand it passes the to the Google Servers. Do I need to do anything else to use this. Code below
UPDATE 2:
Thanks to Steve, I have been able to install the USB Driver and debug the app directly on my Droid. Here is the LogCat output from clicking on my mic button:
03-08 18:36:45.686: INFO/ActivityManager(1017): Starting activity: Intent { act=android.speech.action.RECOGNIZE_SPEECH cmp=com.google.android.voicesearch/.IntentApiActivity (has extras) }
03-08 18:36:45.686: WARN/ActivityManager(1017): Activity is launching as a new task, so cancelling activity result.
03-08 18:36:45.787: DEBUG/NetworkLocationProvider(1017): setMinTime: 120000
03-08 18:36:45.889: INFO/ActivityManager(1017): Displayed activity com.google.android.voicesearch/.IntentApiActivity: 135 ms (total 135 ms)
03-08 18:36:45.905: DEBUG/NetworkLocationProvider(1017): onCellLocationChanged [802,0,0,4192,3]
03-08 18:36:45.951: INFO/MicrophoneInputStream(1429): Starting voice recognition with audio source VOICE_RECOGNITION
03-08 18:36:45.998: DEBUG/AudioHardwareMot(990): Codec sampling rate already 16000
03-08 18:36:46.092: INFO/RecognitionService(1429): ssfe url=http://www.google.com/m/voice-search
03-08 18:36:46.092: WARN/RecognitionService(1429): required parameter 'calling_package' is missing in IntentAPI request
03-08 18:36:46.115: DEBUG/AudioHardwareMot(990): Codec sampling rate already 16000
03-08 18:36:46.131: WARN/InputManagerService(1017): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy#4487d240 (uid=10090 pid=3132)
03-08 18:36:46.131: WARN/IInputConnectionWrapper(3132): showStatusIcon on inactive InputConnection
03-08 18:36:46.248: WARN/MediaPlayer(1429): info/warning (1, 44)
03-08 18:36:46.334: DEBUG/dalvikvm(3206): GC freed 3682 objects / 369416 bytes in 293ms
03-08 18:36:46.358: WARN/MediaPlayer(1429): info/warning (1, 44)
03-08 18:36:46.412: WARN/MediaPlayer(1429): info/warning (1, 44)
03-08 18:36:46.444: WARN/MediaPlayer(1429): info/warning (1, 44)
03-08 18:36:46.475: WARN/MediaPlayer(1429): info/warning (1, 44)
03-08 18:36:46.506: WARN/MediaPlayer(1429): info/warning (1, 44)
03-08 18:36:46.514: INFO/MediaPlayer(1429): Info (1,44)
03-08 18:36:46.514: INFO/MediaPlayer(1429): Info (1,44)
03-08 18:36:46.514: INFO/MediaPlayer(1429): Info (1,44)
03-08 18:36:46.514: INFO/MediaPlayer(1429): Info (1,44)
03-08 18:36:46.514: INFO/MediaPlayer(1429): Info (1,44)
03-08 18:36:46.514: INFO/MediaPlayer(1429): Info (1,44)
The line that concerns me is the warning of the missing parameter calling-package.
UPDATE:
Ok, I was able to replace my emulator image with one from HTC that appears to come with Google Voice Search, however now when I run from the emulator, i'm getting an Audio Problem message with Speak Again or Cancel buttons. It appears to make it back to the onActivityResult(), but the resultCode is 0.
Here is the LogCat output:
03-07 20:21:25.396: INFO/ActivityManager(578): Starting activity: Intent { action=android.speech.action.RECOGNIZE_SPEECH comp={com.google.android.voicesearch/com.google.android.voicesearch.RecognitionActivity} (has extras) }
03-07 20:21:25.406: WARN/ActivityManager(578): Activity is launching as a new task, so cancelling activity result.
03-07 20:21:25.968: WARN/ActivityManager(578): Activity pause timeout for HistoryRecord{434f7850 {com.ikonicsoft.mileagegenie/com.ikonicsoft.mileagegenie.MileageGenie}}
03-07 20:21:26.206: WARN/AudioHardwareInterface(554): getInputBufferSize bad sampling rate: 16000
03-07 20:21:26.256: ERROR/AudioRecord(819): Recording parameters are not supported: sampleRate 16000, channelCount 1, format 1
03-07 20:21:26.696: INFO/ActivityManager(578): Displayed activity com.google.android.voicesearch/.RecognitionActivity: 1295 ms
03-07 20:21:29.890: DEBUG/dalvikvm(806): threadid=3: still suspended after undo (s=1 d=1)
03-07 20:21:29.896: INFO/dalvikvm(806): Uncaught exception thrown by finalizer (will be discarded):
03-07 20:21:29.896: INFO/dalvikvm(806): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor#435d3c50 on ml_trackdata that has not been deactivated or closed
03-07 20:21:29.896: INFO/dalvikvm(806): at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
03-07 20:21:29.896: INFO/dalvikvm(806): at dalvik.system.NativeStart.run(Native Method)
03-07 20:21:31.468: DEBUG/dalvikvm(806): threadid=5: still suspended after undo (s=1 d=1)
03-07 20:21:32.436: WARN/IInputConnectionWrapper(806): showStatusIcon on inactive InputConnection
I,m still not sure why I,m getting the Connect problem on the Droid. I can use Voice Search ok. I also tried clearing the cache, and data as described in some posts, butstill not working??
/**
* Fire an intent to start the speech recognition activity.
*/
private void startVoiceRecognitionActivity() {
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speech recognition demo");
startActivityForResult(intent, VOICE_RECOGNITION_REQUEST_CODE);
}
/**
* Handle the results from the recognition activity.
*/
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == VOICE_RECOGNITION_REQUEST_CODE && resultCode == RESULT_OK) {
// Fill the list view with the strings the recognizer thought it could have heard
ArrayList<String> matches = data.getStringArrayListExtra(
RecognizerIntent.EXTRA_RESULTS);
mList.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,
matches));
}
super.onActivityResult(requestCode, resultCode, data);
}
Ok... problem fixed.
It appears you cannot use android:launchMode="singleInstance" when using the RecognizerIntent. I removed this from the manifest and the Voice Search runs correctly.
Thanks again Steve, for the info on USB debugging on the device. Very handy.
You can also use android:launchMode="singleTask"
It works fine with VS.