I've been trying to get this to work for the last week or so and still have no idea what the problem is. it works on android 2.1 but not on 4.1. ive got this string in a service that check for updates in my app.
Code:
latestVersion = Integer.parseInt(getHttpString(urlLatestVersion));
its called in checkForUpdate(); which is called in onStart(Intent intent, int startId);.
Code:
private String getHttpString(String urlString) throws IOException {
InputStream in = null;
int response = -1;
URL url = new URL(urlString);
URLConnection conn = url.openConnection();
if (!(conn instanceof HttpURLConnection))
throw new IOException("Not an HTTP connection");
try {
HttpURLConnection httpConn = (HttpURLConnection) conn;
httpConn.setAllowUserInteraction(false);
httpConn.setInstanceFollowRedirects(true);
httpConn.setRequestMethod("GET");
httpConn.connect();
response = httpConn.getResponseCode();
if (response == HttpURLConnection.HTTP_OK) {
in = httpConn.getInputStream();
}
} catch (Exception ex) {
ex.printStackTrace();
//
//main error currently lies here
// TODO fix errors that accures on android 4.0 and above.
//
}
if (in != null) {
StringBuilder sb = new StringBuilder();
String line;
try {
BufferedReader reader = new BufferedReader(
new InputStreamReader(in, "UTF-8"));
while ((line = reader.readLine()) != null) {
sb.append(line); // .append("\n");
}
} finally {
in.close();
}
return sb.toString();
} else
return "";
}
this is the error from the logcat
Code:
W/System.err( 7077): android.os.NetworkOnMainThreadException
W/System.err( 7077): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1117)
W/System.err( 7077): at java.net.InetAddress.lookupHostByName(InetAddress.java:385)
W/System.err( 7077): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
W/System.err( 7077): at java.net.InetAddress.getAllByName(InetAddress.java:214)
W/System.err( 7077): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:70)
W/System.err( 7077): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
W/System.err( 7077): at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:341)
W/System.err( 7077): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:87)
W/System.err( 7077): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
W/System.err( 7077): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:315)
W/System.err( 7077): at libcore.net.http.HttpEngine.connect(HttpEngine.java:310)
W/System.err( 7077): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:289)
W/System.err( 7077): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:239)
W/System.err( 7077): at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80)
W/System.err( 7077): at com.lukemovement.roottoolbox.pro.Update.getHttpString(Update.java:166)
W/System.err( 7077): at com.lukemovement.roottoolbox.pro.Update.checkForUpdate(Update.java:98)
W/System.err( 7077): at com.lukemovement.roottoolbox.pro.Update.onStart(Update.java:75)
W/System.err( 7077): at android.app.Service.onStartCommand(Service.java:450)
W/System.err( 7077): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2620)
W/System.err( 7077): at android.app.ActivityThread.access$1900(ActivityThread.java:143)
W/System.err( 7077): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1306)
W/System.err( 7077): at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err( 7077): at android.os.Looper.loop(Looper.java:137)
W/System.err( 7077): at android.app.ActivityThread.main(ActivityThread.java:4935)
W/System.err( 7077): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 7077): at java.lang.reflect.Method.invoke(Method.java:511)
W/System.err( 7077): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
W/System.err( 7077): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:558)
W/System.err( 7077): at dalvik.system.NativeStart.main(Native Method)
I/Example update( 7077): Invalid int: ""
so has android given up on being backwards compatible or have just just forgotten to add this bit in?
ive read that i need to use AsyncTask. but i cant seem to get it to work for me, could anyone help me with this please?
replaced
Code:
@Override
public void onStart(final Intent intent, int startId) {
with
Code:
@Override
public void onStart(final Intent intent, int startId) {
new Thread(new Runnable(){
@Override
public void run() {
fix the issue instantly.
lukemovement1 said:
replaced
Code:
@Override
public void onStart(final Intent intent, int startId) {
with
Code:
@Override
public void onStart(final Intent intent, int startId) {
new Thread(new Runnable(){
@Override
public void run() {
fix the issue instantly.
Click to expand...
Click to collapse
Yep!
You can't run your network requests on main thread. Use have to use AsyncTask. http://developer.android.com/reference/android/os/AsyncTask.html
Dear all,
i'm Fabrizio from Italy and i'm happy to be a new members of the forum.
I hope that this is a correct section :
I've two big problems with my android phone:
FIRST PROBLEM -CALENDARCG.APK If the phone is setting in english language , i can open the calendar, i can insert new event, i can edit event.
If i shift the phone in another language setting ( italian,french,german or other) i can open the calendar, but when i try to insert a new event,
i receive follow alert : "The application Calendar (process.com.android.calendar) has stopped unexpectedly. Please try again." - and asked to force close.
I tried to reset the phone, hard rest the hone, clear data but nothing..always same problem.
Please can you help me to solve these problem?? Have i to modify the AndroidManifest or what?
SECOND PROBLEM - PHONE.APK SOLVED
I decompiled Phone.apk( i've android 4.0.4 - multi apk tool with apktool 1.5.0- and i have to change translation on value-it ) without problem, and i tried to rebuild them (without change any file) and i received following error:
Code:
--------------------------------------------------------------------------
|05/12/2012 -- 22:08:37,87|
--------------------------------------------------------------------------
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)
I: Loading resource table...
W: Skipping "android" package group
I: Loaded.
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Users\fakate\apktool\framework\1.apk
I: Loaded.
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Done.
I: Copying assets and libs...
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
D:\android\APK\other\..\projects\Phone.apk\res\values\arrays.xml:158: error: Found tag reference-array where item is expected
D:\android\APK\other\..\projects\Phone.apk\res\values-nl\arrays.xml:131: error: Found tag reference-array where item is expected
D:\android\APK\other\..\projects\Phone.apk\res\values-pt-rPT\arrays.xml:131: error: Found tag reference-array where item is expected
D:\android\APK\other\..\projects\Phone.apk\res\values-es\strings.xml:248: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?
D:\android\APK\other\..\projects\Phone.apk\res\values-es\strings.xml:249: error: Unexpected end tag string
D:\android\APK\other\..\projects\Phone.apk\res\values-it\strings.xml:248: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?
D:\android\APK\other\..\projects\Phone.apk\res\values-it\strings.xml:249: error: Unexpected end tag string
D:\android\APK\other\..\projects\Phone.apk\res\values-ru\strings.xml:212: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?
D:\android\APK\other\..\projects\Phone.apk\res\values-ru\strings.xml:213: error: Unexpected end tag string
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:702: error: Public entry identifier 0x7f06002f entry index is larger than available symbols (index 47, total symbols 40).
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:702: error: Public symbol array/cdma_subscription_choices declared here is not defined.
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:695: error: Public entry identifier 0x7f060028 entry index is larger than available symbols (index 40, total symbols 40).
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:695: error: Public symbol array/cdma_subscription_values declared here is not defined.
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:689: error: Public symbol array/cdma_system_select_values declared here is not defined.
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:698: error: Public entry identifier 0x7f06002b entry index is larger than available symbols (index 43, total symbols 40).
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:698: error: Public symbol array/dtmf_tone_entries declared here is not defined.
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:699: error: Public symbol array/dtmf_tone_values declared here is not defined.
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:703: error: Public entry identifier 0x7f060030 entry index is larger than available symbols (index 48, total symbols 40).
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:703: error: Public symbol array/subscription_values declared here is not defined.
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:700: error: Public symbol array/td_network_mode_choices declared here is not defined.
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:701: error: Public symbol array/td_network_mode_values declared here is not defined.
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:696: error: Public entry identifier 0x7f060029 entry index is larger than available symbols (index 41, total symbols 40).
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:696: error: Public symbol array/tty_mode_entries declared here is not defined.
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:697: error: Public symbol array/tty_mode_values declared here is not defined.
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:674: error: Public symbol array/vt_incall_video_setting_entries2 declared here is not defined.
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:675: error: Public symbol array/vt_incall_video_setting_local_nightmode_entries declared here is not defined.
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:676: error: Public symbol array/vt_incall_video_setting_local_nightmode_entries2 declared here is not defined.
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:677: error: Public symbol array/vt_incall_video_setting_peer_quality_entries declared here is not defined.
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, --min-sdk-version, 10, --target-sdk-version, 10, -F, C:\Users\fakate\AppData\Local\Temp\APKTOOL5211967303135877753.tmp, -I, C:\Users\fakate\apktool\framework\1.apk, -S, D:\android\APK\other\..\projects\Phone.apk\res, -M, D:\android\APK\other\..\projects\Phone.apk\AndroidManifest.xml]
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:255)
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:324)
at brut.androlib.Androlib.buildResources(Androlib.java:269)
at brut.androlib.Androlib.build(Androlib.java:192)
at brut.androlib.Androlib.build(Androlib.java:174)
at brut.apktool.Main.cmdBuild(Main.java:188)
at brut.apktool.Main.main(Main.java:70)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, --min-sdk-version, 10, --target-sdk-version, 10, -F, C:\Users\fakate\AppData\Local\Temp\APKTOOL5211967303135877753.tmp, -I, C:\Users\fakate\apktool\framework\1.apk, -S, D:\android\APK\other\..\projects\Phone.apk\res, -M, D:\android\APK\other\..\projects\Phone.apk\AndroidManifest.xml]
at brut.util.OS.exec(OS.java:83)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:253)
... 6 more
How i can solve both problems?
Tnx in advance for your help,
Courtesy up
Up
Sent from my 4S clone using xda app-developers app
Up again
Sent from my 4S clone using xda app-developers app
Hi, Phone.apk building problem solved.
Now remain the problem of calendarCG.
Please can suggets me an evenual solution?
Tnx,
Fabrizio
HI,attached teh APK.
I supose that the problem is in the dex file.......
flagello79 said:
HI,attached teh APK.
I supose that the problem is in the dex file.......
Click to expand...
Click to collapse
Sorry for double post,
but yesterday i attached wrong file.
The correct file are below.
Please note that th efile CAlendarCG.odex.zi is only renamed ( remove .zip to have original odex file)
Thx for your support in this case
Rgds,
Fabrizio
This is the log
Code:
12-09 12:13:49.649 I/ActivityManager(163): Start proc com.android.providers.calendar for content provider com.android.providers.calendar/.CalendarProvider2: pid=1582 uid=10006 gids={3003}
12-09 12:13:49.650 E/look-----------------------------------------------(1573): 31
12-09 12:13:49.679 I/SurfaceFlinger(163): [SurfaceFlinger] statistic - FrameCount: 120, Duration: 4290277us, fps: 27.970222
12-09 12:13:49.723 V/ActivityManager(163): Binding process pid 1582 to record ProcessRecord{40a22528 1582:com.android.providers.calendar/10006}
12-09 12:13:49.723 V/ActivityManager(163): New death recipient [email protected]0a359a0 for thread [email protected]
12-09 12:13:49.724 V/ActivityManager(163): New app record ProcessRecord{40a22528 1582:com.android.providers.calendar/10006} [email protected] pid=1582
Sent from my 4S using xda app-developers app
And Aldo this one:
Code:
12-09 12:59:08.000 E/InputDispatcher(163): channel '40a630d0 com.android.calendar/com.android.calendar.MonthActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x8
12-09 12:59:08.000 E/InputDispatcher(163): channel '40a630d0 com.android.calendar/com.android.calendar.MonthActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
Sent from my 4S using xda app-developers app
And this us the log when i've the phone setting language in english:
Code:
12-09 14:30:45.378 I/ActivityManager(163): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.calendar/.LaunchActivity bnds=[320,576][472,740] } from pid 287
12-09 14:30:45.527 I/ActivityManager(163): Start proc com.android.calendar for activity com.android.calendar/.LaunchActivity: pid=3180 uid=10006 gids={3003}
12-09 14:30:45.615 V/ActivityManager(163): Binding process pid 3180 to record ProcessRecord{40ade2d8 3180:com.android.calendar/10006}
12-09 14:30:45.615 V/ActivityManager(163): New app record ProcessRecord{40ade2d8 3180:com.android.calendar/10006} [email protected] pid=3180
12-09 14:30:45.616 V/ActivityManager(163): Launching: HistoryRecord{40a270d8 com.android.calendar/.LaunchActivity}
12-09 14:30:45.760 E/LaunchActivity(3180): onAccountsLoaded startActivity: com.android.calendar.MonthActivity
12-09 14:30:45.760 I/ActivityManager(163): Starting: Intent { flg=0x20020000 cmp=com.android.calendar/.MonthActivity } from pid 3180
12-09 14:30:45.768 V/ActivityManager(163): Enqueueing pending finish: HistoryRecord{40a270d8 com.android.calendar/.LaunchActivity}
12-09 14:30:45.768 V/ActivityManager(163): Launching: HistoryRecord{40c148e0 com.android.calendar/.MonthActivity}
12-09 14:30:46.138 I/CalendarProvider(1582): CalendarProvider2: query,uri=content://com.android.calendar/properties
12-09 14:30:46.160 I/CalendarProvider(1582): CalendarProvider2: query,uri=content://com.android.calendar/instances/whenbyday/2456271/2456271
12-09 14:30:46.166 I/CalendarProvider(1582): CalendarProvider2: query,uri=content://com.android.calendar/instances/whenbyday/2456271/2456271
12-09 14:30:46.172 I/CalendarProvider(1582): CalendarProvider2: query,uri=content://com.android.calendar/instances/whenbyday/2456271/2456271
12-09 14:30:46.180 I/CalendarProvider(1582): CalendarProvider2: query,uri=content://com.android.calendar/instances/whenbyday/2456271/2456271
12-09 14:30:46.228 I/CalendarProvider(1582): CalendarProvider2: query,uri=content://com.android.calendar/instances/groupbyday/2456263/2456293
12-09 14:30:46.474 V/ActivityManager(163): Activity idle: HistoryRecord{40c148e0 com.android.calendar/.MonthActivity}
12-09 14:30:46.580 I/ActivityManager(163): [AppLaunch] Displayed com.android.calendar/.MonthActivity: +812ms (total +1s150ms)
12-09 14:30:46.580 D/ActivityManager(163): AP_PROF:AppLaunch_LaunchTime:com.android.calendar/.MonthActivity:812:4344566
12-09 14:30:47.190 I/ActivityManager(163): Starting: Intent { act=android.intent.action.EDIT cmp=com.android.calendar/.EditEvent (has extras) } from pid 3180
12-09 14:30:47.203 V/ActivityManager(163): Launching: HistoryRecord{40a97848 com.android.calendar/.EditEvent}
12-09 14:30:47.443 I/CalendarProvider(1582): CalendarProvider2: query,uri=content://com.android.calendar/calendars
12-09 14:30:47.666 V/ActivityManager(163): Activity idle: HistoryRecord{40a97848 com.android.calendar/.EditEvent}
12-09 14:30:47.666 V/ActivityManager(163): Stopping HistoryRecord{40c148e0 com.android.calendar/.MonthActivity}: nowVisible=false waitingVisible=true finishing=false
12-09 14:30:47.875 I/ActivityManager(163): [AppLaunch] Displayed com.android.calendar/.EditEvent: +671ms
12-09 14:30:47.875 D/ActivityManager(163): AP_PROF:AppLaunch_LaunchTime:com.android.calendar/.EditEvent:671:4345860
12-09 14:30:47.875 V/ActivityManager(163): Stopping HistoryRecord{40c148e0 com.android.calendar/.MonthActivity}: nowVisible=true waitingVisible=false finishing=false
12-09 14:30:47.875 V/ActivityManager(163): Ready to stop: HistoryRecord{40c148e0 com.android.calendar/.MonthActivity}
12-09 14:30:47.883 V/ActivityManager(163): Activity stopped: token=HistoryRecord{40c148e0 com.android.calendar/.MonthActivity}
12-09 14:30:48.338 I/ActivityManager(163): Starting: Intent { cmp=com.android.calendar/.StartAndEndActivity (has extras) } from pid 3180
12-09 14:30:48.368 V/ActivityManager(163): Launching: HistoryRecord{40b06ef0 com.android.calendar/.StartAndEndActivity}
12-09 14:30:48.765 V/ActivityManager(163): Activity idle: HistoryRecord{40b06ef0 com.android.calendar/.StartAndEndActivity}
12-09 14:30:48.766 V/ActivityManager(163): Stopping HistoryRecord{40a97848 com.android.calendar/.EditEvent}: nowVisible=false waitingVisible=true finishing=false
12-09 14:30:48.889 I/ActivityManager(163): [AppLaunch] Displayed com.android.calendar/.StartAndEndActivity: +521ms
12-09 14:30:48.889 D/ActivityManager(163): AP_PROF:AppLaunch_LaunchTime:com.android.calendar/.StartAndEndActivity:521:4346875
12-09 14:30:48.889 V/ActivityManager(163): Stopping HistoryRecord{40a97848 com.android.calendar/.EditEvent}: nowVisible=true waitingVisible=false finishing=false
Sent from my 4S using xda app-developers app
Up
Sent from my 4S using xda app-developers app
up again:banghead::banghead::banghead::banghead:
Sent from my 4S using xda app-developers app
THIS IS A COMPLETE ERROR LOG
Code:
12-11 22:14:57.342 V/AlarmManager(182): 6: dic 12 12:08:00 p. com.android.providers.calendar
12-11 22:15:28.049 I/ActivityManager(182): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.calendar/.LaunchActivity bnds=[320,576][472,740] } from pid 13361
12-11 22:15:28.117 I/ActivityManager(182): Start proc com.android.calendar for activity com.android.calendar/.LaunchActivity: pid=25243 uid=10006 gids={3003}
12-11 22:15:28.173 V/ActivityManager(182): Binding process pid 25243 to record ProcessRecord{406ab498 25243:com.android.calendar/10006}
12-11 22:15:28.173 V/ActivityManager(182): New app record ProcessRecord{406ab498 25243:com.android.calendar/10006} [email protected] pid=25243
12-11 22:15:28.174 V/ActivityManager(182): Launching: HistoryRecord{405467f8 com.android.calendar/.LaunchActivity}
12-11 22:15:28.275 E/LaunchActivity(25243): onAccountsLoaded startActivity: com.android.calendar.MonthActivity
12-11 22:15:28.276 I/ActivityManager(182): Starting: Intent { flg=0x20020000 cmp=com.android.calendar/.MonthActivity } from pid 25243
12-11 22:15:28.278 V/ActivityManager(182): Enqueueing pending finish: HistoryRecord{405467f8 com.android.calendar/.LaunchActivity}
12-11 22:15:28.279 V/ActivityManager(182): Launching: HistoryRecord{40546a50 com.android.calendar/.MonthActivity}
12-11 22:15:28.701 I/ActivityManager(182): Start proc com.android.providers.calendar for content provider com.android.providers.calendar/.CalendarProvider2: pid=25252 uid=10006 gids={3003}
12-11 22:15:28.771 V/ActivityManager(182): Binding process pid 25252 to record ProcessRecord{406bb860 25252:com.android.providers.calendar/10006}
12-11 22:15:28.771 V/ActivityManager(182): New app record ProcessRecord{406bb860 25252:com.android.providers.calendar/10006} [email protected] pid=25252
12-11 22:15:28.796 I/ActivityThread(25252): Pub com.android.calendar: com.android.providers.calendar.CalendarProvider2
12-11 22:15:28.856 I/CalendarProvider(25252): onAccountsUpdated.
12-11 22:15:28.942 I/CalendarProvider(25252): AccountManager data account,nae=XXXXXXXXXXXX,type=com.google
12-11 22:15:28.943 I/CalendarProvider(25252): AccountManager data account,nae=XXXXXXXXXXXXXt,type=com.facebook.auth.login
12-11 22:15:28.943 I/CalendarProvider(25252): AccountManager data account,nae=XXXXXXXXXXXX,type=com.whatsapp
12-11 22:15:28.961 I/CalendarProvider(25252): CalendarProvider2: query,uri=content://com.android.calendar/properties
12-11 22:15:28.967 I/CalendarProvider(25252): CalendarProvider2: query,uri=content://com.android.calendar/instances/whenbyday/2456273/2456273
12-11 22:15:28.988 I/CalendarProvider(25252): CalendarProvider2: query,uri=content://com.android.calendar/instances/whenbyday/2456273/2456273
12-11 22:15:29.023 I/CalendarProvider(25252): CalendarProvider2: query,uri=content://com.android.calendar/calendar_alerts
12-11 22:15:29.039 I/CalendarProvider(25252): CalendarProvider2: query,uri=content://com.android.calendar/instances/groupbyday/2456263/2456293
12-11 22:15:29.140 D/Calendar(25252): missed alarms found: 0
12-11 22:15:29.148 I/ActivityManager(182): [AppLaunch] Displayed com.android.calendar/.MonthActivity: +870ms (total +1s36ms)
12-11 22:15:29.148 D/ActivityManager(182): AP_PROF:AppLaunch_LaunchTime:com.android.calendar/.MonthActivity:870:55329649
12-11 22:15:29.184 V/ActivityManager(182): Activity idle: HistoryRecord{40546a50 com.android.calendar/.MonthActivity}
12-11 22:15:30.511 I/ActivityManager(182): Starting: Intent { act=android.intent.action.EDIT cmp=com.android.calendar/.EditEvent (has extras) } from pid 25243
12-11 22:15:30.526 V/ActivityManager(182): Launching: HistoryRecord{40546dc0 com.android.calendar/.EditEvent}
12-11 22:15:30.770 I/CalendarProvider(25252): CalendarProvider2: query,uri=content://com.android.calendar/calendars
12-11 22:15:31.015 V/ActivityManager(182): Activity idle: HistoryRecord{40546dc0 com.android.calendar/.EditEvent}
12-11 22:15:31.016 V/ActivityManager(182): Stopping HistoryRecord{40546a50 com.android.calendar/.MonthActivity}: nowVisible=false waitingVisible=true finishing=false
12-11 22:15:31.224 I/ActivityManager(182): [AppLaunch] Displayed com.android.calendar/.EditEvent: +698ms
12-11 22:15:31.224 D/ActivityManager(182): AP_PROF:AppLaunch_LaunchTime:com.android.calendar/.EditEvent:698:55331725
12-11 22:15:31.225 V/ActivityManager(182): Stopping HistoryRecord{40546a50 com.android.calendar/.MonthActivity}: nowVisible=true waitingVisible=false finishing=false
12-11 22:15:31.225 V/ActivityManager(182): Ready to stop: HistoryRecord{40546a50 com.android.calendar/.MonthActivity}
12-11 22:15:31.229 V/ActivityManager(182): Activity stopped: token=HistoryRecord{40546a50 com.android.calendar/.MonthActivity}
12-11 22:15:31.787 I/ActivityManager(182): Starting: Intent { cmp=com.android.calendar/.StartAndEndActivity (has extras) } from pid 25243
12-11 22:15:31.818 V/ActivityManager(182): Launching: HistoryRecord{40547250 com.android.calendar/.StartAndEndActivity}
12-11 22:15:32.012 W/ActivityManager(182): Force finishing activity com.android.calendar/.StartAndEndActivity
12-11 22:15:32.014 W/ActivityManager(182): Force finishing activity com.android.calendar/.EditEvent
12-11 22:15:32.014 V/ActivityManager(182): Enqueueing pending finish: HistoryRecord{40546dc0 com.android.calendar/.EditEvent}
12-11 22:15:32.183 D/AES (182): process : com.android.calendar
12-11 22:15:32.183 D/AES (182): module : com.android.calendar v10 (4.0.4)
12-11 22:15:32.186 D/AEE/LIBAEE(182): shell: raise_exp(2, 25243, -1361051648, com.android.calendar, 0x0x633db8, 0x0x0)
12-11 22:15:32.186 E/AEE/LIBAEE(182): read_cmdline:com.android.calendar
12-11 22:15:32.513 W/ActivityManager(182): Activity pause timeout for HistoryRecord{40547250 com.android.calendar/.StartAndEndActivity}
12-11 22:15:32.513 V/ActivityManager(182): Enqueueing pending finish: HistoryRecord{40547250 com.android.calendar/.StartAndEndActivity}
12-11 22:15:34.083 I/ActivityManager(182): Process com.android.calendar (pid 25243) has died.
12-11 22:15:34.083 V/ActivityManager(182): Dying app: ProcessRecord{406ab498 25243:com.android.calendar/10006}, pid: 25243, thread: [email protected]
12-11 22:15:34.083 V/ActivityManager(182): Removing app ProcessRecord{406ab498 0:com.android.calendar/10006} from list [HistoryRecord{40545a68 com.android.browser/.BrowserActivity}, HistoryRecord{409d0738 com.android.contacts/.DialtactsActivity}, HistoryRecord{40549ca8 com.android.mms/.ui.ConversationList}, HistoryRecord{40b0afc0 com.android.phone/.InCallScreen}, HistoryRecord{40a73bc0 com.android.launcher/.Launcher}, HistoryRecord{40546dc0 com.android.calendar/.EditEvent}, HistoryRecord{40547250 com.android.calendar/.StartAndEndActivity}, HistoryRecord{40546a50 com.android.calendar/.MonthActivity}] with 8 entries
12-11 22:15:34.084 V/ActivityManager(182): Record #7 HistoryRecord{40546a50 com.android.calendar/.MonthActivity}: app=ProcessRecord{406ab498 0:com.android.calendar/10006}
12-11 22:15:34.084 V/ActivityManager(182): Record #6 HistoryRecord{40547250 com.android.calendar/.StartAndEndActivity}: app=ProcessRecord{406ab498 0:com.android.calendar/10006}
12-11 22:15:34.084 V/ActivityManager(182): Record #5 HistoryRecord{40546dc0 com.android.calendar/.EditEvent}: app=ProcessRecord{406ab498 0:com.android.calendar/10006}
12-11 22:15:34.084 V/ActivityManager(182): Removing app ProcessRecord{406ab498 0:com.android.calendar/10006} from list [] with 0 entries
12-11 22:15:34.084 V/ActivityManager(182): Removing app ProcessRecord{406ab498 0:com.android.calendar/10006} from list [HistoryRecord{40547250 com.android.calendar/.StartAndEndActivity}] with 1 entries
12-11 22:15:34.084 V/ActivityManager(182): Record #0 HistoryRecord{40547250 com.android.calendar/.StartAndEndActivity}: app=ProcessRecord{406ab498 0:com.android.calendar/10006}
12-11 22:15:34.084 V/ActivityManager(182): Removing app ProcessRecord{406ab498 0:com.android.calendar/10006} from list [HistoryRecord{40546dc0 com.android.calendar/.EditEvent}, HistoryRecord{40547250 com.android.calendar/.StartAndEndActivity}] with 2 entries
12-11 22:15:34.084 V/ActivityManager(182): Record #1 HistoryRecord{40547250 com.android.calendar/.StartAndEndActivity}: app=ProcessRecord{406ab498 0:com.android.calendar/10006}
12-11 22:15:34.084 V/ActivityManager(182): Record #0 HistoryRecord{40546dc0 com.android.calendar/.EditEvent}: app=ProcessRecord{406ab498 0:com.android.calendar/10006}
12-11 22:15:34.084 V/ActivityManager(182): Removing app ProcessRecord{406ab498 0:com.android.calendar/10006} from history with 9 entries
12-11 22:15:34.084 V/ActivityManager(182): Record #8 HistoryRecord{40547250 com.android.calendar/.StartAndEndActivity}: app=ProcessRecord{406ab498 0:com.android.calendar/10006}
12-11 22:15:34.087 E/InputDispatcher(182): channel '4054b4c8 com.android.calendar/com.android.calendar.MonthActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x8
12-11 22:15:34.087 E/InputDispatcher(182): channel '4054b4c8 com.android.calendar/com.android.calendar.MonthActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
12-11 22:15:34.091 V/ActivityManager(182): Record #7 HistoryRecord{40546dc0 com.android.calendar/.EditEvent}: app=ProcessRecord{406ab498 0:com.android.calendar/10006}
12-11 22:15:34.095 I/WindowManager(182): WIN DEATH: Window{40568fb8 com.android.calendar/com.android.calendar.EditEvent paused=true}
No suggestion?no idea?
Sent from my 4S using xda app-developers app
Up
Sent from my 4S using xda app-developers app
..and finally MONTH ACTIVITY.class
PLEASE GIVE ME HELP TO FIND THE PROBLEM AND TO SOLVE THE BUG,SO I CAN USE THE CALENDAR ALSO WHE LANGUAGE PHONE SETTING IS IN ITALIAN,OR FRENCH,OR ANY OTHER LANGUAGES!
Code:
package com.android.calendar;
import android.app.Activity;
import android.content.*;
import android.database.ContentObserver;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import android.text.format.*;
import android.view.*;
import android.view.animation.*;
import android.widget.*;
import com.android.iphoneview.iphoneUtils;
import java.util.*;
// Referenced classes of package com.android.calendar:
// Navigator, MonthView, Utils, AgendaActivity,
// DayActivity, CalendarPreferenceActivity, EditEvent, EventLoader,
// CalendarApplication
public class MonthActivity extends Activity
implements android.widget.ViewSwitcher.ViewFactory, Navigator, android.view.animation.Animation.AnimationListener, android.view.View.OnClickListener
{
public MonthActivity()
{
mUpdateTZ = new _cls1();
oldlines = 0;
mIntentReceiver = new _cls2();
mObserver = new _cls3(new Handler());
}
void eventsChanged()
{
((MonthView)mSwitcher.getCurrentView()).reloadEvents();
}
public boolean getAllDay()
{
return false;
}
public long getSelectedTime()
{
return ((MonthView)mSwitcher.getCurrentView()).getSelectedTimeInMillis();
}
int getStartDay()
{
return mStartDay;
}
protected ViewSwitcher getSwitcher()
{
return mSwitcher;
}
public void goTo(Time time, boolean flag)
{
updateTitle(time);
MonthView monthview = (MonthView)mSwitcher.getCurrentView();
monthview.dismissPopup();
Time time1 = monthview.getTime();
if(flag)
{
int i = time1.month + 12 * time1.year;
MonthView monthview1;
if(time.month + 12 * time.year < i)
{
mSwitcher.setInAnimation(mInAnimationPast);
mSwitcher.setOutAnimation(mOutAnimationPast);
} else
{
mSwitcher.setInAnimation(mInAnimationFuture);
mSwitcher.setOutAnimation(mOutAnimationFuture);
}
}
monthview1 = (MonthView)mSwitcher.getNextView();
monthview1.setSelectionMode(monthview.getSelectionMode());
monthview1.setSelectedTime(time);
monthview1.reloadEvents();
setListview(monthview1.minLines());
monthview1.animationStarted();
mSwitcher.showNext();
monthview1.requestFocus();
mTime = time;
}
public void goToToday()
{
Time time = new Time(Utils.getTimeZone(this, mUpdateTZ));
time.set(System.currentTimeMillis());
time.minute = 0;
time.second = 0;
time.normalize(false);
((TextView)findViewById(0x7f0d0013)).setText(iphoneUtils.formatMonthYear(time));
mTime = time;
MonthView monthview = (MonthView)mSwitcher.getCurrentView();
monthview.setSelectedTime(time);
monthview.reloadEvents();
}
public View makeView()
{
MonthView monthview = new MonthView(this, this);
monthview.setLayoutParams(new android.widget.FrameLayout.LayoutParams(-1, -1));
monthview.setSelectedTime(mTime);
return monthview;
}
public void onAnimationEnd(Animation animation)
{
((MonthView)mSwitcher.getCurrentView()).animationFinished();
}
public void onAnimationRepeat(Animation animation)
{
}
public void onAnimationStart(Animation animation)
{
}
public void onClick(View view)
{
if(!view.equals(mTabAgenda)) goto _L2; else goto _L1
_L1:
iphoneUtils.startActivity(this, com/android/calendar/AgendaActivity.getName(), getSelectedTime());
iphoneUtils.cancelAnimationAndFinishActivity(this);
_L4:
return;
_L2:
if(view.equals(mTabDay))
{
iphoneUtils.startActivity(this, com/android/calendar/DayActivity.getName(), getSelectedTime());
iphoneUtils.cancelAnimationAndFinishActivity(this);
} else
if(view.equals(mButtonSetting))
iphoneUtils.startActivity(this, com/android/calendar/CalendarPreferenceActivity.getName(), getSelectedTime());
else
if(view.equals(mButtonAddEvent))
{
long l = getSelectedTime();
long l1 = l + 0x36ee80L;
Intent intent = new Intent("android.intent.action.EDIT");
intent.setClassName(this, com/android/calendar/EditEvent.getName());
intent.putExtra("beginTime", l);
intent.putExtra("endTime", l1);
intent.putExtra("allDay", getAllDay());
startActivity(intent);
overridePendingTransition(0x7f040000, 0x7f04000d);
} else
if(view.equals(mButtonToday))
goToToday();
if(true) goto _L4; else goto _L3
_L3:
}
protected void onCreate(Bundle bundle)
{
super.onCreate(bundle);
setRequestedOrientation(1);
setContentView(0x7f030019);
mContentResolver = getContentResolver();
long l;
int i;
String s;
String s1;
String s2;
String s3;
String s4;
String s5;
String s6;
if(bundle != null)
l = bundle.getLong("beginTime");
else
l = iphoneUtils.timeFromIntentInMillis(getIntent());
mTime = new Time(Utils.getTimeZone(this, mUpdateTZ));
mTime.set(l);
mTime.normalize(true);
mStartDay = Calendar.getInstance().getFirstDayOfWeek();
i = mStartDay - 1 - 1;
s = DateUtils.getDayOfWeekString(1 + (i + 1) % 7, 20);
((TextView)findViewById(0x7f0d00a7)).setText(s);
s1 = DateUtils.getDayOfWeekString(1 + (i + 2) % 7, 20);
((TextView)findViewById(0x7f0d00a8)).setText(s1);
s2 = DateUtils.getDayOfWeekString(1 + (i + 3) % 7, 20);
((TextView)findViewById(0x7f0d00a9)).setText(s2);
s3 = DateUtils.getDayOfWeekString(1 + (i + 4) % 7, 20);
((TextView)findViewById(0x7f0d00aa)).setText(s3);
s4 = DateUtils.getDayOfWeekString(1 + (i + 5) % 7, 20);
((TextView)findViewById(0x7f0d00ab)).setText(s4);
s5 = DateUtils.getDayOfWeekString(1 + (i + 6) % 7, 20);
((TextView)findViewById(0x7f0d00ac)).setText(s5);
s6 = DateUtils.getDayOfWeekString(1 + (i + 7) % 7, 20);
((TextView)findViewById(0x7f0d00ad)).setText(s6);
((TextView)findViewById(0x7f0d0013)).setText(iphoneUtils.formatMonthYear(mTime));
mEventLoader = new EventLoader(this);
mProgressBar = (ProgressBar)findViewById(0x7f0d0033);
mSwitcher = (ViewSwitcher)findViewById(0x7f0d0034);
mSwitcher.setFactory(this);
mSwitcher.getCurrentView().requestFocus();
mInAnimationPast = AnimationUtils.loadAnimation(this, 0x7f040004);
mOutAnimationPast = AnimationUtils.loadAnimation(this, 0x7f040005);
mInAnimationFuture = AnimationUtils.loadAnimation(this, 0x7f04000a);
mOutAnimationFuture = AnimationUtils.loadAnimation(this, 0x7f04000b);
mInAnimationPast.setAnimationListener(this);
mInAnimationFuture.setAnimationListener(this);
ll = (LinearLayout)findViewById(0x7f0d00ae);
mTabAgenda = (TextView)findViewById(0x7f0d000d);
mTabAgenda.setOnClickListener(this);
mTabDay = (TextView)findViewById(0x7f0d000e);
mTabDay.setOnClickListener(this);
mButtonSetting = (Button)findViewById(0x7f0d0002);
mButtonSetting.setOnClickListener(this);
mButtonAddEvent = (Button)findViewById(0x7f0d0004);
mButtonAddEvent.setOnClickListener(this);
mButtonToday = (Button)findViewById(0x7f0d000c);
mButtonToday.setOnClickListener(this);
}
public boolean onCreateOptionsMenu(Menu menu)
{
return super.onCreateOptionsMenu(menu);
}
protected void onNewIntent(Intent intent)
{
long l = iphoneUtils.timeFromIntentInMillis(intent);
if(l > 0L)
{
Time time = new Time(Utils.getTimeZone(this, mUpdateTZ));
time.set(l);
goTo(time, false);
}
}
public boolean onOptionsItemSelected(MenuItem menuitem)
{
return super.onOptionsItemSelected(menuitem);
}
protected void onPause()
{
super.onPause();
if(isFinishing())
mEventLoader.stopBackgroundThread();
mContentResolver.unregisterContentObserver(mObserver);
unregisterReceiver(mIntentReceiver);
((MonthView)mSwitcher.getCurrentView()).dismissPopup();
((MonthView)mSwitcher.getNextView()).dismissPopup();
mEventLoader.stopBackgroundThread();
CalendarApplication.setDefaultView(this, 0);
}
public boolean onPrepareOptionsMenu(Menu menu)
{
return super.onPrepareOptionsMenu(menu);
}
protected void onResume()
{
super.onResume();
mUpdateTZ.run();
mEventLoader.startBackgroundThread();
eventsChanged();
MonthView monthview = (MonthView)mSwitcher.getCurrentView();
MonthView monthview1 = (MonthView)mSwitcher.getNextView();
String s = PreferenceManager.getDefaultSharedPreferences(this).getString("preferredDetailedView", CalendarPreferenceActivity.DEFAULT_DETAILED_VIEW);
monthview.updateView();
monthview1.updateView();
monthview.setDetailedView(s);
monthview1.setDetailedView(s);
IntentFilter intentfilter = new IntentFilter();
intentfilter.addAction("android.intent.action.TIME_SET");
intentfilter.addAction("android.intent.action.DATE_CHANGED");
intentfilter.addAction("android.intent.action.TIMEZONE_CHANGED");
registerReceiver(mIntentReceiver, intentfilter);
setListview(monthview.minLines());
mContentResolver.registerContentObserver(android.provider.Calendar.Events.CONTENT_URI, true, mObserver);
}
protected void onSaveInstanceState(Bundle bundle)
{
super.onSaveInstanceState(bundle);
bundle.putLong("beginTime", mTime.toMillis(true));
}
public void setListview(int i)
{
lp = (android.widget.RelativeLayout.LayoutParams)ll.getLayoutParams();
newHeight = 110;
if(oldlines == i) goto _L2; else goto _L1
_L1:
if(i != 4) goto _L4; else goto _L3
_L3:
newHeight = 290;
_L6:
lp.height = newHeight;
if(oldHeight != 0)
{
TranslateAnimation translateanimation = new TranslateAnimation(0.0F, 0.0F, newHeight - oldHeight, 0.0F);
translateanimation.setDuration(400L);
ll.startAnimation(translateanimation);
}
oldlines = i;
oldHeight = newHeight;
_L2:
return;
_L4:
if(i == 5)
newHeight = 200;
else
if(i == 6)
newHeight = 110;
if(true) goto _L6; else goto _L5
_L5:
}
protected void startProgressSpinner()
{
mProgressBar.setVisibility(0);
}
protected void stopProgressSpinner()
{
mProgressBar.setVisibility(8);
}
public void updateTitle(Time time)
{
TextView textview = (TextView)findViewById(0x7f0d0013);
StringBuffer stringbuffer = new StringBuffer(iphoneUtils.formatMonthYear(time));
if(!TextUtils.equals(Utils.getTimeZone(this, mUpdateTZ), Time.getCurrentTimezone()))
{
int i = 1;
if(DateFormat.is24HourFormat(this))
i |= 0x80;
long l = System.currentTimeMillis();
String s = Utils.getTimeZone(this, mUpdateTZ);
boolean flag;
TimeZone timezone;
if(time.isDst != 0)
flag = true;
else
flag = false;
timezone = TimeZone.getTimeZone(s);
stringbuffer.append(" (").append(Utils.formatDateRange(this, l, l, i)).append(" ").append(timezone.getDisplayName(flag, 0, Locale.getDefault())).append(")");
}
textview.setText(stringbuffer.toString());
}
private static final boolean DEBUG = true;
private static final int INITIAL_HEAP_SIZE = 0x400000;
private static final String TAG = "MonthActivity";
private LinearLayout ll;
private android.widget.RelativeLayout.LayoutParams lp;
private Button mButtonAddEvent;
private Button mButtonSetting;
private Button mButtonToday;
private ContentResolver mContentResolver;
EventLoader mEventLoader;
private Animation mInAnimationFuture;
private Animation mInAnimationPast;
private BroadcastReceiver mIntentReceiver;
private ContentObserver mObserver;
private Animation mOutAnimationFuture;
private Animation mOutAnimationPast;
private ProgressBar mProgressBar;
private int mStartDay;
private ViewSwitcher mSwitcher;
private TextView mTabAgenda;
private TextView mTabDay;
private Time mTime;
private Runnable mUpdateTZ;
private int newHeight;
private int oldHeight;
private int oldlines;
private class _cls1
implements Runnable
{
public void run()
{
mTime.timezone = Utils.getTimeZone(MonthActivity.this, this);
mTime.normalize(true);
updateTitle(mTime);
}
final MonthActivity this$0;
_cls1()
{
this$0 = MonthActivity.this;
super();
}
}
private class _cls2 extends BroadcastReceiver
{
public void onReceive(Context context, Intent intent)
{
String s = intent.getAction();
if(s.equals("android.intent.action.TIME_SET") || s.equals("android.intent.action.DATE_CHANGED") || s.equals("android.intent.action.TIMEZONE_CHANGED"))
eventsChanged();
}
final MonthActivity this$0;
_cls2()
{
this$0 = MonthActivity.this;
super();
}
}
private class _cls3 extends ContentObserver
{
public boolean deliverSelfNotifications()
{
return true;
}
public void onChange(boolean flag)
{
eventsChanged();
}
final MonthActivity this$0;
_cls3(Handler handler)
{
this$0 = MonthActivity.this;
super(handler);
}
}
}
UP:crying: :crying: :crying: :crying: :crying: :crying:
I was able to easily connect/disconnect and receive from my bluetooth remote device with my android phone running ICS (4.0.4).
Recently, somehow, my app doesn't work anymore.
There's no error, just no data is sent or received, because there's no socket created in connection.
My first guess is my hardware, but it's not.
I tried my basic bluetooth connection apps and they won't work neither.
Here is the logcat :
Code:
01-05 22:04:42.576: D/bluetooth2(5316): ...Connecting...
01-05 22:04:42.576: I/BluetoothSocket_MTK(5316): [JSR82] connect: do SDP
01-05 22:04:42.577: I/BluetoothSocket_MTK(5316): [JSR82] close
01-05 22:04:42.577: I/BluetoothSocket_MTK(5316): [JSR82] readLock got.
01-05 22:04:42.577: I/BluetoothSocket_MTK(5316): [JSR82] Start to aquire writeLock.
01-05 22:04:42.577: I/BluetoothSocket_MTK(5316): [JSR82] writeLock got.
01-05 22:04:42.578: D/bluetooth2(5316): ...Create Socket...
01-05 22:04:42.584: D/dalvikvm(5316): threadid=14: interp stack at 0x4d1b5000
01-05 22:04:42.587: D/dalvikvm(5316): threadid=14 (Thread-371): calling run()
01-05 22:04:42.594: D/Buffer read(5316): ...[[email protected]
01-05 22:04:42.594: D/dalvikvm(5316): threadid=14: exiting
01-05 22:04:42.594: D/dalvikvm(5316): threadid=14: bye!
01-05 22:04:42.594: D/dalvikvm(5316): threadid=0: freeing
01-05 22:04:43.135: I/BluetoothSocket_MTK(5316): [JSR82] SdpHelper::onRfcommChannelFound: channel=-1
01-05 22:04:43.135: I/BluetoothSocket_MTK(5316): [JSR82] close
01-05 22:04:43.135: I/BluetoothSocket_MTK(5316): [JSR82] readLock got.
01-05 22:04:43.135: D/bluetooth2(5316): ...Create Socket...
01-05 22:04:43.138: D/dalvikvm(5316): threadid=14: interp stack at 0x4d1b5000
01-05 22:04:43.138: D/dalvikvm(5316): threadid=14 (Thread-372): calling run()
01-05 22:04:43.138: D/Buffer read(5316): ...[[email protected]
01-05 22:04:43.138: D/dalvikvm(5316): threadid=14: exiting
01-05 22:04:43.138: D/dalvikvm(5316): threadid=14: bye!
01-05 22:04:43.138: D/dalvikvm(5316): threadid=0: freeing
01-05 22:04:43.149: I/BluetoothSocket_MTK(5316): [JSR82] close
01-05 22:04:43.149: I/BluetoothSocket_MTK(5316): [JSR82] readLock got.
01-05 22:04:46.149: I/BluetoothSocket_MTK(5316): [JSR82] Bluetooth Socket Constructor
01-05 22:04:46.150: I/BluetoothSocket_MTK(5316): [JSR82] type=1 fd=-1 auth=false encrypt=false port=-1
I use this UUID
Code:
// SPP UUID service
private static final UUID MY_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
My snippet bluetooth connection
Code:
private BluetoothSocket createBluetoothSocket(BluetoothDevice device) throws IOException {
if(Build.VERSION.SDK_INT >= 10){
try {
final Method m = device.getClass().getMethod("createInsecureRfcommSocketToServiceRecord", new Class[] { UUID.class });
return (BluetoothSocket) m.invoke(device, MY_UUID);
} catch (Exception e) {
Log.e(TAG, "Could not create Insecure RFComm Connection",e);
}
}
return device.createRfcommSocketToServiceRecord(MY_UUID);
}
public void bluetoothDisconnect(){
try {
btSocket.close();
} catch (IOException e2) {
errorExit("Fatal Error", "In onPause() and failed to close socket." + e2.getMessage() + ".");
}
}
public void bluetoothConnect(){
BluetoothDevice device = btAdapter.getRemoteDevice(address);
try {
btSocket = createBluetoothSocket(device);
} catch (IOException e) {
errorExit("Fatal Error", "In onResume() and socket create failed: " + e.getMessage() + ".");
}
btAdapter.cancelDiscovery();
Log.d(TAG, "...Connecting...");
try {
btSocket.connect();
Log.d(TAG, "....Connection ok...");
} catch (IOException e) {
try {
btSocket.close();
} catch (IOException e2) {
errorExit("Fatal Error", "In onResume() and unable to close socket during connection failure" + e2.getMessage() + ".");
}
}
// Create a data stream so we can talk to server.
Log.d(TAG, "...Create Socket...");
mConnectedThread = new ConnectedThread(btSocket);
mConnectedThread.start();
}
I guess there's no socket created, but I don't know why. It was fine before for a month.
Some people also have this similar issue. I have tried several solution there but zero result.
Any idea would be appreciate
Hello,
I am also facing this issue.Have you found a solution to this Pl help.
oneitusatu said:
I was able to easily connect/disconnect and receive from my bluetooth remote device with my android phone running ICS (4.0.4).
Recently, somehow, my app doesn't work anymore.
There's no error, just no data is sent or received, because there's no socket created in connection.
My first guess is my hardware, but it's not.
I tried my basic bluetooth connection apps and they won't work neither.
Here is the logcat :
Code:
01-05 22:04:42.576: D/bluetooth2(5316): ...Connecting...
01-05 22:04:42.576: I/BluetoothSocket_MTK(5316): [JSR82] connect: do SDP
01-05 22:04:42.577: I/BluetoothSocket_MTK(5316): [JSR82] close
01-05 22:04:42.577: I/BluetoothSocket_MTK(5316): [JSR82] readLock got.
01-05 22:04:42.577: I/BluetoothSocket_MTK(5316): [JSR82] Start to aquire writeLock.
01-05 22:04:42.577: I/BluetoothSocket_MTK(5316): [JSR82] writeLock got.
01-05 22:04:42.578: D/bluetooth2(5316): ...Create Socket...
01-05 22:04:42.584: D/dalvikvm(5316): threadid=14: interp stack at 0x4d1b5000
01-05 22:04:42.587: D/dalvikvm(5316): threadid=14 (Thread-371): calling run()
01-05 22:04:42.594: D/Buffer read(5316): ...[[email protected]
01-05 22:04:42.594: D/dalvikvm(5316): threadid=14: exiting
01-05 22:04:42.594: D/dalvikvm(5316): threadid=14: bye!
01-05 22:04:42.594: D/dalvikvm(5316): threadid=0: freeing
01-05 22:04:43.135: I/BluetoothSocket_MTK(5316): [JSR82] SdpHelper::onRfcommChannelFound: channel=-1
01-05 22:04:43.135: I/BluetoothSocket_MTK(5316): [JSR82] close
01-05 22:04:43.135: I/BluetoothSocket_MTK(5316): [JSR82] readLock got.
01-05 22:04:43.135: D/bluetooth2(5316): ...Create Socket...
01-05 22:04:43.138: D/dalvikvm(5316): threadid=14: interp stack at 0x4d1b5000
01-05 22:04:43.138: D/dalvikvm(5316): threadid=14 (Thread-372): calling run()
01-05 22:04:43.138: D/Buffer read(5316): ...[[email protected]
01-05 22:04:43.138: D/dalvikvm(5316): threadid=14: exiting
01-05 22:04:43.138: D/dalvikvm(5316): threadid=14: bye!
01-05 22:04:43.138: D/dalvikvm(5316): threadid=0: freeing
01-05 22:04:43.149: I/BluetoothSocket_MTK(5316): [JSR82] close
01-05 22:04:43.149: I/BluetoothSocket_MTK(5316): [JSR82] readLock got.
01-05 22:04:46.149: I/BluetoothSocket_MTK(5316): [JSR82] Bluetooth Socket Constructor
01-05 22:04:46.150: I/BluetoothSocket_MTK(5316): [JSR82] type=1 fd=-1 auth=false encrypt=false port=-1
I use this UUID
Code:
// SPP UUID service
private static final UUID MY_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
My snippet bluetooth connection
Code:
private BluetoothSocket createBluetoothSocket(BluetoothDevice device) throws IOException {
if(Build.VERSION.SDK_INT >= 10){
try {
final Method m = device.getClass().getMethod("createInsecureRfcommSocketToServiceRecord", new Class[] { UUID.class });
return (BluetoothSocket) m.invoke(device, MY_UUID);
} catch (Exception e) {
Log.e(TAG, "Could not create Insecure RFComm Connection",e);
}
}
return device.createRfcommSocketToServiceRecord(MY_UUID);
}
public void bluetoothDisconnect(){
try {
btSocket.close();
} catch (IOException e2) {
errorExit("Fatal Error", "In onPause() and failed to close socket." + e2.getMessage() + ".");
}
}
public void bluetoothConnect(){
BluetoothDevice device = btAdapter.getRemoteDevice(address);
try {
btSocket = createBluetoothSocket(device);
} catch (IOException e) {
errorExit("Fatal Error", "In onResume() and socket create failed: " + e.getMessage() + ".");
}
btAdapter.cancelDiscovery();
Log.d(TAG, "...Connecting...");
try {
btSocket.connect();
Log.d(TAG, "....Connection ok...");
} catch (IOException e) {
try {
btSocket.close();
} catch (IOException e2) {
errorExit("Fatal Error", "In onResume() and unable to close socket during connection failure" + e2.getMessage() + ".");
}
}
// Create a data stream so we can talk to server.
Log.d(TAG, "...Create Socket...");
mConnectedThread = new ConnectedThread(btSocket);
mConnectedThread.start();
}
I guess there's no socket created, but I don't know why. It was fine before for a month.
Some people also have this similar issue. I have tried several solution there but zero result.
Any idea would be appreciate
Click to expand...
Click to collapse
Hi, I have problem with Nexus 9 that belongs to my parents. Device was working without problems for over 2 years but after update to 7.1 something really bad happened. Device cannot play any video in youtube app, and there is some problem with sound - for example I cannot play any music in google play music. There are some other troubles as well - for example voice search doesn't work at all - when I try to run voice search there is a message "Device cannot connect to Google". Firstly I thought that something happened in 7.1 and even flashed CM 14.1 but everything was the same, then I tried stock image of android 6 but without success, still same situation. Now I returned to stock 7.1. Today connected logcat and below is sample log of what happens when I try to play some video in YT app:
01-05 15:14:20.147 19721 19769 W YouTube : Pinging https://s.youtube.com/api/stats/qoe...ps=32.223:N&fmt=136&cache_bytes=30.001:235719
01-05 15:14:20.226 11930 22191 V Avrcp : Active sessions changed, 1 sessions
01-05 15:14:20.226 11930 22191 V Avrcp : Updating media controller to [email protected]
01-05 15:14:20.233 11930 22191 V Avrcp : Updated [MediaAttributes: UK - kierowca autobusu to Polak - by switcher44 (0/0) ] but no change!
01-05 15:14:20.293 256 12530 I MediaPlayerService: MediaPlayerService::getOMX
01-05 15:14:20.294 19721 21432 I OMXClient: MuxOMX ctor
01-05 15:14:20.295 253 26224 I OMXMaster: makeComponentInstance(OMX.google.aac.decoder) in mediacodec process
01-05 15:14:20.327 253 21433 I SoftAAC2: Reconfiguring decoder: 0->44100 Hz, 0->2 channels
01-05 15:14:20.334 19721 19726 I art : Do full code cache collection, code=505KB, data=440KB
01-05 15:14:20.359 19721 19726 I art : Starting a blocking GC JitCodeCache
01-05 15:14:20.359 19721 19726 I art : After code cache collection, code=386KB, data=332KB
01-05 15:14:20.371 256 12529 I MediaPlayerService: MediaPlayerService::getOMX
01-05 15:14:20.371 19721 21436 I OMXClient: MuxOMX ctor
01-05 15:14:20.372 253 1377 I OMXMaster: makeComponentInstance(OMX.Nvidia.h264.decode) in mediacodec process
01-05 15:14:20.381 19721 21435 I MediaCodec: [OMX.Nvidia.h264.decode] setting surface generation to 20194313
01-05 15:14:20.384 253 1377 E OMXNodeInstance: getConfig(fd008f:Nvidia.h264.decode, ConfigCommonOutputCrop(0x700000f)) ERROR: BadParameter(0x80001005)
01-05 15:14:20.390 19721 21436 D SurfaceUtils: set up nativeWindow 0x7a42b8da10 for 1280x720, color 0x106, rotation 0, usage 0x2b00
01-05 15:14:20.393 253 21437 D NvOsDebugPrintf: NvMMLiteOpen : Block : BlockType = 261
01-05 15:14:20.393 253 21437 D NvOsDebugPrintf: TVMR: NvMMLiteTVMRDecBlockOpen: 5008: NvMMLiteBlockOpen
01-05 15:14:20.402 253 21437 D NvOsDebugPrintf: NvMMLiteBlockCreate : Block : BlockType = 261
01-05 15:14:20.424 248 248 W APM_AudioPolicyManager: getOutput() could not find output for stream 3, samplingRate 0,format 0, channels 3, flags 0
01-05 15:14:20.424 19721 21428 E AudioTrack: Unable to query output sample rate for stream type -1; status -1
01-05 15:14:20.424 19721 21428 E AudioTrack-JNI: AudioTrack::getMinFrameCount() for sample rate 44100 failed with status -1
01-05 15:14:20.425 19721 21428 E android.media.AudioTrack: getMinBufferSize(): error querying hardware
01-05 15:14:20.426 248 18502 W APM_AudioPolicyManager: getOutput() could not find output for stream 3, samplingRate 44100,format 1, channels 3, flags 0
01-05 15:14:20.426 19721 21428 E AudioTrack: Could not get audio output for session 16305, stream type -1, usage 1, sample rate 44100, format 0x1, channel mask 0x3, flags 0
01-05 15:14:20.427 19721 21428 E AudioTrack-JNI: Error -22 initializing AudioTrack
01-05 15:14:20.427 19721 21428 E android.media.AudioTrack: Error code -20 when initializing AudioTrack.
01-05 15:14:20.429 19721 19721 E YouTube : Error with ExoPlayer audio track initialization.
01-05 15:14:20.429 19721 19721 E YouTube : hgx: AudioTrack init failed: 0, Config(44100, 12, 44100)
01-05 15:14:20.429 19721 19721 E YouTube : at hgs.a(SourceFile:2930)
01-05 15:14:20.429 19721 19721 E YouTube : at hfe.a(SourceFile:3453)
01-05 15:14:20.429 19721 19721 E YouTube : at hfl.a(SourceFile:12954)
01-05 15:14:20.429 19721 19721 E YouTube : at hgj.a(SourceFile:128)
01-05 15:14:20.429 19721 19721 E YouTube : at hfa.handleMessage(SourceFile:1432)
01-05 15:14:20.429 19721 19721 E YouTube : at android.os.Handler.dispatchMessage(Handler.java:98)
01-05 15:14:20.429 19721 19721 E YouTube : at android.os.Looper.loop(Looper.java:154)
01-05 15:14:20.429 19721 19721 E YouTube : at android.os.HandlerThread.run(HandlerThread.java:61)
01-05 15:14:20.429 19721 19721 E YouTube : at hsu.run(SourceFile:40)
01-05 15:14:20.429 19721 21428 E ExoPlayerImplInternal: Internal track renderer error.
01-05 15:14:20.429 19721 21428 E ExoPlayerImplInternal: het: hgx: AudioTrack init failed: 0, Config(44100, 12, 44100)
01-05 15:14:20.429 19721 21428 E ExoPlayerImplInternal: at hfe.a(SourceFile:395)
01-05 15:14:20.429 19721 21428 E ExoPlayerImplInternal: at hfl.a(SourceFile:12954)
01-05 15:14:20.429 19721 21428 E ExoPlayerImplInternal: at hgj.a(SourceFile:128)
01-05 15:14:20.429 19721 21428 E ExoPlayerImplInternal: at hfa.handleMessage(SourceFile:1432)
01-05 15:14:20.429 19721 21428 E ExoPlayerImplInternal: at android.os.Handler.dispatchMessage(Handler.java:98)
01-05 15:14:20.429 19721 21428 E ExoPlayerImplInternal: at android.os.Looper.loop(Looper.java:154)
01-05 15:14:20.429 19721 21428 E ExoPlayerImplInternal: at android.os.HandlerThread.run(HandlerThread.java:61)
01-05 15:14:20.429 19721 21428 E ExoPlayerImplInternal: at hsu.run(SourceFile:40)
01-05 15:14:20.429 19721 21428 E ExoPlayerImplInternal: Caused by: hgx: AudioTrack init failed: 0, Config(44100, 12, 44100)
01-05 15:14:20.429 19721 21428 E ExoPlayerImplInternal: at hgs.a(SourceFile:2930)
01-05 15:14:20.429 19721 21428 E ExoPlayerImplInternal: at hfe.a(SourceFile:3453)
01-05 15:14:20.429 19721 21428 E ExoPlayerImplInternal: ... 7 more
01-05 15:14:20.444 11930 22191 V Avrcp : MediaController playback changed: PlaybackState {state=7, position=0, buffered position=0, speed=1.0, updated=65833230, actions=262, custom actions=[], active item id=-1, error=null}
01-05 15:14:20.454 253 21439 D NvOsDebugPrintf: TVMR: cbBeginSequence: 655: BeginSequence 1280x720, bVPR = 0
01-05 15:14:20.454 253 21439 D NvOsDebugPrintf: TVMR: cbBeginSequence: 918: DecodeBuffers = 4
01-05 15:14:20.457 253 21439 D NvOsDebugPrintf: TVMR: cbBeginSequence: 938: Display Resolution : (1280x720)
01-05 15:14:20.457 253 21439 D NvOsDebugPrintf: TVMR: cbBeginSequence: 939: Display Aspect Ratio : (1280x720)
01-05 15:14:20.457 253 21439 D NvOsDebugPrintf: TVMR: cbBeginSequence: 1041: SurfaceLayout = 3
01-05 15:14:20.457 253 21439 D NvOsDebugPrintf: TVMR: cbBeginSequence: 1071: NumOfSurfaces = 8, InteraceStream = 0, InterlaceEnabled = 0, bSecure = 0, MVC = 0 Semiplanar = 1, bReinit = 1
01-05 15:14:20.457 253 21439 D NvOsDebugPrintf: Allocating new output: 1280x720 (x 10), ThumbnailMode = 0
01-05 15:14:20.465 19721 21436 D SurfaceUtils: set up nativeWindow 0x7a42b8da10 for 1280x720, color 0x106, rotation 0, usage 0x2b00
01-05 15:14:20.466 253 26224 E OMXNodeInstance: setParameter(fd008f:Nvidia.h264.decode, ParamPortDefinition(0x2000001)) ERROR: UnsupportedSetting(0x80001019)
01-05 15:14:20.466 19721 21436 W ACodec : [OMX.Nvidia.h264.decode] setting nBufferCountActual to 14 failed: -1010
01-05 15:14:20.466 253 19218 E OMXNodeInstance: setParameter(fd008f:Nvidia.h264.decode, ParamPortDefinition(0x2000001)) ERROR: UnsupportedSetting(0x80001019)
01-05 15:14:20.466 19721 21436 W ACodec : [OMX.Nvidia.h264.decode] setting nBufferCountActual to 13 failed: -1010
01-05 15:14:20.509 253 21440 D NvOsDebugPrintf: TVMR: TVMRFrameDelivery: 3741: Closing TVMR Frame Delivery Thread -------------
01-05 15:14:20.513 253 21437 D NvOsDebugPrintf: TVMR: NvMMDecTVMRDestroyParser: 4224: NvAvpClose
01-05 15:14:20.513 253 21437 D NvOsDebugPrintf: TVMR: NvMMLiteTVMRDecBlockClose: 5163: Done
01-05 15:14:20.540 19721 19742 W YouTube : Pinging https://s.youtube.com/api/stats/qoe...,0.037:B,0.252:ER&fmt=136&view=0.158:1536:864
01-05 15:14:20.626 254 254 W mediadrmserver: type=1400 audit(0.0:478): avc: denied { read write } for name="nvmap" dev="tmpfs" ino=9815 scontext=u:r:mediadrmserver:s0 tcontext=ubject_r:gpu_device:s0 tclass=chr_file permissive=0
01-05 15:14:20.606 254 3645 D WVCdm : Instantiating CDM.
01-05 15:14:20.608 254 254 I WVCdm : CdmEngine:penSession
01-05 15:14:20.608 254 254 I WVCdm : Level3 Library 4445 Sep 10 2016 21:30:01
01-05 15:14:20.632 254 254 D NvOsDebugPrintf:
01-05 15:14:20.632 254 254 D NvOsDebugPrintf:
01-05 15:14:20.632 254 254 D NvOsDebugPrintf:
01-05 15:14:20.632 254 254 D NvOsDebugPrintf: ****NvRmMemInit failed****
01-05 15:14:20.632 254 254 D NvOsDebugPrintf:
01-05 15:14:20.632 254 254 D NvOsDebugPrintf:
01-05 15:14:20.632 254 254 D oemcrypto_cenc: >> OEMCrypto_Initialize: modular drm 6.00
01-05 15:14:20.633 254 254 D oemcrypto_cenc: << OEMCrypto_Initialize
01-05 15:14:20.633 254 254 E oemcrypto_cenc: OEMCrypto_APIVersion: 11
01-05 15:14:20.633 254 254 D oemcrypto_cenc: >> OEMCrypto_IsKeyboxValid
01-05 15:14:20.633 254 254 D oemcrypto_cenc: << OEMCrypto_IsKeyboxValid
01-05 15:14:20.634 254 254 D WVCdm : OEMCrypto_Initialize Level 1 success. I will use level 1.
01-05 15:14:20.634 254 254 D oemcrypto_cenc: >> OEMCryptpenSession
01-05 15:14:20.634 254 254 D oemcrypto_cenc: bool AddSessionHandle(OEMCrypto_SESSION): session:0xee394570, status: 1
01-05 15:14:20.634 254 254 D oemcrypto_cenc: << OEMCryptpenSession
01-05 15:14:20.634 254 254 D oemcrypto_cenc: >> OEMCrypto_GetRandom
01-05 15:14:20.634 254 254 D oemcrypto_cenc: << OEMCrypto_GetRandom
01-05 15:14:20.634 254 254 E oemcrypto_cenc: OEMCrypto_SecurityLevel
01-05 15:14:20.635 254 254 D oemcrypto_cenc: >> OEMCrypto_LoadDeviceRSAKey
01-05 15:14:20.635 254 254 D oemcrypto_cenc: << OEMCrypto_LoadDeviceRSAKey
01-05 15:14:20.635 254 254 D oemcrypto_cenc: >> OEMCrypto_GetRandom
01-05 15:14:20.635 254 254 D oemcrypto_cenc: << OEMCrypto_GetRandom
01-05 15:14:20.635 254 254 I WVCdm : CdmEngine::QueryKeyControlInfo
01-05 15:14:20.636 254 16171 I WVCdm : CdmEngine::GenerateKeyRequest
01-05 15:14:20.636 254 16171 D oemcrypto_cenc: >> OEMCrypto_GetDeviceID
01-05 15:14:20.636 254 16171 D oemcrypto_cenc: << OEMCrypto_GetDeviceID
01-05 15:14:20.636 254 16171 D oemcrypto_cenc: >> OEMCrypto_SupportsUsageTable
01-05 15:14:20.660 254 16171 D oemcrypto_cenc: << OEMCrypto_SupportsUsageTable
01-05 15:14:20.660 254 16171 E oemcrypto_cenc: OEMCrypto_APIVersion: 11
01-05 15:14:20.660 254 16171 D oemcrypto_cenc: OEMCrypto_GetHDCPCapability
01-05 15:14:20.660 254 16171 D oemcrypto_cenc: >> OEMCrypto_GenerateNonce
01-05 15:14:20.660 254 16171 D oemcrypto_cenc: << OEMCrypto_GenerateNonce
01-05 15:14:20.660 254 16171 D WVCdm : PrepareKeyRequest: nonce=749983962
01-05 15:14:20.660 254 16171 D oemcrypto_cenc: >> OEMCrypto_GenerateRSASignature
01-05 15:14:20.714 5588 5612 W Herrevad: Invalid mccmnc
01-05 15:14:20.719 254 16171 D oemcrypto_cenc: << OEMCrypto_GenerateRSASignature
01-05 15:14:20.720 254 3644 I WVCdm : CdmEngine::CloseSession
01-05 15:14:20.721 254 3644 D oemcrypto_cenc: >> OEMCrypto_CloseSession
01-05 15:14:20.721 254 3644 D oemcrypto_cenc: bool RemoveSessionHandle(OEMCrypto_SESSION): session: 0xee394570, status: 1
01-05 15:14:20.723 254 3644 D oemcrypto_cenc: << OEMCrypto_CloseSession
01-05 15:14:20.723 254 3644 D oemcrypto_cenc: >> OEMCrypto_Terminate
01-05 15:14:20.724 254 3644 D oemcrypto_cenc: << OEMCrypto_Terminate
01-05 15:14:20.757 5588 5612 W Herrevad: Invalid mccmnc
01-05 15:14:20.854 19721 19788 I qtaguid : Tagging socket -1 with tag 0(0) for uid -1 failed errno=-9
01-05 15:14:20.854 19721 19788 I NetworkManagementSocketTagger: tagSocketFd(-1, 0, -1) failed with errno-9
01-05 15:14:20.876 19721 19787 I qtaguid : Tagging socket -1 with tag 0(0) for uid -1 failed errno=-9
01-05 15:14:20.877 19721 19787 I NetworkManagementSocketTagger: tagSocketFd(-1, 0, -1) failed with errno-9
01-05 15:14:20.950 19721 19788 I qtaguid : Untagging socket -1 failed errno=-9
01-05 15:14:20.950 19721 19788 W NetworkManagementSocketTagger: untagSocket(-1) failed with errno -9
01-05 15:14:20.975 19721 19787 I qtaguid : Untagging socket -1 failed errno=-9
01-05 15:14:20.975 19721 19787 W NetworkManagementSocketTagger: untagSocket(-1) failed with errno -9
01-05 15:14:21.538 11930 22177 D HeadsetPhoneState: sendDeviceStateChanged. mService=0 mSignal=0 mRoam=0 mBatteryCharge=2
01-05 15:14:21.574 1212 1212 E PhoneInterfaceManager: [PhoneIntfMgr] queryModemActivityInfo: Empty response
01-05 15:14:21.606 596 624 E BatteryStatsService: power: Missing API
01-05 15:14:21.622 596 624 E BatteryStatsService: modem info is invalid: ModemActivityInfo{ mTimestamp=0 mSleepTimeMs=0 mIdleTimeMs=0 mTxTimeMs[]=[0, 0, 0, 0, 0] mRxTimeMs=0 mEnergyUsed=0}
01-05 15:14:22.170 21227 21233 I art : Do partial code cache collection, code=30KB, data=25KB
01-05 15:14:22.172 21227 21233 I art : After code cache collection, code=30KB, data=25KB
01-05 15:14:22.172 21227 21233 I art : Increasing code cache capacity to 128KB
Can someone point me what might be wrong with device? This might be hardware malfunction?